Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
4d405552
Commit
4d405552
authored
Aug 27, 2008
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lvs-next-2.6' of
git://git.kernel.org/pub/scm/linux/kernel/git/horms/lvs-2.6
parents
eff253c4
7fd10678
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1332 additions
and
557 deletions
+1332
-557
include/linux/ip_vs.h
include/linux/ip_vs.h
+160
-0
include/net/ip_vs.h
include/net/ip_vs.h
+2
-0
net/ipv4/ipvs/Kconfig
net/ipv4/ipvs/Kconfig
+6
-0
net/ipv4/ipvs/Makefile
net/ipv4/ipvs/Makefile
+1
-2
net/ipv4/ipvs/ip_vs_core.c
net/ipv4/ipvs/ip_vs_core.c
+6
-2
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_ctl.c
+887
-9
net/ipv4/ipvs/ip_vs_est.c
net/ipv4/ipvs/ip_vs_est.c
+11
-7
net/ipv4/ipvs/ip_vs_lblc.c
net/ipv4/ipvs/ip_vs_lblc.c
+97
-116
net/ipv4/ipvs/ip_vs_lblcr.c
net/ipv4/ipvs/ip_vs_lblcr.c
+115
-123
net/ipv4/ipvs/ip_vs_lc.c
net/ipv4/ipvs/ip_vs_lc.c
+0
-21
net/ipv4/ipvs/ip_vs_nq.c
net/ipv4/ipvs/ip_vs_nq.c
+0
-24
net/ipv4/ipvs/ip_vs_proto_ah_esp.c
net/ipv4/ipvs/ip_vs_proto_ah_esp.c
+47
-22
net/ipv4/ipvs/ip_vs_proto_esp.c
net/ipv4/ipvs/ip_vs_proto_esp.c
+0
-176
net/ipv4/ipvs/ip_vs_rr.c
net/ipv4/ipvs/ip_vs_rr.c
+0
-7
net/ipv4/ipvs/ip_vs_sed.c
net/ipv4/ipvs/ip_vs_sed.c
+0
-24
net/ipv4/ipvs/ip_vs_wlc.c
net/ipv4/ipvs/ip_vs_wlc.c
+0
-24
No files found.
include/linux/ip_vs.h
View file @
4d405552
...
...
@@ -242,4 +242,164 @@ struct ip_vs_daemon_user {
int
syncid
;
};
/*
*
* IPVS Generic Netlink interface definitions
*
*/
/* Generic Netlink family info */
#define IPVS_GENL_NAME "IPVS"
#define IPVS_GENL_VERSION 0x1
struct
ip_vs_flags
{
__be32
flags
;
__be32
mask
;
};
/* Generic Netlink command attributes */
enum
{
IPVS_CMD_UNSPEC
=
0
,
IPVS_CMD_NEW_SERVICE
,
/* add service */
IPVS_CMD_SET_SERVICE
,
/* modify service */
IPVS_CMD_DEL_SERVICE
,
/* delete service */
IPVS_CMD_GET_SERVICE
,
/* get service info */
IPVS_CMD_NEW_DEST
,
/* add destination */
IPVS_CMD_SET_DEST
,
/* modify destination */
IPVS_CMD_DEL_DEST
,
/* delete destination */
IPVS_CMD_GET_DEST
,
/* get destination info */
IPVS_CMD_NEW_DAEMON
,
/* start sync daemon */
IPVS_CMD_DEL_DAEMON
,
/* stop sync daemon */
IPVS_CMD_GET_DAEMON
,
/* get sync daemon status */
IPVS_CMD_SET_CONFIG
,
/* set config settings */
IPVS_CMD_GET_CONFIG
,
/* get config settings */
IPVS_CMD_SET_INFO
,
/* only used in GET_INFO reply */
IPVS_CMD_GET_INFO
,
/* get general IPVS info */
IPVS_CMD_ZERO
,
/* zero all counters and stats */
IPVS_CMD_FLUSH
,
/* flush services and dests */
__IPVS_CMD_MAX
,
};
#define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1)
/* Attributes used in the first level of commands */
enum
{
IPVS_CMD_ATTR_UNSPEC
=
0
,
IPVS_CMD_ATTR_SERVICE
,
/* nested service attribute */
IPVS_CMD_ATTR_DEST
,
/* nested destination attribute */
IPVS_CMD_ATTR_DAEMON
,
/* nested sync daemon attribute */
IPVS_CMD_ATTR_TIMEOUT_TCP
,
/* TCP connection timeout */
IPVS_CMD_ATTR_TIMEOUT_TCP_FIN
,
/* TCP FIN wait timeout */
IPVS_CMD_ATTR_TIMEOUT_UDP
,
/* UDP timeout */
__IPVS_CMD_ATTR_MAX
,
};
#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
/*
* Attributes used to describe a service
*
* Used inside nested attribute IPVS_CMD_ATTR_SERVICE
*/
enum
{
IPVS_SVC_ATTR_UNSPEC
=
0
,
IPVS_SVC_ATTR_AF
,
/* address family */
IPVS_SVC_ATTR_PROTOCOL
,
/* virtual service protocol */
IPVS_SVC_ATTR_ADDR
,
/* virtual service address */
IPVS_SVC_ATTR_PORT
,
/* virtual service port */
IPVS_SVC_ATTR_FWMARK
,
/* firewall mark of service */
IPVS_SVC_ATTR_SCHED_NAME
,
/* name of scheduler */
IPVS_SVC_ATTR_FLAGS
,
/* virtual service flags */
IPVS_SVC_ATTR_TIMEOUT
,
/* persistent timeout */
IPVS_SVC_ATTR_NETMASK
,
/* persistent netmask */
IPVS_SVC_ATTR_STATS
,
/* nested attribute for service stats */
__IPVS_SVC_ATTR_MAX
,
};
#define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
/*
* Attributes used to describe a destination (real server)
*
* Used inside nested attribute IPVS_CMD_ATTR_DEST
*/
enum
{
IPVS_DEST_ATTR_UNSPEC
=
0
,
IPVS_DEST_ATTR_ADDR
,
/* real server address */
IPVS_DEST_ATTR_PORT
,
/* real server port */
IPVS_DEST_ATTR_FWD_METHOD
,
/* forwarding method */
IPVS_DEST_ATTR_WEIGHT
,
/* destination weight */
IPVS_DEST_ATTR_U_THRESH
,
/* upper threshold */
IPVS_DEST_ATTR_L_THRESH
,
/* lower threshold */
IPVS_DEST_ATTR_ACTIVE_CONNS
,
/* active connections */
IPVS_DEST_ATTR_INACT_CONNS
,
/* inactive connections */
IPVS_DEST_ATTR_PERSIST_CONNS
,
/* persistent connections */
IPVS_DEST_ATTR_STATS
,
/* nested attribute for dest stats */
__IPVS_DEST_ATTR_MAX
,
};
#define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
/*
* Attributes describing a sync daemon
*
* Used inside nested attribute IPVS_CMD_ATTR_DAEMON
*/
enum
{
IPVS_DAEMON_ATTR_UNSPEC
=
0
,
IPVS_DAEMON_ATTR_STATE
,
/* sync daemon state (master/backup) */
IPVS_DAEMON_ATTR_MCAST_IFN
,
/* multicast interface name */
IPVS_DAEMON_ATTR_SYNC_ID
,
/* SyncID we belong to */
__IPVS_DAEMON_ATTR_MAX
,
};
#define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1)
/*
* Attributes used to describe service or destination entry statistics
*
* Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS
*/
enum
{
IPVS_STATS_ATTR_UNSPEC
=
0
,
IPVS_STATS_ATTR_CONNS
,
/* connections scheduled */
IPVS_STATS_ATTR_INPKTS
,
/* incoming packets */
IPVS_STATS_ATTR_OUTPKTS
,
/* outgoing packets */
IPVS_STATS_ATTR_INBYTES
,
/* incoming bytes */
IPVS_STATS_ATTR_OUTBYTES
,
/* outgoing bytes */
IPVS_STATS_ATTR_CPS
,
/* current connection rate */
IPVS_STATS_ATTR_INPPS
,
/* current in packet rate */
IPVS_STATS_ATTR_OUTPPS
,
/* current out packet rate */
IPVS_STATS_ATTR_INBPS
,
/* current in byte rate */
IPVS_STATS_ATTR_OUTBPS
,
/* current out byte rate */
__IPVS_STATS_ATTR_MAX
,
};
#define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1)
/* Attributes used in response to IPVS_CMD_GET_INFO command */
enum
{
IPVS_INFO_ATTR_UNSPEC
=
0
,
IPVS_INFO_ATTR_VERSION
,
/* IPVS version number */
IPVS_INFO_ATTR_CONN_TAB_SIZE
,
/* size of connection hash table */
__IPVS_INFO_ATTR_MAX
,
};
#define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1)
#endif
/* _IP_VS_H */
include/net/ip_vs.h
View file @
4d405552
...
...
@@ -683,6 +683,8 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
/*
* IPVS rate estimator prototypes (from ip_vs_est.c)
*/
extern
int
ip_vs_estimator_init
(
void
);
extern
void
ip_vs_estimator_cleanup
(
void
);
extern
void
ip_vs_new_estimator
(
struct
ip_vs_stats
*
stats
);
extern
void
ip_vs_kill_estimator
(
struct
ip_vs_stats
*
stats
);
extern
void
ip_vs_zero_estimator
(
struct
ip_vs_stats
*
stats
);
...
...
net/ipv4/ipvs/Kconfig
View file @
4d405552
...
...
@@ -71,14 +71,20 @@ config IP_VS_PROTO_UDP
This option enables support for load balancing UDP transport
protocol. Say Y if unsure.
config IP_VS_PROTO_AH_ESP
bool
depends on UNDEFINED
config IP_VS_PROTO_ESP
bool "ESP load balancing support"
select IP_VS_PROTO_AH_ESP
---help---
This option enables support for load balancing ESP (Encapsulation
Security Payload) transport protocol. Say Y if unsure.
config IP_VS_PROTO_AH
bool "AH load balancing support"
select IP_VS_PROTO_AH_ESP
---help---
This option enables support for load balancing AH (Authentication
Header) transport protocol. Say Y if unsure.
...
...
net/ipv4/ipvs/Makefile
View file @
4d405552
...
...
@@ -6,8 +6,7 @@
ip_vs_proto-objs-y
:=
ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_TCP)
+=
ip_vs_proto_tcp.o
ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_UDP)
+=
ip_vs_proto_udp.o
ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_ESP)
+=
ip_vs_proto_esp.o
ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_AH)
+=
ip_vs_proto_ah.o
ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_AH_ESP)
+=
ip_vs_proto_ah_esp.o
ip_vs-objs
:=
ip_vs_conn.o ip_vs_core.o ip_vs_ctl.o ip_vs_sched.o
\
ip_vs_xmit.o ip_vs_app.o ip_vs_sync.o
\
...
...
net/ipv4/ipvs/ip_vs_core.c
View file @
4d405552
...
...
@@ -1070,10 +1070,12 @@ static int __init ip_vs_init(void)
{
int
ret
;
ip_vs_estimator_init
();
ret
=
ip_vs_control_init
();
if
(
ret
<
0
)
{
IP_VS_ERR
(
"can't setup control.
\n
"
);
goto
cleanup_
nothing
;
goto
cleanup_
estimator
;
}
ip_vs_protocol_init
();
...
...
@@ -1106,7 +1108,8 @@ static int __init ip_vs_init(void)
cleanup_protocol:
ip_vs_protocol_cleanup
();
ip_vs_control_cleanup
();
cleanup_nothing:
cleanup_estimator:
ip_vs_estimator_cleanup
();
return
ret
;
}
...
...
@@ -1117,6 +1120,7 @@ static void __exit ip_vs_cleanup(void)
ip_vs_app_cleanup
();
ip_vs_protocol_cleanup
();
ip_vs_control_cleanup
();
ip_vs_estimator_cleanup
();
IP_VS_INFO
(
"ipvs unloaded.
\n
"
);
}
...
...
net/ipv4/ipvs/ip_vs_ctl.c
View file @
4d405552
This diff is collapsed.
Click to expand it.
net/ipv4/ipvs/ip_vs_est.c
View file @
4d405552
...
...
@@ -124,8 +124,6 @@ void ip_vs_new_estimator(struct ip_vs_stats *stats)
est
->
outbps
=
stats
->
outbps
<<
5
;
spin_lock_bh
(
&
est_lock
);
if
(
list_empty
(
&
est_list
))
mod_timer
(
&
est_timer
,
jiffies
+
2
*
HZ
);
list_add
(
&
est
->
list
,
&
est_list
);
spin_unlock_bh
(
&
est_lock
);
}
...
...
@@ -136,11 +134,6 @@ void ip_vs_kill_estimator(struct ip_vs_stats *stats)
spin_lock_bh
(
&
est_lock
);
list_del
(
&
est
->
list
);
while
(
list_empty
(
&
est_list
)
&&
try_to_del_timer_sync
(
&
est_timer
)
<
0
)
{
spin_unlock_bh
(
&
est_lock
);
cpu_relax
();
spin_lock_bh
(
&
est_lock
);
}
spin_unlock_bh
(
&
est_lock
);
}
...
...
@@ -160,3 +153,14 @@ void ip_vs_zero_estimator(struct ip_vs_stats *stats)
est
->
inbps
=
0
;
est
->
outbps
=
0
;
}
int
__init
ip_vs_estimator_init
(
void
)
{
mod_timer
(
&
est_timer
,
jiffies
+
2
*
HZ
);
return
0
;
}
void
ip_vs_estimator_cleanup
(
void
)
{
del_timer_sync
(
&
est_timer
);
}
net/ipv4/ipvs/ip_vs_lblc.c
View file @
4d405552
This diff is collapsed.
Click to expand it.
net/ipv4/ipvs/ip_vs_lblcr.c
View file @
4d405552
This diff is collapsed.
Click to expand it.
net/ipv4/ipvs/ip_vs_lc.c
View file @
4d405552
...
...
@@ -20,24 +20,6 @@
#include <net/ip_vs.h>
static
int
ip_vs_lc_init_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_lc_done_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_lc_update_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
inline
unsigned
int
ip_vs_lc_dest_overhead
(
struct
ip_vs_dest
*
dest
)
{
...
...
@@ -99,9 +81,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = {
.
refcnt
=
ATOMIC_INIT
(
0
),
.
module
=
THIS_MODULE
,
.
n_list
=
LIST_HEAD_INIT
(
ip_vs_lc_scheduler
.
n_list
),
.
init_service
=
ip_vs_lc_init_svc
,
.
done_service
=
ip_vs_lc_done_svc
,
.
update_service
=
ip_vs_lc_update_svc
,
.
schedule
=
ip_vs_lc_schedule
,
};
...
...
net/ipv4/ipvs/ip_vs_nq.c
View file @
4d405552
...
...
@@ -37,27 +37,6 @@
#include <net/ip_vs.h>
static
int
ip_vs_nq_init_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_nq_done_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_nq_update_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
inline
unsigned
int
ip_vs_nq_dest_overhead
(
struct
ip_vs_dest
*
dest
)
{
...
...
@@ -137,9 +116,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler =
.
refcnt
=
ATOMIC_INIT
(
0
),
.
module
=
THIS_MODULE
,
.
n_list
=
LIST_HEAD_INIT
(
ip_vs_nq_scheduler
.
n_list
),
.
init_service
=
ip_vs_nq_init_svc
,
.
done_service
=
ip_vs_nq_done_svc
,
.
update_service
=
ip_vs_nq_update_svc
,
.
schedule
=
ip_vs_nq_schedule
,
};
...
...
net/ipv4/ipvs/ip_vs_proto_ah.c
→
net/ipv4/ipvs/ip_vs_proto_ah
_esp
.c
View file @
4d405552
/*
* ip_vs_proto_ah
.c: AH
IPSec load balancing support for IPVS
* ip_vs_proto_ah
_esp.c: AH/ESP
IPSec load balancing support for IPVS
*
* Authors: Julian Anastasov <ja@ssi.bg>, February 2002
* Wensong Zhang <wensong@linuxvirtualserver.org>
...
...
@@ -39,11 +39,11 @@ struct isakmp_hdr {
static
struct
ip_vs_conn
*
ah_conn_in_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
ah_
esp_
conn_in_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
{
struct
ip_vs_conn
*
cp
;
...
...
@@ -79,8 +79,8 @@ ah_conn_in_get(const struct sk_buff *skb,
static
struct
ip_vs_conn
*
ah_conn_out_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
ah_
esp_
conn_out_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
{
struct
ip_vs_conn
*
cp
;
...
...
@@ -112,12 +112,12 @@ ah_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
static
int
ah_conn_schedule
(
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
int
*
verdict
,
struct
ip_vs_conn
**
cpp
)
ah_
esp_
conn_schedule
(
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
int
*
verdict
,
struct
ip_vs_conn
**
cpp
)
{
/*
* AH is only related traffic. Pass the packet to IP stack.
* AH
/ESP
is only related traffic. Pass the packet to IP stack.
*/
*
verdict
=
NF_ACCEPT
;
return
0
;
...
...
@@ -125,8 +125,8 @@ ah_conn_schedule(struct sk_buff *skb,
static
void
ah_debug_packet
(
struct
ip_vs_protocol
*
pp
,
const
struct
sk_buff
*
skb
,
int
offset
,
const
char
*
msg
)
ah_
esp_
debug_packet
(
struct
ip_vs_protocol
*
pp
,
const
struct
sk_buff
*
skb
,
int
offset
,
const
char
*
msg
)
{
char
buf
[
256
];
struct
iphdr
_iph
,
*
ih
;
...
...
@@ -143,28 +143,29 @@ ah_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb,
}
static
void
ah_init
(
struct
ip_vs_protocol
*
pp
)
static
void
ah_
esp_
init
(
struct
ip_vs_protocol
*
pp
)
{
/* nothing to do now */
}
static
void
ah_exit
(
struct
ip_vs_protocol
*
pp
)
static
void
ah_e
sp_e
xit
(
struct
ip_vs_protocol
*
pp
)
{
/* nothing to do now */
}
#ifdef CONFIG_IP_VS_PROTO_AH
struct
ip_vs_protocol
ip_vs_protocol_ah
=
{
.
name
=
"AH"
,
.
protocol
=
IPPROTO_AH
,
.
num_states
=
1
,
.
dont_defrag
=
1
,
.
init
=
ah_init
,
.
exit
=
ah_exit
,
.
conn_schedule
=
ah_conn_schedule
,
.
conn_in_get
=
ah_conn_in_get
,
.
conn_out_get
=
ah_conn_out_get
,
.
init
=
ah_
esp_
init
,
.
exit
=
ah_e
sp_e
xit
,
.
conn_schedule
=
ah_
esp_
conn_schedule
,
.
conn_in_get
=
ah_
esp_
conn_in_get
,
.
conn_out_get
=
ah_
esp_
conn_out_get
,
.
snat_handler
=
NULL
,
.
dnat_handler
=
NULL
,
.
csum_check
=
NULL
,
...
...
@@ -172,7 +173,31 @@ struct ip_vs_protocol ip_vs_protocol_ah = {
.
register_app
=
NULL
,
.
unregister_app
=
NULL
,
.
app_conn_bind
=
NULL
,
.
debug_packet
=
ah_debug_packet
,
.
debug_packet
=
ah_
esp_
debug_packet
,
.
timeout_change
=
NULL
,
/* ISAKMP */
.
set_state_timeout
=
NULL
,
};
#endif
#ifdef CONFIG_IP_VS_PROTO_ESP
struct
ip_vs_protocol
ip_vs_protocol_esp
=
{
.
name
=
"ESP"
,
.
protocol
=
IPPROTO_ESP
,
.
num_states
=
1
,
.
dont_defrag
=
1
,
.
init
=
ah_esp_init
,
.
exit
=
ah_esp_exit
,
.
conn_schedule
=
ah_esp_conn_schedule
,
.
conn_in_get
=
ah_esp_conn_in_get
,
.
conn_out_get
=
ah_esp_conn_out_get
,
.
snat_handler
=
NULL
,
.
dnat_handler
=
NULL
,
.
csum_check
=
NULL
,
.
state_transition
=
NULL
,
.
register_app
=
NULL
,
.
unregister_app
=
NULL
,
.
app_conn_bind
=
NULL
,
.
debug_packet
=
ah_esp_debug_packet
,
.
timeout_change
=
NULL
,
/* ISAKMP */
};
#endif
net/ipv4/ipvs/ip_vs_proto_esp.c
deleted
100644 → 0
View file @
eff253c4
/*
* ip_vs_proto_esp.c: ESP IPSec load balancing support for IPVS
*
* Authors: Julian Anastasov <ja@ssi.bg>, February 2002
* Wensong Zhang <wensong@linuxvirtualserver.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation;
*
*/
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <net/ip_vs.h>
/* TODO:
struct isakmp_hdr {
__u8 icookie[8];
__u8 rcookie[8];
__u8 np;
__u8 version;
__u8 xchgtype;
__u8 flags;
__u32 msgid;
__u32 length;
};
*/
#define PORT_ISAKMP 500
static
struct
ip_vs_conn
*
esp_conn_in_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
{
struct
ip_vs_conn
*
cp
;
if
(
likely
(
!
inverse
))
{
cp
=
ip_vs_conn_in_get
(
IPPROTO_UDP
,
iph
->
saddr
,
htons
(
PORT_ISAKMP
),
iph
->
daddr
,
htons
(
PORT_ISAKMP
));
}
else
{
cp
=
ip_vs_conn_in_get
(
IPPROTO_UDP
,
iph
->
daddr
,
htons
(
PORT_ISAKMP
),
iph
->
saddr
,
htons
(
PORT_ISAKMP
));
}
if
(
!
cp
)
{
/*
* We are not sure if the packet is from our
* service, so our conn_schedule hook should return NF_ACCEPT
*/
IP_VS_DBG
(
12
,
"Unknown ISAKMP entry for outin packet "
"%s%s %u.%u.%u.%u->%u.%u.%u.%u
\n
"
,
inverse
?
"ICMP+"
:
""
,
pp
->
name
,
NIPQUAD
(
iph
->
saddr
),
NIPQUAD
(
iph
->
daddr
));
}
return
cp
;
}
static
struct
ip_vs_conn
*
esp_conn_out_get
(
const
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
const
struct
iphdr
*
iph
,
unsigned
int
proto_off
,
int
inverse
)
{
struct
ip_vs_conn
*
cp
;
if
(
likely
(
!
inverse
))
{
cp
=
ip_vs_conn_out_get
(
IPPROTO_UDP
,
iph
->
saddr
,
htons
(
PORT_ISAKMP
),
iph
->
daddr
,
htons
(
PORT_ISAKMP
));
}
else
{
cp
=
ip_vs_conn_out_get
(
IPPROTO_UDP
,
iph
->
daddr
,
htons
(
PORT_ISAKMP
),
iph
->
saddr
,
htons
(
PORT_ISAKMP
));
}
if
(
!
cp
)
{
IP_VS_DBG
(
12
,
"Unknown ISAKMP entry for inout packet "
"%s%s %u.%u.%u.%u->%u.%u.%u.%u
\n
"
,
inverse
?
"ICMP+"
:
""
,
pp
->
name
,
NIPQUAD
(
iph
->
saddr
),
NIPQUAD
(
iph
->
daddr
));
}
return
cp
;
}
static
int
esp_conn_schedule
(
struct
sk_buff
*
skb
,
struct
ip_vs_protocol
*
pp
,
int
*
verdict
,
struct
ip_vs_conn
**
cpp
)
{
/*
* ESP is only related traffic. Pass the packet to IP stack.
*/
*
verdict
=
NF_ACCEPT
;
return
0
;
}
static
void
esp_debug_packet
(
struct
ip_vs_protocol
*
pp
,
const
struct
sk_buff
*
skb
,
int
offset
,
const
char
*
msg
)
{
char
buf
[
256
];
struct
iphdr
_iph
,
*
ih
;
ih
=
skb_header_pointer
(
skb
,
offset
,
sizeof
(
_iph
),
&
_iph
);
if
(
ih
==
NULL
)
sprintf
(
buf
,
"%s TRUNCATED"
,
pp
->
name
);
else
sprintf
(
buf
,
"%s %u.%u.%u.%u->%u.%u.%u.%u"
,
pp
->
name
,
NIPQUAD
(
ih
->
saddr
),
NIPQUAD
(
ih
->
daddr
));
printk
(
KERN_DEBUG
"IPVS: %s: %s
\n
"
,
msg
,
buf
);
}
static
void
esp_init
(
struct
ip_vs_protocol
*
pp
)
{
/* nothing to do now */
}
static
void
esp_exit
(
struct
ip_vs_protocol
*
pp
)
{
/* nothing to do now */
}
struct
ip_vs_protocol
ip_vs_protocol_esp
=
{
.
name
=
"ESP"
,
.
protocol
=
IPPROTO_ESP
,
.
num_states
=
1
,
.
dont_defrag
=
1
,
.
init
=
esp_init
,
.
exit
=
esp_exit
,
.
conn_schedule
=
esp_conn_schedule
,
.
conn_in_get
=
esp_conn_in_get
,
.
conn_out_get
=
esp_conn_out_get
,
.
snat_handler
=
NULL
,
.
dnat_handler
=
NULL
,
.
csum_check
=
NULL
,
.
state_transition
=
NULL
,
.
register_app
=
NULL
,
.
unregister_app
=
NULL
,
.
app_conn_bind
=
NULL
,
.
debug_packet
=
esp_debug_packet
,
.
timeout_change
=
NULL
,
/* ISAKMP */
};
net/ipv4/ipvs/ip_vs_rr.c
View file @
4d405552
...
...
@@ -32,12 +32,6 @@ static int ip_vs_rr_init_svc(struct ip_vs_service *svc)
}
static
int
ip_vs_rr_done_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_rr_update_svc
(
struct
ip_vs_service
*
svc
)
{
svc
->
sched_data
=
&
svc
->
destinations
;
...
...
@@ -96,7 +90,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = {
.
module
=
THIS_MODULE
,
.
n_list
=
LIST_HEAD_INIT
(
ip_vs_rr_scheduler
.
n_list
),
.
init_service
=
ip_vs_rr_init_svc
,
.
done_service
=
ip_vs_rr_done_svc
,
.
update_service
=
ip_vs_rr_update_svc
,
.
schedule
=
ip_vs_rr_schedule
,
};
...
...
net/ipv4/ipvs/ip_vs_sed.c
View file @
4d405552
...
...
@@ -41,27 +41,6 @@
#include <net/ip_vs.h>
static
int
ip_vs_sed_init_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_sed_done_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_sed_update_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
inline
unsigned
int
ip_vs_sed_dest_overhead
(
struct
ip_vs_dest
*
dest
)
{
...
...
@@ -139,9 +118,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler =
.
refcnt
=
ATOMIC_INIT
(
0
),
.
module
=
THIS_MODULE
,
.
n_list
=
LIST_HEAD_INIT
(
ip_vs_sed_scheduler
.
n_list
),
.
init_service
=
ip_vs_sed_init_svc
,
.
done_service
=
ip_vs_sed_done_svc
,
.
update_service
=
ip_vs_sed_update_svc
,
.
schedule
=
ip_vs_sed_schedule
,
};
...
...
net/ipv4/ipvs/ip_vs_wlc.c
View file @
4d405552
...
...
@@ -25,27 +25,6 @@
#include <net/ip_vs.h>
static
int
ip_vs_wlc_init_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_wlc_done_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
int
ip_vs_wlc_update_svc
(
struct
ip_vs_service
*
svc
)
{
return
0
;
}
static
inline
unsigned
int
ip_vs_wlc_dest_overhead
(
struct
ip_vs_dest
*
dest
)
{
...
...
@@ -127,9 +106,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler =
.
refcnt
=
ATOMIC_INIT
(
0
),
.
module
=
THIS_MODULE
,
.
n_list
=
LIST_HEAD_INIT
(
ip_vs_wlc_scheduler
.
n_list
),
.
init_service
=
ip_vs_wlc_init_svc
,
.
done_service
=
ip_vs_wlc_done_svc
,
.
update_service
=
ip_vs_wlc_update_svc
,
.
schedule
=
ip_vs_wlc_schedule
,
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment