IPVS full NAT support + netfilter 'ipvs' match support
Subsystems (5)
Simon Horman
maintainercover IPVS full NAT support + netfilter 'ipvs' match support
[re-reposting without bogus headers that vger dislikes]
This is a repost of a patch-series posted by Hannes Eder last Steptember. This is v2 of the patch series and I don't see any outstanding objections to it in the mailing list archives. I would like it considered for inclusion in the nf-next-2.6 kernel tree and iptables.
The original cover-email from Hannes follows.
The diffstat output has been updated to reflect minor up-porting by me.
From: Hannes Eder <[email protected]>
The following series implements full NAT support for IPVS. The approach is via a minimal change to IPVS (make friends with nf_conntrack) and adding a netfilter matcher, kernel- and user-space part, i.e. xt_ipvs and libxt_ipvs.
Example usage:
% ipvsadm -A -t 192.168.100.30:80 -s rr
% ipvsadm -a -t 192.168.100.30:80 -r 192.168.10.20:80 -m
# ...
# Source NAT for VIP 192.168.100.30:80
% iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 \
Quoted 1 line
--vport 80 -j SNAT --to-source 192.168.10.10
or SNAT-ing only a specific real server:
% iptables -t nat -A POSTROUTING --dst 192.168.11.20 \
Quoted 1 line
-m ipvs --vaddr 192.168.100.30/32 -j SNAT --to-source 192.168.10.10
First of all, thanks for all the feedback. This is the changelog for v2:
- Make ip_vs_ftp work again. Setup nf_conntrack expectations for related data connections (based on Julian's patch see
http://www.ssi.bg/~ja/nfct/) and let nf_conntrack/nf_nat do the packet mangling and the TCP sequence adjusting.
This change rises the question how to deal with ip_vs_sync? Does it work together with conntrackd? Wild idea: what about getting rid of ip_vs_sync and piggy packing all on nf_conntrack and use conntrackd?
Any comments on this?
- xt_ipvs: add new rule '--vportctl port' to match the VIP port of the controlling connection, e.g. port 21 for FTP. Can be used to match a related data connection for FTP:
# SNAT FTP control connection % iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 \ > --vport 21 -j SNAT --to-source 192.168.10.10 # SNAT FTP passive data connection % iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 \ > --vportctl 21 -j SNAT --to-source 192.168.10.10
- xt_ipvs: use 'par->family' instead of 'skb->protocol'
- xt_ipvs: add ipvs_mt_check and restrict to NFPROTO_IPV4 and NFPROTO_IPV6
- Call nf_conntrack_alter_reply(), so helper lookup is performed based on the changed tuple.
Changes to the linux kernel (rebased to next-20090925):
Hannes Eder (3):
netfilter: xt_ipvs (netfilter matcher for IPVS)
IPVS: make friends with nf_conntrack
IPVS: make FTP work with full NAT support
include/linux/netfilter/xt_ipvs.h | 25 +++++ include/net/ip_vs.h | 2 net/netfilter/Kconfig | 9 ++ net/netfilter/Makefile | 1 net/netfilter/ipvs/Kconfig | 4 - net/netfilter/ipvs/ip_vs_app.c | 43 --------- net/netfilter/ipvs/ip_vs_core.c | 37 ------- net/netfilter/ipvs/ip_vs_ftp.c | 178 ++++++++++++++++++++++++++++++++--- net/netfilter/ipvs/ip_vs_proto.c | 1 net/netfilter/ipvs/ip_vs_xmit.c | 30 ++++++ net/netfilter/xt_ipvs.c | 187 +++++++++++++++++++++++++++++++++++++ 11 files changed, 418 insertions(+), 99 deletions(-) create mode 100644 include/linux/netfilter/xt_ipvs.h create mode 100644 net/netfilter/xt_ipvs.c
Changes to iptables (relative to 1.4.5):
Hannes Eder (1):
libxt_ipvs: user-space lib for netfilter matcher xt_ipvs
configure.ac | 10 1 extensions/libxt_ipvs.c | 365 +++++++++++++++++++++++++++++++++++++ extensions/libxt_ipvs.man | 24 ++ include/linux/netfilter/xt_ipvs.h | 25 +++ 4 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 extensions/libxt_ipvs.c create mode 100644 extensions/libxt_ipvs.man create mode 100644 include/linux/netfilter/xt_ipvs.h
Simon Horman
maintainerPATCH 1/4 netfilter: xt_ipvs (netfilter matcher for IPVS)
From: Hannes Eder <[email protected]>
This implements the kernel-space side of the netfilter matcher xt_ipvs.
include/linux/netfilter/xt_ipvs.h | 25 +++++ net/netfilter/Kconfig | 9 ++ net/netfilter/Makefile | 1 net/netfilter/ipvs/ip_vs_proto.c | 1 net/netfilter/xt_ipvs.c | 187 +++++++++++++++++++++++++++++++++++++ 5 files changed, 223 insertions(+), 0 deletions(-) create mode 100644 include/linux/netfilter/xt_ipvs.h create mode 100644 net/netfilter/xt_ipvs.c
include/linux/netfilter/xt_ipvs.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef _XT_IPVS_H +#define _XT_IPVS_H 1 + +#define XT_IPVS_IPVS_PROPERTY (1 << 0)/* all other options imply this one */ +#define XT_IPVS_PROTO (1 << 1) +#define XT_IPVS_VADDR (1 << 2) +#define XT_IPVS_VPORT (1 << 3) +#define XT_IPVS_DIR (1 << 4) +#define XT_IPVS_METHOD (1 << 5) +#define XT_IPVS_VPORTCTL (1 << 6) +#define XT_IPVS_MASK ((1 << 7) - 1) +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY) + +struct xt_ipvs_mtinfo { +union nf_inet_addr vaddr, vmask; +__be16 vport; +__u16 l4proto; +__u16 fwd_method; +__be16 vportctl; + +__u8 invert; +__u8 bitmask; +}; + +#endif /* _XT_IPVS_H */
net/netfilter/Kconfig +9 -0
@@ -703,6 +703,15 @@ config NETFILTER_XT_MATCH_IPRANGE If unsure, say M. +config NETFILTER_XT_MATCH_IPVS + tristate '"ipvs" match support' + depends on IP_VS + depends on NETFILTER_ADVANCED + help + This option allows you to match against IPVS properties of a packet. + + If unsure, say N. + config NETFILTER_XT_MATCH_LENGTH tristate '"length" match support' depends on NETFILTER_ADVANCED
net/netfilter/Makefile +1 -0
@@ -73,6 +73,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMI obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o +obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o
net/netfilter/ipvs/ip_vs_proto.c +1 -0
@@ -97,6 +97,7 @@ struct ip_vs_protocol * ip_vs_proto_get(return NULL ; } +EXPORT_SYMBOL (ip_vs_proto_get);/*
net/netfilter/xt_ipvs.c new file +187 -0
187 lines not on this page · raw message
Re: [patch v2.2 1/4] [PATCH v2.1 1/4] netfilter: xt_ipvs (netfilter matcher for IPVS)
include/linux/netfilter/xt_ipvs.h line 2
Quoted 3 lines · Simon Horman
include/linux/netfilter/xt_ipvs.h new file +2
-0@@ -0,0 +1,25 @@ +#ifndef _XT_IPVS_H +#define _XT_IPVS_H 1
You don't need to define a value.
net/netfilter/Kconfig config NETFILTER_XT_MATCH_IPRANGE · line 713
Quoted 8 lines
net/netfilter/Kconfig +8
-0+config NETFILTER_XT_MATCH_IPVS + tristate '"ipvs" match support' + depends on IP_VS + depends on NETFILTER_ADVANCED + help + This option allows you to match against IPVS properties of a packet. + + If unsure, say N.
You're using conntrack symbols, so this seems to need a dependency on NF_CONNTRACK.
net/netfilter/xt_ipvs.c line 152
Quoted 1 line
net/netfilter/xt_ipvs.c new file +1
-0+static bool ipvs_mt_check (const struct xt_mtchk_param *par)
We've changed the signature to "int" in nf-next to be able to return errno codes. Please rebase your patches onto nf-next-2.6.git.
Please also CC netfilter-devel at least for those parts that affect non-IPVS netfilter.
Quoted 12 lines
net/netfilter/xt_ipvs.c new file +12
-0+{ +if (par->family !=NFPROTO_IPV4 +#ifdef CONFIG_IP_VS_IPV6 + && par->family !=NFPROTO_IPV6 +#endif + ) { +pr_info ("protocol family %u not supported\n" , par->family); +return false; + } + +return true; +}
Re: [patch v2.2 1/4] [PATCH v2.1 1/4] netfilter: xt_ipvs (netfilter matcher for IPVS)
Thank you for picking this series of patches up again and thanks for the feedback.
I'll send an updated version in the next days.
Cheers, -Hannes
Quoted 42 lines · Patrick McHardy
include/linux/netfilter/xt_ipvs.h line 2
Quoted 3 lines · Simon Horman
include/linux/netfilter/xt_ipvs.h new file +2
-0@@ -0,0 +1,25 @@ +#ifndef _XT_IPVS_H +#define _XT_IPVS_H 1You don't need to define a value.
net/netfilter/Kconfig config NETFILTER_XT_MATCH_IPRANGE · line 713
Quoted 8 lines
net/netfilter/Kconfig +8
-0+config NETFILTER_XT_MATCH_IPVS + tristate '"ipvs" match support' + depends on IP_VS + depends on NETFILTER_ADVANCED + help + This option allows you to match against IPVS properties of a packet. + + If unsure, say N.You're using conntrack symbols, so this seems to need a dependency on
NF_CONNTRACK.net/netfilter/xt_ipvs.c line 152
Quoted 1 line
net/netfilter/xt_ipvs.c new file +1
-0+static bool ipvs_mt_check (const struct xt_mtchk_param *par)We've changed the signature to "int" in nf-next to be able to return errno codes. Please rebase your patches onto nf-next-2.6.git.
Please also CC netfilter-devel at least for those parts that affect non-IPVS netfilter.
Quoted 12 lines
net/netfilter/xt_ipvs.c new file +12
-0+{ + if (par->family != NFPROTO_IPV4 +#ifdef CONFIG_IP_VS_IPV6 + && par->family != NFPROTO_IPV6 +#endif + ) { + pr_info("protocol family %u not supported\n", par->family); + return false; + } + + return true; +}
Simon Horman
maintainerRe: [patch v2.2 1/4] [PATCH v2.1 1/4] netfilter: xt_ipvs (netfilter matcher for IPVS)
Quoted 4 lines · Hannes Eder
Thank you for picking this series of patches up again and thanks for the feedback.
I'll send an updated version in the next days.
Hi Hanes,
more than a few days seems to have passed.
Do you have time to fix the patches up?
If not, I'll take a stab at it.
Thanks
Re: [patch v2.2 1/4] [PATCH v2.1 1/4] netfilter: xt_ipvs (netfilter matcher for IPVS)
Hi Simon,
Quoted 11 lines · Simon Horman
Quoted 4 lines · Hannes Eder
Thank you for picking this series of patches up again and thanks for the feedback.
I'll send an updated version in the next days.
Hi Hanes,
more than a few days seems to have passed.
Do you have time to fix the patches up?
If not, I'll take a stab at it.
/me working through the backlog of emails after vacation, however this email was buried in my inbox before my vacation, my bad. I've been extremely busy lately and I did not have the time to work on the patches. I saw your updated versions, I appreciate very much that you are taking it from there.
Cheers,
-Hannes
Simon Horman
maintainerRe: [patch v2.2 1/4] [PATCH v2.1 1/4] netfilter: xt_ipvs (netfilter matcher for IPVS)
Quoted 15 lines · Hannes Eder
Hi Simon,
Quoted 11 lines · Simon Horman
Quoted 4 lines · Hannes Eder
Thank you for picking this series of patches up again and thanks for the feedback.
I'll send an updated version in the next days.
Hi Hanes,
more than a few days seems to have passed.
Do you have time to fix the patches up?
If not, I'll take a stab at it.
Quoted 5 lines
/me working through the backlog of emails after vacation, however this email was buried in my inbox before my vacation, my bad. I've been extremely busy lately and I did not have the time to work on the patches. I saw your updated versions, I appreciate very much that you are taking it from there.
No problem, I assumed that you were busy with something.
Simon Horman
maintainerPATCH 2/4 IPVS: make friends with nf_conntrack
In reply to Simon HormanFrom: Hannes Eder <[email protected]>
Update the nf_conntrack tuple in reply direction, as we will see traffic from the real server (RIP) to the client (CIP). Once this is done we can use netfilters SNAT in POSTROUTING, especially with xt_ipvs, to do source NAT, e.g.:
% iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 --vport 80 \
Quoted 1 line
-j SNAT --to-source 192.168.10.10
net/netfilter/ipvs/Kconfig | 2 +- net/netfilter/ipvs/ip_vs_core.c | 36 ------------------------------------ net/netfilter/ipvs/ip_vs_xmit.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 37 deletions(-)
net/netfilter/ipvs/Kconfig +1 -1
@@ -3,7 +3,7 @@ # menuconfig IP_VS tristate "IP virtual server support" - depends on NET && INET && NETFILTER + depends on NET && INET && NETFILTER && NF_CONNTRACK ---help--- IP Virtual Server support will let you build a high-performance virtual server based on cluster of two or more real servers. This
net/netfilter/ipvs/ip_vs_core.c +0 -36
@@ -521,26 +521,6 @@ int ip_vs_leave(struct ip_vs_service *svreturn NF_DROP ; } - -/* -* It is hooked before NF_IP_PRI_NAT_SRC at the NF_INET_POST_ROUTING -* chain, and is used for VS/NAT. -* It detects packets for VS/NAT connections and sends the packets -* immediately. This can avoid that iptable_nat mangles the packets -* for VS/NAT. -*/ -static unsigned int ip_vs_post_routing (unsigned int hooknum, -struct sk_buff *skb, -const struct net_device *in, -const struct net_device *out, -int (*okfn)(struct sk_buff *)) -{ -if (!skb->ipvs_property) -return NF_ACCEPT ; -/* The packet was sent from IPVS, exit this chain */ -return NF_STOP ; -} -__sum16 ip_vs_checksum_complete (struct sk_buff *skb,int offset) {return csum_fold (skb_checksum (skb, offset, skb->len - offset,0 ));
@@ -1443,14 +1423,6 @@ static struct nf_hook_ops ip_vs_ops[] __ .hooknum = NF_INET_FORWARD, .priority = 99, }, -/* Before the netfilter connection tracking, exit from POST_ROUTING */ - { - .hook = ip_vs_post_routing, - .owner = THIS_MODULE, - .pf = PF_INET, - .hooknum = NF_INET_POST_ROUTING, - .priority = NF_IP_PRI_NAT_SRC-1, - },#ifdef CONFIG_IP_VS_IPV6 /* After packet filtering, forward packet through VS/DR, VS/TUN, * or VS/NAT(change destination), so that filtering rules can be
@@ -1479,14 +1451,6 @@ static struct nf_hook_ops ip_vs_ops[] __ .hooknum = NF_INET_FORWARD, .priority = 99, }, -/* Before the netfilter connection tracking, exit from POST_ROUTING */ - { - .hook = ip_vs_post_routing, - .owner = THIS_MODULE, - .pf = PF_INET6, - .hooknum = NF_INET_POST_ROUTING, - .priority = NF_IP6_PRI_NAT_SRC-1, - },#endif };
net/netfilter/ipvs/ip_vs_xmit.c +30 -0
@@ -27,6 +27,7 @@#include <net/ip6_route.h> #include <linux/icmpv6.h> #include <linux/netfilter.h> +#include <net/netfilter/nf_conntrack.h> #include <linux/netfilter_ipv4.h> #include <net/ip_vs.h>
@@ -347,6 +348,31 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb }#endif +static void +ip_vs_update_conntrack (struct sk_buff *skb,struct ip_vs_conn *cp) +{ +struct nf_conn *ct = (struct nf_conn *)skb->nfct; +struct nf_conntrack_tuple new_tuple; + +if (ct ==NULL || ct == &nf_conntrack_untracked || +nf_ct_is_confirmed (ct)) +return ; + +/* +* The connection is not yet in the hashtable, so we update it. +* CIP->VIP will remain the same, so leave the tuple in +* IP_CT_DIR_ORIGINAL untouched. When the reply comes back from the +* real-server we will see RIP->DIP. +*/ + new_tuple = ct->tuplehash[IP_CT_DIR_REPLY ].tuple; + new_tuple.src.u3 = cp->daddr; +/* +* This will also take care of UDP and other protocols. +*/ + new_tuple.src.u.tcp.port = cp->dport; +nf_conntrack_alter_reply (ct, &new_tuple); +} +/* * NAT transmitter (only for outside-to-inside nat forwarding) * Not used for related ICMP
@@ -402,6 +428,8 @@ ip_vs_nat_xmit(struct sk_buff *skb, struIP_VS_DBG_PKT (10 , pp, skb,0 ,"After DNAT" ); +ip_vs_update_conntrack (skb, cp); +/* FIXME: when application helper enlarges the packet and the length is larger than the MTU of outgoing device, there will be still MTU problem. */
@@ -478,6 +506,8 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, sIP_VS_DBG_PKT (10 , pp, skb,0 ,"After DNAT" ); +ip_vs_update_conntrack (skb, cp); +/* FIXME: when application helper enlarges the packet and the length is larger than the MTU of outgoing device, there will be still MTU problem. */
Re: [patch v2.2 2/4] [PATCH v2.1 2/4] IPVS: make friends with nf_conntrack
Looks good to me.
Simon Horman
maintainerPATCH 3/4 IPVS: make FTP work with full NAT support
In reply to Simon HormanFrom: Hannes Eder <[email protected]>
Use nf_conntrack/nf_nat code to do the packet mangling and the TCP sequence adjusting. The function 'ip_vs_skb_replace' is now dead code, so it is removed.
To SNAT FTP, use something like:
% iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 \
Quoted 1 line
--vport 21 -j SNAT --to-source 192.168.10.10
and for the data connections in passive mode:
% iptables -t nat -A POSTROUTING -m ipvs --vaddr 192.168.100.30/32 \
Quoted 1 line
--vportctl 21 -j SNAT --to-source 192.168.10.10
using '-m state --state RELATED' would also works.
Make sure the kernel modules ip_vs_ftp, nf_conntrack_ftp, and nf_nat_ftp are loaded.
---
include/net/ip_vs.h | 2 net/netfilter/ipvs/Kconfig | 2 net/netfilter/ipvs/ip_vs_app.c | 43 --------- net/netfilter/ipvs/ip_vs_core.c | 1 net/netfilter/ipvs/ip_vs_ftp.c | 178 ++++++++++++++++++++++++++++++++++++--- 5 files changed, 164 insertions(+), 62 deletions(-)
include/net/ip_vs.h +0 -2
@@ -716,8 +716,6 @@ extern void ip_vs_app_inc_put(struct ip_extern int ip_vs_app_pkt_out (struct ip_vs_conn *,struct sk_buff *skb);extern int ip_vs_app_pkt_in (struct ip_vs_conn *,struct sk_buff *skb); -extern int ip_vs_skb_replace (struct sk_buff *skb,gfp_t pri, -char *o_buf,int o_len,char *n_buf,int n_len);extern int ip_vs_app_init (void );extern void ip_vs_app_cleanup (void );
net/netfilter/ipvs/Kconfig +1 -1
@@ -231,7 +231,7 @@ comment 'IPVS application helper' config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP + depends on IP_VS_PROTO_TCP && NF_NAT ---help--- FTP is a protocol that transfers IP address and/or port number in the payload. In the virtual server via Network Address Translation,
net/netfilter/ipvs/ip_vs_app.c +0 -43
49 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_core.c +0 -1
@@ -52,7 +52,6 @@EXPORT_SYMBOL (register_ip_vs_scheduler);EXPORT_SYMBOL (unregister_ip_vs_scheduler); -EXPORT_SYMBOL (ip_vs_skb_replace);EXPORT_SYMBOL (ip_vs_proto_name);EXPORT_SYMBOL (ip_vs_conn_new);EXPORT_SYMBOL (ip_vs_conn_in_get);
net/netfilter/ipvs/ip_vs_ftp.c +163 -15
231 lines not on this page · raw message
Re: [patch v2.2 3/4] [PATCH v2.1 3/4] IPVS: make FTP work with full NAT support
net/netfilter/ipvs/ip_vs_ftp.c line 68
Quoted 11 lines · Simon Horman
net/netfilter/ipvs/ip_vs_ftp.c +10
-0+#define FMT_TUPLE "%u.%u.%u.%u:%u->%u.%u.%u.%u:%u/%u" +#define ARG_TUPLE (T ) NIPQUAD((T)->src.u3.ip), ntohs((T)->src.u.all), \ + NIPQUAD((T)->dst.u3.ip), ntohs((T)->dst.u.all), \ + (T)->dst.protonum + +#define FMT_CONN "%u.%u.%u.%u:%u->%u.%u.%u.%u:%u->%u.%u.%u.%u:%u/%u:%u" +#define ARG_CONN (C ) NIPQUAD((C)->caddr), ntohs((C)->cport), \ + NIPQUAD((C)->vaddr), ntohs((C)->vport), \ + NIPQUAD((C)->daddr), ntohs((C)->dport), \ + (C)->protocol, (C)->state
Please use the appropriate format string (%pI4) instead of NIPQUAD.
net/netfilter/ipvs/ip_vs_ftp.c static int ip_vs_ftp_out(struct ip_vs_ap · line 362
Quoted 13 lines
net/netfilter/ipvs/ip_vs_ftp.c +13
-0+ buf_len =sprintf (buf,"%u,%u,%u,%u,%u,%u" ,NIPQUAD (from.ip), + (ntohs (port)>>8 )&255 ,ntohs (port)&255 ); + + ct =nf_ct_get (skb, &ctinfo); + ret =nf_nat_mangle_tcp_packet (skb, + ct, + ctinfo, + start-data, + end-start, + buf, + buf_len); + +if (ct && ct != &nf_conntrack_untracked)
ct is non-NULL, otherwise we'll crash in nf_nat_mangle_tcp_packet(). Are you sure you want to mangle untracked packets above? That doesn't work when their are size changes.
Simon Horman
maintainerPATCH 4/4 libxt_ipvs: user-space lib for netfilter matcher xt_ipvs
In reply to Simon HormanFrom: Hannes Eder <[email protected]>
The user-space library for the netfilter matcher xt_ipvs.
configure.ac | 10 - extensions/libxt_ipvs.c | 365 +++++++++++++++++++++++++++++++++++++ extensions/libxt_ipvs.man | 24 ++ include/linux/netfilter/xt_ipvs.h | 25 +++ 4 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 extensions/libxt_ipvs.c create mode 100644 extensions/libxt_ipvs.man create mode 100644 include/linux/netfilter/xt_ipvs.h
configure.ac +8 -2
@@ -47,12 +46,18 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) -AC_CHECK_HEADER([linux/dccp.h]) - blacklist_modules=""; + +AC_CHECK_HEADER([linux/dccp.h]) if test "$ac_cv_header_linux_dccp_h" != "yes"; then blacklist_modules="$blacklist_modules dccp"; fi; + +AC_CHECK_HEADER([linux/ip_vs.h]) +if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then + blacklist_modules="$blacklist_modules ipvs"; +fi; + AC_SUBST([blacklist_modules]) AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
extensions/libxt_ipvs.c new file +365 -0
365 lines not on this page · raw message
extensions/libxt_ipvs.man new file +24 -0
@@ -0,0 +1,24 @@ +Match IPVS connection properties. +.TP +[\fB!\fR] \fB\-\-ipvs\fP +packet belongs to an IPVS connection +.TP +Any of the following options implies \-\-ipvs (even negated) +.TP +[\fB!\fR] \fB\-\-vproto\fP \fIprotocol\fP +VIP protocol to match; by number or name, e.g. "tcp" +.TP +[\fB!\fR] \fB\-\-vaddr\fP \fIaddress\fP[\fB/\fP\fImask\fP] +VIP address to match +.TP +[\fB!\fR] \fB\-\-vport\fP \fIport\fP +VIP port to match; by number or name, e.g. "http" +.TP +\fB\-\-vdir\fP {\fBORIGINAL\fP|\fBREPLY\fP} +flow direction of packet +.TP +[\fB!\fR] \fB\-\-vmethod\fP {\fBGATE\fP|\fBIPIP\fP|\fBMASQ\fP} +IPVS forwarding method used +.TP +[\fB!\fR] \fB\-\-vportctl\fP \fIport\fP +VIP port of the controlling connection to match, e.g. 21 for FTP
include/linux/netfilter/xt_ipvs.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef _XT_IPVS_H +#define _XT_IPVS_H 1 + +#define XT_IPVS_IPVS_PROPERTY (1 << 0)/* all other options imply this one */ +#define XT_IPVS_PROTO (1 << 1) +#define XT_IPVS_VADDR (1 << 2) +#define XT_IPVS_VPORT (1 << 3) +#define XT_IPVS_DIR (1 << 4) +#define XT_IPVS_METHOD (1 << 5) +#define XT_IPVS_VPORTCTL (1 << 6) +#define XT_IPVS_MASK ((1 << 7) - 1) +#define XT_IPVS_ONCE_MASK (XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY) + +struct xt_ipvs_mtinfo { +union nf_inet_addr vaddr, vmask; +__be16 vport; +__u16 l4proto; +__u16 fwd_method; +__be16 vportctl; + +__u8 invert; +__u8 bitmask; +}; + +#endif /* _XT_IPVS_H */