IPVS
Subsystems (5)
Simon Horman
maintainerHi Pablo,
please consider the following enhancements to IPVS for inclusion in 3.6.
----------------------------------------------------------------
The following changes since commit 46ba5a25f521e3c50d7bb81b1abb977769047456:
netfilter: nfnetlink_queue: do not allow to set unsupported flag bits (2012-07-04 19:51:50 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-next.git master
for you to fetch changes up to 1fd130ebf10e1185022a9c0470f2298943bad1c4:
ipvs: generalize app registration in netns (2012-07-10 17:58:10 +0900)
----------------------------------------------------------------
Julian Anastasov (2):
ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
ipvs: generalize app registration in netns
include/net/ip_vs.h | 5 ++-- net/netfilter/ipvs/Kconfig | 3 ++- net/netfilter/ipvs/ip_vs_app.c | 61 +++++++++++++++++++++++++++++++----------- net/netfilter/ipvs/ip_vs_ftp.c | 21 ++++----------- 4 files changed, 54 insertions(+), 36 deletions(-)
Simon Horman
maintainerPATCH 1/2 ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on thenf_conntrack_ftp helper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic in ipv4_confirm is not called without helper.
--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/ipvs/Kconfig +2 -1
@@ -250,7 +250,8 @@ comment 'IPVS application helper' config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTP select IP_VS_NFCT ---help--- FTP is a protocol that transfers IP address and/or port number in
Signature · 1 line
1.7.10.2.484.gcd07cc5
Pablo Neira Ayuso
maintainerRe: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
Quoted 19 lines · Simon Horman
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on the
nf_conntrack_ftphelper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic inipv4_confirmis not called without helper.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/ipvs/Kconfig +0
-0
net/netfilter/ipvs/Kconfig comment 'IPVS application helper' · line 254
Quoted 6 lines
net/netfilter/ipvs/Kconfig +2
-1@@ -250,7 +250,8 @@ comment 'IPVS application helper' config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTP
If you require FTP NAT support, then this depends on NF_NAT_FTP instead of NF_CONNTRACK_FTP.
Julian Anastasov
maintainerRe: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
Hello,
Quoted 21 lines · Pablo Neira Ayuso
Quoted 20 lines · Simon Horman
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on the
nf_conntrack_ftphelper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic inipv4_confirmis not called without helper.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/ipvs/Kconfig +0
-0@@ -250,7 +250,8 @@ comment 'IPVS application helper'
Quoted 8 lines
net/netfilter/ipvs/Kconfig comment 'IPVS application helper' · line 254
Quoted 5 lines
net/netfilter/ipvs/Kconfig +2
-1config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTPIf you require FTP NAT support, then this depends on
NF_NAT_FTPinstead ofNF_CONNTRACK_FTP.
No, I just checked again, it works without nf_nat_ftp,
only nf_nat, nf_conntrack_ftp and iptable_nat are needed. We use packet mangling part from nf_nat (nf_nat_mangle_tcp_packet).
Regards
--
Julian Anastasov <[email protected]>
Simon Horman
maintainerRe: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
Quoted 35 lines · Julian Anastasov
Hello,
Quoted 21 lines · Pablo Neira Ayuso
Quoted 20 lines · Simon Horman
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on the
nf_conntrack_ftphelper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic inipv4_confirmis not called without helper.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/ipvs/Kconfig +0
-0@@ -250,7 +250,8 @@ comment 'IPVS application helper'Quoted 8 lines
net/netfilter/ipvs/Kconfig comment 'IPVS application helper' · line 254
Quoted 5 lines
net/netfilter/ipvs/Kconfig +2
-1config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTPIf you require FTP NAT support, then this depends on
NF_NAT_FTPinstead ofNF_CONNTRACK_FTP.
Quoted 3 lines
No, I just checked again, it works without
nf_nat_ftp,
onlynf_nat,nf_conntrack_ftpandiptable_natare needed. We use packet mangling part fromnf_nat(nf_nat_mangle_tcp_packet).
Is there a consensus on this?
Pablo Neira Ayuso
maintainerRe: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
Quoted 36 lines · Simon Horman
Quoted 35 lines · Julian Anastasov
Hello,
Quoted 29 lines · Pablo Neira Ayuso
Quoted 19 lines · Simon Horman
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on the
nf_conntrack_ftphelper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic inipv4_confirmis not called without helper.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/ipvs/Kconfig +0
-0net/netfilter/ipvs/Kconfig comment 'IPVS application helper' · line 254
Quoted 6 lines
net/netfilter/ipvs/Kconfig +2
-1@@ -250,7 +250,8 @@ comment 'IPVS application helper' config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTPIf you require FTP NAT support, then this depends on
NF_NAT_FTPinstead ofNF_CONNTRACK_FTP.
Quoted 5 lines
Quoted 3 lines
No, I just checked again, it works without
nf_nat_ftp,
onlynf_nat,nf_conntrack_ftpandiptable_natare needed. We use packet mangling part fromnf_nat(nf_nat_mangle_tcp_packet).Is there a consensus on this?
Fine with me, just wanted to make sure this what you wanted. Thanks Simon.
Simon Horman
maintainerRe: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
Quoted 37 lines · Pablo Neira Ayuso
Quoted 36 lines · Simon Horman
Quoted 35 lines · Julian Anastasov
Hello,
Quoted 29 lines · Pablo Neira Ayuso
Quoted 19 lines · Simon Horman
From: Julian Anastasov <[email protected]>
The FTP application indirectly depends on the
nf_conntrack_ftphelper for proper NAT support. If the module is not loaded, IPVS can resize the packets for the command connection, eg. PASV response but the SEQ adjustment logic inipv4_confirmis not called without helper.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- net/netfilter/ipvs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/netfilter/ipvs/Kconfig +0
-0net/netfilter/ipvs/Kconfig comment 'IPVS application helper' · line 254
Quoted 6 lines
net/netfilter/ipvs/Kconfig +2
-1@@ -250,7 +250,8 @@ comment 'IPVS application helper' config IP_VS_FTP tristate "FTP protocol helper" - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ + NF_CONNTRACK_FTPIf you require FTP NAT support, then this depends on
NF_NAT_FTPinstead ofNF_CONNTRACK_FTP.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
No, I just checked again, it works without
nf_nat_ftp,
onlynf_nat,nf_conntrack_ftpandiptable_natare needed. We use packet mangling part fromnf_nat(nf_nat_mangle_tcp_packet).Is there a consensus on this?
Fine with me, just wanted to make sure this what you wanted. Thanks Simon.
Thanks. I'll include this in a pull request after rebasing ipvs-next. I plan to do that today.
Simon Horman
maintainerPATCH 2/2 ipvs: generalize app registration in netns
In reply to Simon HormanFrom: Julian Anastasov <[email protected]>
Get rid of the ftp_app pointer and allow applications
to be registered without adding fields in the netns_ipvs structure.
--- include/net/ip_vs.h | 5 ++-- net/netfilter/ipvs/ip_vs_app.c | 61 +++++++++++++++++++++++++++++++----------- net/netfilter/ipvs/ip_vs_ftp.c | 21 ++++----------- 3 files changed, 52 insertions(+), 35 deletions(-)
include/net/ip_vs.h +2 -3
@@ -808,8 +808,6 @@ struct netns_ipvs {struct list_head rs_table[IP_VS_RTAB_SIZE ];/* ip_vs_app */ struct list_head app_list; -/* ip_vs_ftp */ -struct ip_vs_app *ftp_app;/* ip_vs_proto */ #define IP_VS_PROTO_TAB_SIZE 32/* must be power of 2 */ struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE ];
@@ -1179,7 +1177,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);* (from ip_vs_app.c) */ #define IP_VS_APP_MAX_PORTS 8 -extern int register_ip_vs_app (struct net *net,struct ip_vs_app *app); +extern struct ip_vs_app *register_ip_vs_app (struct net *net, +struct ip_vs_app *app);extern void unregister_ip_vs_app (struct net *net,struct ip_vs_app *app);extern int ip_vs_bind_app (struct ip_vs_conn *cp,struct ip_vs_protocol *pp);extern void ip_vs_unbind_app (struct ip_vs_conn *cp);
net/netfilter/ipvs/ip_vs_app.c +45 -16
92 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_ftp.c +4 -13
@@ -441,16 +441,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)if (!ipvs)return -ENOENT ; - app =kmemdup (&ip_vs_ftp,sizeof (struct ip_vs_app ),GFP_KERNEL ); -if (!app) -return -ENOMEM ; -INIT_LIST_HEAD (&app->a_list); -INIT_LIST_HEAD (&app->incs_list); - ipvs->ftp_app = app; - ret =register_ip_vs_app (net, app); -if (ret) - goto err_exit; + app =register_ip_vs_app (net, &ip_vs_ftp); +if (IS_ERR (app)) +return PTR_ERR (app);for (i =0 ; i < ports_count; i++) {if (!ports[i])
@@ -464,9 +458,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)return 0 ; err_unreg: -unregister_ip_vs_app (net, app); -err_exit: -kfree (ipvs->ftp_app); +unregister_ip_vs_app (net, &ip_vs_ftp);return ret; }/*
@@ -474,10 +466,7 @@ err_exit:*/ static void __ip_vs_ftp_exit (struct net *net) { -struct netns_ipvs *ipvs =net_ipvs (net);
Pablo Neira Ayuso
maintainerRe: [PATCH 2/2] ipvs: generalize app registration in netns
Quoted 70 lines · Simon Horman
From: Julian Anastasov <[email protected]>
Get rid of the
ftp_apppointer and allow applications
to be registered without adding fields in thenetns_ipvsstructure.Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>--- include/net/ip_vs.h | 5 ++-- net/netfilter/ipvs/ip_vs_app.c | 61 +++++++++++++++++++++++++++++++----------- net/netfilter/ipvs/ip_vs_ftp.c | 21 ++++----------- 3 files changed, 52 insertions(+), 35 deletions(-)include/net/ip_vs.h +2
-3@@ -808,8 +808,6 @@ struct netns_ipvs {struct list_head rs_table[IP_VS_RTAB_SIZE ];/* ip_vs_app */ struct list_head app_list; -/* ip_vs_ftp */ -struct ip_vs_app *ftp_app;/* ip_vs_proto */ #define IP_VS_PROTO_TAB_SIZE 32/* must be power of 2 */ struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE ];@@ -1179,7 +1177,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);* (from ip_vs_app.c) */ #define IP_VS_APP_MAX_PORTS 8 -extern int register_ip_vs_app (struct net *net,struct ip_vs_app *app); +extern struct ip_vs_app *register_ip_vs_app (struct net *net, +struct ip_vs_app *app);extern void unregister_ip_vs_app (struct net *net,struct ip_vs_app *app);extern int ip_vs_bind_app (struct ip_vs_conn *cp,struct ip_vs_protocol *pp);extern void ip_vs_unbind_app (struct ip_vs_conn *cp);net/netfilter/ipvs/ip_vs_app.c +14
-7@@ -180,22 +180,41 @@ register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, } -/* -* ip_vs_app registration routine -*/ -int register_ip_vs_app (struct net *net,struct ip_vs_app *app) +/* Register application for netns */ +struct ip_vs_app *register_ip_vs_app (struct net *net,struct ip_vs_app *app) {struct netns_ipvs *ipvs =net_ipvs (net); -/* increase the module use count */ -ip_vs_use_count_inc (); +struct ip_vs_app *a; +int err =0 ; + +if (!ipvs) +return ERR_PTR (-ENOENT );mutex_lock (&__ip_vs_app_mutex); -list_add (&app->a_list, &ipvs->app_list); +list_for_each_entry (a, &ipvs->app_list, a_list) { +if (!strcmp (app->name, a->name)) { + err = -EEXIST ; +break ; + } + } +if (!err) {
net/netfilter/ipvs/ip_vs_app.c register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, · line 211
Quoted 10 lines
net/netfilter/ipvs/ip_vs_app.c +10
-0+ a =kmemdup (app,sizeof (*app),GFP_KERNEL ); +if (!a) + err = -ENOMEM ; + } +if (!err) { +INIT_LIST_HEAD (&a->incs_list); +list_add (&a->a_list, &ipvs->app_list); +/* increase the module use count */ +ip_vs_use_count_inc (); + }
I think this code will look better if you use something like:
+ if (!strcmp(app->name, a->name)) {
+ err = -EEXIST;
+ goto err_unlock;
+ }
err_unlock:
mutex_unlock(...)
net/netfilter/ipvs/ip_vs_app.c register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, · line 217
Quoted 7 lines
net/netfilter/ipvs/ip_vs_app.c +3
-1mutex_unlock (&__ip_vs_app_mutex); -return 0 ; +if (err) +return ERR_PTR (err); +return a;
For this three lines above, you can use:
return err ? return ERR_PTR(err) : a;
Quoted 102 lines
net/netfilter/ipvs/ip_vs_app.c +18
-8}@@ -205,20 +224,29 @@ int register_ip_vs_app(struct net *net, struct ip_vs_app *app)*/ void unregister_ip_vs_app (struct net *net,struct ip_vs_app *app) { -struct ip_vs_app *inc, *nxt; +struct netns_ipvs *ipvs =net_ipvs (net); +struct ip_vs_app *a, *anxt, *inc, *nxt; + +if (!ipvs) +return ;mutex_lock (&__ip_vs_app_mutex); -list_for_each_entry_safe (inc, nxt, &app->incs_list, a_list) { -ip_vs_app_inc_release (net, inc); - } +list_for_each_entry_safe (a, anxt, &ipvs->app_list, a_list) { +if (app &&strcmp (app->name, a->name)) +continue ; +list_for_each_entry_safe (inc, nxt, &a->incs_list, a_list) { +ip_vs_app_inc_release (net, inc); + } -list_del (&app->a_list); +list_del (&a->a_list); +kfree (a); -mutex_unlock (&__ip_vs_app_mutex); +/* decrease the module use count */ +ip_vs_use_count_dec (); + } -/* decrease the module use count */ -ip_vs_use_count_dec (); +mutex_unlock (&__ip_vs_app_mutex); }@@ -586,5 +614,6 @@ int __net_init ip_vs_app_net_init(struct net *net) void __net_exit ip_vs_app_net_cleanup(struct net *net) { +unregister_ip_vs_app (net,NULL /* all */ );proc_net_remove (net,"ip_vs_app" ); }net/netfilter/ipvs/ip_vs_ftp.c +5
-16@@ -441,16 +441,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)if (!ipvs)return -ENOENT ; - app =kmemdup (&ip_vs_ftp,sizeof (struct ip_vs_app ),GFP_KERNEL ); -if (!app) -return -ENOMEM ; -INIT_LIST_HEAD (&app->a_list); -INIT_LIST_HEAD (&app->incs_list); - ipvs->ftp_app = app; - ret =register_ip_vs_app (net, app); -if (ret) - goto err_exit; + app =register_ip_vs_app (net, &ip_vs_ftp); +if (IS_ERR (app)) +return PTR_ERR (app);for (i =0 ; i < ports_count; i++) {if (!ports[i])@@ -464,9 +458,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)return 0 ; err_unreg: -unregister_ip_vs_app (net, app); -err_exit: -kfree (ipvs->ftp_app); +unregister_ip_vs_app (net, &ip_vs_ftp);return ret; }/* @@ -474,10 +466,7 @@ err_exit:*/ static void __ip_vs_ftp_exit (struct net *net) { -struct netns_ipvs *ipvs =net_ipvs (net); - -unregister_ip_vs_app (net, ipvs->ftp_app); -kfree (ipvs->ftp_app); +unregister_ip_vs_app (net, &ip_vs_ftp); }static struct pernet_operations ip_vs_ftp_ops = {Signature · 6 lines
1.7.10.2.484.gcd07cc5 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Julian Anastasov
maintainerRe: [PATCH 2/2] ipvs: generalize app registration in netns
Hello,
Quoted 45 lines · Pablo Neira Ayuso
Quoted 21 lines
net/netfilter/ipvs/ip_vs_app.c +13
-3+struct ip_vs_app *register_ip_vs_app (struct net *net,struct ip_vs_app *app) {struct netns_ipvs *ipvs =net_ipvs (net); -/* increase the module use count */ -ip_vs_use_count_inc (); +struct ip_vs_app *a; +int err =0 ; + +if (!ipvs) +return ERR_PTR (-ENOENT );mutex_lock (&__ip_vs_app_mutex); -list_add (&app->a_list, &ipvs->app_list); +list_for_each_entry (a, &ipvs->app_list, a_list) { +if (!strcmp (app->name, a->name)) { + err = -EEXIST ; +break ; + } + } +if (!err) {net/netfilter/ipvs/ip_vs_app.c register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, · line 211
Quoted 10 lines
net/netfilter/ipvs/ip_vs_app.c +10
-0+ a =kmemdup (app,sizeof (*app),GFP_KERNEL ); +if (!a) + err = -ENOMEM ; + } +if (!err) { +INIT_LIST_HEAD (&a->incs_list); +list_add (&a->a_list, &ipvs->app_list); +/* increase the module use count */ +ip_vs_use_count_inc (); + }I think this code will look better if you use something like:
net/netfilter/ipvs/ip_vs_app.c +4
-0+if (!strcmp (app->name, a->name)) { + err = -EEXIST ; + goto err_unlock; + }
err_unlock:mutex_unlock(...)Quoted 3 lines
mutex_unlock(&__ip_vs_app_mutex);
Quoted 8 lines
net/netfilter/ipvs/ip_vs_app.c register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto, · line 217
Quoted 4 lines
net/netfilter/ipvs/ip_vs_app.c +3
-1-return 0 ; +if (err) +return ERR_PTR (err); +return a;For this three lines above, you can use:
return err ? return
ERR_PTR(err): a;
Good point, sending v2 ...
Regards
--
Julian Anastasov <[email protected]>
Julian Anastasov
maintainerPATCH v2 1/1 ipvs: generalize app registration in netns
In reply to Pablo Neira Ayuso Get rid of the ftp_app pointer and allow applications
to be registered without adding fields in the netns_ipvs structure.
v2: fix coding style as suggested by Pablo Neira Ayuso <[email protected]>
--- include/net/ip_vs.h | 5 +-- net/netfilter/ipvs/ip_vs_app.c | 58 +++++++++++++++++++++++++++++----------- net/netfilter/ipvs/ip_vs_ftp.c | 21 +++----------- 3 files changed, 49 insertions(+), 35 deletions(-)
include/net/ip_vs.h +2 -3
@@ -808,8 +808,6 @@ struct netns_ipvs {struct list_head rs_table[IP_VS_RTAB_SIZE ];/* ip_vs_app */ struct list_head app_list; -/* ip_vs_ftp */ -struct ip_vs_app *ftp_app;/* ip_vs_proto */ #define IP_VS_PROTO_TAB_SIZE 32/* must be power of 2 */ struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE ];
@@ -1179,7 +1177,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);* (from ip_vs_app.c) */ #define IP_VS_APP_MAX_PORTS 8 -extern int register_ip_vs_app (struct net *net,struct ip_vs_app *app); +extern struct ip_vs_app *register_ip_vs_app (struct net *net, +struct ip_vs_app *app);extern void unregister_ip_vs_app (struct net *net,struct ip_vs_app *app);extern int ip_vs_bind_app (struct ip_vs_conn *cp,struct ip_vs_protocol *pp);extern void ip_vs_unbind_app (struct ip_vs_conn *cp);
net/netfilter/ipvs/ip_vs_app.c +42 -16
89 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_ftp.c +4 -13
@@ -441,16 +441,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)if (!ipvs)return -ENOENT ; - app =kmemdup (&ip_vs_ftp,sizeof (struct ip_vs_app ),GFP_KERNEL ); -if (!app) -return -ENOMEM ; -INIT_LIST_HEAD (&app->a_list); -INIT_LIST_HEAD (&app->incs_list); - ipvs->ftp_app = app; - ret =register_ip_vs_app (net, app); -if (ret) - goto err_exit; + app =register_ip_vs_app (net, &ip_vs_ftp); +if (IS_ERR (app)) +return PTR_ERR (app);for (i =0 ; i < ports_count; i++) {if (!ports[i])
@@ -464,9 +458,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)return 0 ; err_unreg: -unregister_ip_vs_app (net, app); -err_exit: -kfree (ipvs->ftp_app); +unregister_ip_vs_app (net, &ip_vs_ftp);return ret; }/*
@@ -474,10 +466,7 @@ err_exit:*/ static void __ip_vs_ftp_exit (struct net *net) { -struct netns_ipvs *ipvs =net_ipvs (net);
Simon Horman
maintainerRe: [PATCH v2] ipvs: generalize app registration in netns
Quoted 5 lines · Julian Anastasov
Get rid of the
ftp_apppointer and allow applications
to be registered without adding fields in thenetns_ipvsstructure.v2: fix coding style as suggested by Pablo Neira Ayuso <[email protected]>
Thanks, I have (forcibly) pushed this into the ipvs-next tree in place of v1.
I will want for consensus on the "ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper" change before sending a fresh pull request to Pablo.