Loading include/net/ip_vs.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -393,7 +393,7 @@ struct ip_vs_protocol { void (*exit)(struct ip_vs_protocol *pp); void (*exit)(struct ip_vs_protocol *pp); void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); Loading Loading @@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, extern int ip_vs_use_count_inc(void); extern int ip_vs_use_count_inc(void); extern void ip_vs_use_count_dec(void); extern void ip_vs_use_count_dec(void); extern int ip_vs_register_nl_ioctl(void); extern void ip_vs_unregister_nl_ioctl(void); extern int ip_vs_control_init(void); extern int ip_vs_control_init(void); extern void ip_vs_control_cleanup(void); extern void ip_vs_control_cleanup(void); extern struct ip_vs_dest * extern struct ip_vs_dest * Loading net/netfilter/ipvs/ip_vs_core.c +11 −0 Original line number Original line Diff line number Diff line Loading @@ -1924,6 +1924,7 @@ static int __net_init __ip_vs_init(struct net *net) control_fail: control_fail: ip_vs_estimator_net_cleanup(net); ip_vs_estimator_net_cleanup(net); estimator_fail: estimator_fail: net->ipvs = NULL; return -ENOMEM; return -ENOMEM; } } Loading @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) ip_vs_control_net_cleanup(net); ip_vs_control_net_cleanup(net); ip_vs_estimator_net_cleanup(net); ip_vs_estimator_net_cleanup(net); IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); net->ipvs = NULL; } } static void __net_exit __ip_vs_dev_cleanup(struct net *net) static void __net_exit __ip_vs_dev_cleanup(struct net *net) Loading Loading @@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) goto cleanup_dev; goto cleanup_dev; } } ret = ip_vs_register_nl_ioctl(); if (ret < 0) { pr_err("can't register netlink/ioctl.\n"); goto cleanup_hooks; } pr_info("ipvs loaded.\n"); pr_info("ipvs loaded.\n"); return ret; return ret; cleanup_hooks: nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); cleanup_dev: cleanup_dev: unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_device(&ipvs_core_dev_ops); cleanup_sub: cleanup_sub: Loading @@ -2012,6 +2022,7 @@ static int __init ip_vs_init(void) static void __exit ip_vs_cleanup(void) static void __exit ip_vs_cleanup(void) { { ip_vs_unregister_nl_ioctl(); nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ Loading net/netfilter/ipvs/ip_vs_ctl.c +32 −24 Original line number Original line Diff line number Diff line Loading @@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) return 0; return 0; } } void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { { struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); Loading @@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) #else #else int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } #endif #endif Loading Loading @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) free_percpu(ipvs->tot_stats.cpustats); free_percpu(ipvs->tot_stats.cpustats); } } int __init ip_vs_control_init(void) int __init ip_vs_register_nl_ioctl(void) { { int idx; int ret; int ret; EnterFunction(2); /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { INIT_LIST_HEAD(&ip_vs_svc_table[idx]); INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); } smp_wmb(); /* Do we really need it now ? */ ret = nf_register_sockopt(&ip_vs_sockopts); ret = nf_register_sockopt(&ip_vs_sockopts); if (ret) { if (ret) { pr_err("cannot register sockopt.\n"); pr_err("cannot register sockopt.\n"); Loading @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) pr_err("cannot register Generic Netlink interface.\n"); pr_err("cannot register Generic Netlink interface.\n"); goto err_genl; goto err_genl; } } ret = register_netdevice_notifier(&ip_vs_dst_notifier); if (ret < 0) goto err_notf; LeaveFunction(2); return 0; return 0; err_notf: ip_vs_genl_unregister(); err_genl: err_genl: nf_unregister_sockopt(&ip_vs_sockopts); nf_unregister_sockopt(&ip_vs_sockopts); err_sock: err_sock: return ret; return ret; } } void ip_vs_unregister_nl_ioctl(void) { ip_vs_genl_unregister(); nf_unregister_sockopt(&ip_vs_sockopts); } int __init ip_vs_control_init(void) { int idx; int ret; EnterFunction(2); /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { INIT_LIST_HEAD(&ip_vs_svc_table[idx]); INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); } smp_wmb(); /* Do we really need it now ? */ ret = register_netdevice_notifier(&ip_vs_dst_notifier); if (ret < 0) return ret; LeaveFunction(2); return 0; } void ip_vs_control_cleanup(void) void ip_vs_control_cleanup(void) { { EnterFunction(2); EnterFunction(2); unregister_netdevice_notifier(&ip_vs_dst_notifier); unregister_netdevice_notifier(&ip_vs_dst_notifier); ip_vs_genl_unregister(); nf_unregister_sockopt(&ip_vs_sockopts); LeaveFunction(2); LeaveFunction(2); } } net/netfilter/ipvs/ip_vs_ftp.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) struct ip_vs_app *app; struct ip_vs_app *app; struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); if (!ipvs) return -ENOENT; app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); if (!app) if (!app) return -ENOMEM; return -ENOMEM; Loading net/netfilter/ipvs/ip_vs_lblc.c +3 −0 Original line number Original line Diff line number Diff line Loading @@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) { { struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); if (!ipvs) return -ENOENT; if (!net_eq(net, &init_net)) { if (!net_eq(net, &init_net)) { ipvs->lblc_ctl_table = kmemdup(vs_vars_table, ipvs->lblc_ctl_table = kmemdup(vs_vars_table, sizeof(vs_vars_table), sizeof(vs_vars_table), Loading Loading
include/net/ip_vs.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -393,7 +393,7 @@ struct ip_vs_protocol { void (*exit)(struct ip_vs_protocol *pp); void (*exit)(struct ip_vs_protocol *pp); void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); Loading Loading @@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, extern int ip_vs_use_count_inc(void); extern int ip_vs_use_count_inc(void); extern void ip_vs_use_count_dec(void); extern void ip_vs_use_count_dec(void); extern int ip_vs_register_nl_ioctl(void); extern void ip_vs_unregister_nl_ioctl(void); extern int ip_vs_control_init(void); extern int ip_vs_control_init(void); extern void ip_vs_control_cleanup(void); extern void ip_vs_control_cleanup(void); extern struct ip_vs_dest * extern struct ip_vs_dest * Loading
net/netfilter/ipvs/ip_vs_core.c +11 −0 Original line number Original line Diff line number Diff line Loading @@ -1924,6 +1924,7 @@ static int __net_init __ip_vs_init(struct net *net) control_fail: control_fail: ip_vs_estimator_net_cleanup(net); ip_vs_estimator_net_cleanup(net); estimator_fail: estimator_fail: net->ipvs = NULL; return -ENOMEM; return -ENOMEM; } } Loading @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) ip_vs_control_net_cleanup(net); ip_vs_control_net_cleanup(net); ip_vs_estimator_net_cleanup(net); ip_vs_estimator_net_cleanup(net); IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); net->ipvs = NULL; } } static void __net_exit __ip_vs_dev_cleanup(struct net *net) static void __net_exit __ip_vs_dev_cleanup(struct net *net) Loading Loading @@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) goto cleanup_dev; goto cleanup_dev; } } ret = ip_vs_register_nl_ioctl(); if (ret < 0) { pr_err("can't register netlink/ioctl.\n"); goto cleanup_hooks; } pr_info("ipvs loaded.\n"); pr_info("ipvs loaded.\n"); return ret; return ret; cleanup_hooks: nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); cleanup_dev: cleanup_dev: unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_device(&ipvs_core_dev_ops); cleanup_sub: cleanup_sub: Loading @@ -2012,6 +2022,7 @@ static int __init ip_vs_init(void) static void __exit ip_vs_cleanup(void) static void __exit ip_vs_cleanup(void) { { ip_vs_unregister_nl_ioctl(); nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_device(&ipvs_core_dev_ops); unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ Loading
net/netfilter/ipvs/ip_vs_ctl.c +32 −24 Original line number Original line Diff line number Diff line Loading @@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) return 0; return 0; } } void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { { struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); Loading @@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) #else #else int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } #endif #endif Loading Loading @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) free_percpu(ipvs->tot_stats.cpustats); free_percpu(ipvs->tot_stats.cpustats); } } int __init ip_vs_control_init(void) int __init ip_vs_register_nl_ioctl(void) { { int idx; int ret; int ret; EnterFunction(2); /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { INIT_LIST_HEAD(&ip_vs_svc_table[idx]); INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); } smp_wmb(); /* Do we really need it now ? */ ret = nf_register_sockopt(&ip_vs_sockopts); ret = nf_register_sockopt(&ip_vs_sockopts); if (ret) { if (ret) { pr_err("cannot register sockopt.\n"); pr_err("cannot register sockopt.\n"); Loading @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) pr_err("cannot register Generic Netlink interface.\n"); pr_err("cannot register Generic Netlink interface.\n"); goto err_genl; goto err_genl; } } ret = register_netdevice_notifier(&ip_vs_dst_notifier); if (ret < 0) goto err_notf; LeaveFunction(2); return 0; return 0; err_notf: ip_vs_genl_unregister(); err_genl: err_genl: nf_unregister_sockopt(&ip_vs_sockopts); nf_unregister_sockopt(&ip_vs_sockopts); err_sock: err_sock: return ret; return ret; } } void ip_vs_unregister_nl_ioctl(void) { ip_vs_genl_unregister(); nf_unregister_sockopt(&ip_vs_sockopts); } int __init ip_vs_control_init(void) { int idx; int ret; EnterFunction(2); /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { INIT_LIST_HEAD(&ip_vs_svc_table[idx]); INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); } smp_wmb(); /* Do we really need it now ? */ ret = register_netdevice_notifier(&ip_vs_dst_notifier); if (ret < 0) return ret; LeaveFunction(2); return 0; } void ip_vs_control_cleanup(void) void ip_vs_control_cleanup(void) { { EnterFunction(2); EnterFunction(2); unregister_netdevice_notifier(&ip_vs_dst_notifier); unregister_netdevice_notifier(&ip_vs_dst_notifier); ip_vs_genl_unregister(); nf_unregister_sockopt(&ip_vs_sockopts); LeaveFunction(2); LeaveFunction(2); } }
net/netfilter/ipvs/ip_vs_ftp.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) struct ip_vs_app *app; struct ip_vs_app *app; struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); if (!ipvs) return -ENOENT; app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); if (!app) if (!app) return -ENOMEM; return -ENOMEM; Loading
net/netfilter/ipvs/ip_vs_lblc.c +3 −0 Original line number Original line Diff line number Diff line Loading @@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) { { struct netns_ipvs *ipvs = net_ipvs(net); struct netns_ipvs *ipvs = net_ipvs(net); if (!ipvs) return -ENOENT; if (!net_eq(net, &init_net)) { if (!net_eq(net, &init_net)) { ipvs->lblc_ctl_table = kmemdup(vs_vars_table, ipvs->lblc_ctl_table = kmemdup(vs_vars_table, sizeof(vs_vars_table), sizeof(vs_vars_table), Loading