Make ipv4_devconf (all and default) live in net namespaces
Subsystems (3)
cover Make ipv4_devconf (all and default) live in net namespaces
The ipv4_devconf_(all) and ipv4_devconf_dflt are currently global, but should be per-namespace.
This set moves them on the struct net. Or, more precisely, on the struct netns_ipv4, which in turn is on the struct net.
There are two minor things that are to be done additionally to this set:
1. The snmp_seq_show() needs the IPV4_DEVCONF_ALL(FORWARDING) value, but since this entry is still global no valid struct net can be get in it, so I use the init_net's one. After snmp is made per-namespace, this will be fixed easily.
2. The rt_fill_info() needs the IPV4_DEVCONF_ALL(MC_FORWARDING), but the routing code is not tuned to work inside namespaces yet, so I use the init_net in it as well. Denis is currently working on ipv4 routing, so this will be prepared shortly.
Happily, all the other places of devconf-s usage can provide a struct net pointer.
PATCH 1/7 Add the netns_ipv4 struct
The ipv4 will store its parameters inside this structure. This one is empty now, but it will be eventually filled.
---
include/net/net_namespace.h +2 -0
@@ -10,6 +10,7 @@#include <net/netns/unix.h> #include <net/netns/packet.h> +#include <net/netns/ipv4.h> struct proc_dir_entry ;struct net_device ;
@@ -46,6 +47,7 @@ struct net {struct netns_packet packet;struct netns_unix unx; +struct netns_ipv4 ipv4; };#ifdef CONFIG_NET
include/net/netns/ipv4.h new file +9 -0
@@ -0,0 +1,9 @@ +/* +* ipv4 in net namespaces +*/ + +#ifndef __NETNS_IPV4_H__ +#define __NETNS_IPV4_H__ +struct netns_ipv4 { +}; +#endif
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 1/7] Add the netns_ipv4 struct
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:45:58 +0300
Quoted 4 lines
The ipv4 will store its parameters inside this structure. This one is empty now, but it will be eventually filled.
Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 2/7 Make __devinet_sysctl_register return an error
In reply to Pavel EmelyanovCurrently, this function is void, so failures in creating sysctls for new/renamed devices are not reported to anywhere.
Fixing this is another complex (needed?) task, but this return value is needed during the namespaces creation to handle the case, when we failed to create "all" and "default" entries.
---
net/ipv4/devinet.c +4 -4
@@ -1455,8 +1460,8 @@ static struct devinet_sysctl_table { }, }; -static void __devinet_sysctl_register (char *dev_name,int ctl_name, -struct ipv4_devconf *p) +static int __devinet_sysctl_register (struct net *net,char *dev_name, +int ctl_name,struct ipv4_devconf *p) {int i;struct devinet_sysctl_table *t;
@@ -1498,14 +1504,14 @@ static void __devinet_sysctl_register(char *dev_name, int ctl_name, goto free_procname; p->sysctl = t; -return ; +return 0 ; free_procname:kfree (t->dev_name); free:kfree (t); out: -return ; +return -ENOBUFS ; }static void __devinet_sysctl_unregister (struct ipv4_devconf *cnf)
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 2/7] Make __devinet_sysctl_register return an error
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:48:44 +0300
Quoted 9 lines
Currently, this function is void, so failures in creating sysctls for new/renamed devices are not reported to anywhere.
Fixing this is another complex (needed?) task, but this return value is needed during the namespaces creation to handle the case, when we failed to create "all" and "default" entries.
Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 3/7 Pass the net pointer to the arp_req_set_proxy()
In reply to Pavel EmelyanovThis one will need to set the IPV4_DEVCONF_ALL(PROXY_ARP), but there's no ways to get the net right in place, so we have to pull one from the inet_ioctl's struct sock.
---
include/net/arp.h +1 -1
@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;extern void arp_init (void );extern int arp_find (unsigned char *haddr,struct sk_buff *skb); -extern int arp_ioctl (unsigned int cmd,void __user *arg); +extern int arp_ioctl (struct net *net,unsigned int cmd,void __user *arg);extern void arp_send (int type,int ptype,__be32 dest_ip,struct net_device *dev,__be32 src_ip,unsigned char *dest_hw,unsigned char *src_hw,unsigned char *th);
net/ipv4/af_inet.c +1 -1
@@ -798,7 +798,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)case SIOCDARP :case SIOCGARP :case SIOCSARP : - err =arp_ioctl (cmd, (void __user *)arg); + err =arp_ioctl (sk->sk_net, cmd, (void __user *)arg);break ;case SIOCGIFADDR :case SIOCSIFADDR :
net/ipv4/arp.c +16 -12
@@ -953,7 +953,7 @@ out_of_mem:* Set (create) an ARP cache entry. */ -static int arp_req_set_proxy (struct net_device *dev,int on) +static int arp_req_set_proxy (struct net *net,struct net_device *dev,int on) {if (dev ==NULL ) {IPV4_DEVCONF_ALL (PROXY_ARP ) = on;
@@ -966,7 +966,8 @@ static int arp_req_set_proxy(struct net_device *dev, int on)return -ENXIO ; } -static int arp_req_set_public (struct arpreq *r,struct net_device *dev) +static int arp_req_set_public (struct net *net,struct arpreq *r, +struct net_device *dev) {__be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
@@ -985,17 +986,18 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev)return 0 ; } -return arp_req_set_proxy (dev,1 ); +return arp_req_set_proxy (net, dev,1 ); } -static int arp_req_set (struct arpreq *r,struct net_device * dev) +static int arp_req_set (struct net *net,struct arpreq *r, +struct net_device * dev) {__be32 ip;struct neighbour *neigh;int err;if (r->arp_flags &ATF_PUBL ) -return arp_req_set_public (r, dev); +return arp_req_set_public (net, r, dev); ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;if (r->arp_flags &ATF_PERM )
@@ -1081,7 +1083,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)return err; } -static int arp_req_delete_public (struct arpreq *r,struct net_device *dev) +static int arp_req_delete_public (struct net *net,struct arpreq *r, +struct net_device *dev) {__be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
@@ -1092,17 +1095,18 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)if (mask)return -EINVAL ; -return arp_req_set_proxy (dev,0 ); +return arp_req_set_proxy (net, dev,0 ); } -static int arp_req_delete (struct arpreq *r,struct net_device * dev) +static int arp_req_delete (struct net *net,struct arpreq *r, +struct net_device * dev) {int err;__be32 ip;struct neighbour *neigh;if (r->arp_flags &ATF_PUBL ) -return arp_req_delete_public (r, dev); +return arp_req_delete_public (net, r, dev); ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;if (dev ==NULL ) {
@@ -1132,7 +1136,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)* Handle an ARP layer I/O control request. */ -int arp_ioctl (unsigned int cmd,void __user *arg) +int arp_ioctl (struct net *net,unsigned int cmd,void __user *arg) {int err;struct arpreq r;
@@ -1180,10 +1184,10 @@ int arp_ioctl(unsigned int cmd, void __user *arg)switch (cmd) {case SIOCDARP : - err =arp_req_delete (&r, dev); + err =arp_req_delete (net, &r, dev);break ;case SIOCSARP : - err =arp_req_set (&r, dev); + err =arp_req_set (net, &r, dev);break ;case SIOCGARP : err =arp_req_get (&r, dev);
Signature · 1 line
1.5.3.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
David Miller
AppliedRe: [PATCH net-2.6.25 3/7] Pass the net pointer to the arp_req_set_proxy()
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:50:59 +0300
Quoted 5 lines
This one will need to set the
IPV4_DEVCONF_ALL(PROXY_ARP), but there's no ways to get the net right in place, so we have to pull one from the inet_ioctl's struct sock.Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 4/7 Store the net pointer on devinet's ctl tables
In reply to Pavel EmelyanovSome handers and strategies of devinet sysctl tables need to know the net to propagate the ctl change to all the net devices.
I use the (currently unused) extra2 pointer on the tables to get it.
Holding the reference on the struct net is not possible, because otherwise we'll get a net->ctl_table->net circular dependency. But since the ctl tables are unregistered during the net destruction, this is safe to get it w/o additional protection.
---
net/ipv4/devinet.c +18 -11
@@ -1237,12 +1237,12 @@ errout:#ifdef CONFIG_SYSCTL -static void devinet_copy_dflt_conf (int i) +static void devinet_copy_dflt_conf (struct net *net,int i) {struct net_device *dev;read_lock (&dev_base_lock); -for_each_netdev (&init_net, dev) { +for_each_netdev (net, dev) {struct in_device *in_dev;rcu_read_lock (); in_dev =__in_dev_get_rcu (dev);
@@ -1253,7 +1253,7 @@ static void devinet_copy_dflt_conf(int i)read_unlock (&dev_base_lock); } -static void inet_forward_change (void ) +static void inet_forward_change (struct net *net) {struct net_device *dev;int on =IPV4_DEVCONF_ALL (FORWARDING );
@@ -1262,7 +1262,7 @@ static void inet_forward_change(void)IPV4_DEVCONF_DFLT (FORWARDING ) = on;read_lock (&dev_base_lock); -for_each_netdev (&init_net, dev) { +for_each_netdev (net, dev) {struct in_device *in_dev;rcu_read_lock (); in_dev =__in_dev_get_rcu (dev);
@@ -1283,12 +1283,13 @@ static int devinet_conf_proc(ctl_table *ctl, int write,if (write) {struct ipv4_devconf *cnf = ctl->extra1; +struct net *net = ctl->extra2;int i = (int *)ctl->data - cnf->data;set_bit (i, cnf->state);if (cnf == &ipv4_devconf_dflt) -devinet_copy_dflt_conf (i); +devinet_copy_dflt_conf (net, i); }return ret;
@@ -1299,6 +1300,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, void __user *newval, size_t newlen) {struct ipv4_devconf *cnf; +struct net *net;int *valp = table->data;int new;int i;
@@ -1334,12 +1336,13 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, *valp = new; cnf = table->extra1; + net = table->extra2; i = (int *)table->data - cnf->data;set_bit (i, cnf->state);if (cnf == &ipv4_devconf_dflt) -devinet_copy_dflt_conf (i); +devinet_copy_dflt_conf (net, i);return 1 ; }
@@ -1353,8 +1356,10 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,int ret =proc_dointvec (ctl, write, filp, buffer, lenp, ppos);if (write && *valp != val) { +struct net *net = ctl->extra2; +if (valp == &IPV4_DEVCONF_ALL (FORWARDING )) -inet_forward_change (); +inet_forward_change (net);else if (valp != &IPV4_DEVCONF_DFLT (FORWARDING ))rt_cache_flush (0 ); }
@@ -1478,6 +1483,7 @@ static void __devinet_sysctl_register(char *dev_name, int ctl_name,for (i =0 ; i <ARRAY_SIZE (t->devinet_vars) -1 ; i++) { t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; t->devinet_vars[i].extra1 = p; + t->devinet_vars[i].extra2 = net; }/*
@@ -1525,8 +1531,8 @@ static void devinet_sysctl_register(struct in_device *idev) {neigh_sysctl_register (idev->dev, idev->arp_parms,NET_IPV4 ,NET_IPV4_NEIGH ,"ipv4" ,NULL ,NULL ); -__devinet_sysctl_register (idev->dev->name, idev->dev->ifindex, - &idev->cnf); +__devinet_sysctl_register (idev->dev->nd_net, idev->dev->name, + idev->dev->ifindex, &idev->cnf); }static void devinet_sysctl_unregister (struct in_device *idev)
@@ -1547,6 +1553,7 @@ static struct ctl_table ctl_forward_entry[] = { .proc_handler = devinet_sysctl_forward, .strategy = devinet_conf_sysctl, .extra1 = &ipv4_devconf, + .extra2 = &init_net, }, { }, };
@@ -1566,9 +1573,9 @@ void __init devinet_init(void)rtnl_register (PF_INET ,RTM_DELADDR , inet_rtm_deladdr,NULL );rtnl_register (PF_INET ,RTM_GETADDR ,NULL , inet_dump_ifaddr);#ifdef CONFIG_SYSCTL -__devinet_sysctl_register ("all" ,NET_PROTO_CONF_ALL , +__devinet_sysctl_register (&init_net,"all" ,NET_PROTO_CONF_ALL , &ipv4_devconf); -__devinet_sysctl_register ("default" ,NET_PROTO_CONF_DEFAULT , +__devinet_sysctl_register (&init_net,"default" ,NET_PROTO_CONF_DEFAULT , &ipv4_devconf_dflt);register_sysctl_paths (net_ipv4_path, ctl_forward_entry);#endif
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 4/7] Store the net pointer on devinet's ctl tables
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:53:55 +0300
Quoted 7 lines
Some handers and strategies of devinet sysctl tables need to know the net to propagate the ctl change to all the net devices.
I use the (currently unused) extra2 pointer on the tables to get it.
Quoted 7 lines
Holding the reference on the struct net is not possible, because otherwise we'll get a
net->ctl_table->netcircular dependency. But since the ctl tables are unregistered during the net destruction, this is safe to get it w/o additional protection.Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 5/7 Move the devinet pointers on the struct net
In reply to Pavel EmelyanovThis is the core.
Add all and default pointers on the netns_ipv4 and register a new pernet subsys to initialize them.
Also add the ctl_table_header to register the
net.ipv4.ip_forward ctl.
I don't allocate additional memory for init_net, but use global devinets.
---
include/net/netns/ipv4.h +6 -0
@@ -4,6 +4,12 @@#ifndef __NETNS_IPV4_H__#define __NETNS_IPV4_H__ +struct ctl_table_header ; +struct ipv4_devconf ; +struct netns_ipv4 { +struct ctl_table_header *forw_hdr; +struct ipv4_devconf *devconf_all; +struct ipv4_devconf *devconf_dflt; };#endif
net/ipv4/devinet.c +96 -9
136 lines not on this page · raw message
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 5/7] Move the devinet pointers on the struct net
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:57:18 +0300
Quoted 5 lines
This is the core.
Add all and default pointers on the
netns_ipv4and register a new pernet subsys to initialize them.
Quoted 7 lines
Also add the
ctl_table_headerto register the
net.ipv4.ip_forward ctl.I don't allocate additional memory for
init_net, but use global devinets.Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 6/7 Switch users of ipv4_devconf_dflt to use the pernet one
In reply to Pavel EmelyanovThey are all collected in the net/ipv4/devinet.c file and mostly use the IPV4_DEVCONF_DFLT macro.
So I add the net parameter to it and patch users accordingly.
---
net/ipv4/devinet.c +9 -7
@@ -83,7 +83,8 @@ static struct ipv4_devconf ipv4_devconf_dflt = { }, }; -#define IPV4_DEVCONF_DFLT (attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr) +#define IPV4_DEVCONF_DFLT (net, attr) \ + IPV4_DEVCONF((*net->ipv4.devconf_dflt), attr)static const struct nla_policy ifa_ipv4_policy[IFA_MAX +1 ] = { [IFA_LOCAL ] = { .type =NLA_U32 },
@@ -164,7 +165,8 @@ static struct in_device *inetdev_init(struct net_device *dev)if (!in_dev) goto out;INIT_RCU_HEAD (&in_dev->rcu_head); -memcpy (&in_dev->cnf, &ipv4_devconf_dflt,sizeof (in_dev->cnf)); +memcpy (&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt, +sizeof (in_dev->cnf)); in_dev->cnf.sysctl =NULL ; in_dev->dev = dev;if ((in_dev->arp_parms =neigh_parms_alloc (dev, &arp_tbl)) ==NULL )
@@ -1248,7 +1250,7 @@ static void devinet_copy_dflt_conf(struct net *net, int i)rcu_read_lock (); in_dev =__in_dev_get_rcu (dev);if (in_dev && !test_bit (i, in_dev->cnf.state)) - in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i]; + in_dev->cnf.data[i] = net->ipv4.devconf_dflt->data[i];rcu_read_unlock (); }read_unlock (&dev_base_lock);
@@ -1260,7 +1262,7 @@ static void inet_forward_change(struct net *net)int on =IPV4_DEVCONF_ALL (FORWARDING );IPV4_DEVCONF_ALL (ACCEPT_REDIRECTS ) = !on; -IPV4_DEVCONF_DFLT (FORWARDING ) = on; +IPV4_DEVCONF_DFLT (net,FORWARDING ) = on;read_lock (&dev_base_lock);for_each_netdev (net, dev) {
@@ -1289,7 +1291,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,set_bit (i, cnf->state); -if (cnf == &ipv4_devconf_dflt) +if (cnf == net->ipv4.devconf_dflt)devinet_copy_dflt_conf (net, i); }
@@ -1342,7 +1344,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,set_bit (i, cnf->state); -if (cnf == &ipv4_devconf_dflt) +if (cnf == net->ipv4.devconf_dflt)devinet_copy_dflt_conf (net, i);return 1 ;
@@ -1361,7 +1363,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,if (valp == &IPV4_DEVCONF_ALL (FORWARDING ))inet_forward_change (net); -else if (valp != &IPV4_DEVCONF_DFLT (FORWARDING )) +else if (valp != &IPV4_DEVCONF_DFLT (net,FORWARDING ))rt_cache_flush (0 ); }
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 6/7] Switch users of ipv4_devconf_dflt to use the pernet one
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 20:59:58 +0300
Quoted 6 lines
They are all collected in the
net/ipv4/devinet.cfile and mostly use theIPV4_DEVCONF_DFLTmacro.So I add the net parameter to it and patch users accordingly.
Signed-off-by Pavel Emelyanov <[email protected]>
Applied.
PATCH 7/7 Switch users of ipv4_devconf(_all) to use the pernet one
In reply to Pavel EmelyanovThese are scattered over the code, but almost all the "critical" places already have the proper struct net at hand except for snmp proc showing function and routing rtnl handler.
---
include/linux/inetdevice.h +8 -4
@@ -44,7 +44,8 @@ struct in_device };#define IPV4_DEVCONF (cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) -#define IPV4_DEVCONF_ALL (attr) IPV4_DEVCONF(ipv4_devconf, attr) +#define IPV4_DEVCONF_ALL (net, attr) \ + IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)static inline int ipv4_devconf_get (struct in_device *in_dev,int index) {
@@ -71,11 +72,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))#define IN_DEV_ANDCONF (in_dev, attr) \ - (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr)) + (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ + IN_DEV_CONF_GET((in_dev), attr))#define IN_DEV_ORCONF (in_dev, attr) \ - (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr)) + (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ + IN_DEV_CONF_GET((in_dev), attr))#define IN_DEV_MAXCONF (in_dev, attr) \ - (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) + (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ + IN_DEV_CONF_GET((in_dev), attr)))#define IN_DEV_FORWARD (in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)#define IN_DEV_MFORWARD (in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
net/ipv4/arp.c +2 -2
@@ -861,7 +861,7 @@ static int arp_process(struct sk_buff *skb) n =__neigh_lookup (&arp_tbl, &sip, dev,0 ); -if (IPV4_DEVCONF_ALL (ARP_ACCEPT )) { +if (IPV4_DEVCONF_ALL (dev->nd_net,ARP_ACCEPT )) {/* Unsolicited ARP is not accepted by default. It is possible, that this option should be enabled for some devices (strip is candidate)
@@ -956,7 +956,7 @@ out_of_mem:static int arp_req_set_proxy (struct net *net,struct net_device *dev,int on) {if (dev ==NULL ) { -IPV4_DEVCONF_ALL (PROXY_ARP ) = on; +IPV4_DEVCONF_ALL (net,PROXY_ARP ) = on;return 0 ; }if (__in_dev_get_rtnl (dev)) {
net/ipv4/devinet.c +3 -3
@@ -1259,9 +1259,9 @@ static void devinet_copy_dflt_conf(struct net *net, int i)static void inet_forward_change (struct net *net) {struct net_device *dev; -int on =IPV4_DEVCONF_ALL (FORWARDING ); +int on =IPV4_DEVCONF_ALL (net,FORWARDING ); -IPV4_DEVCONF_ALL (ACCEPT_REDIRECTS ) = !on; +IPV4_DEVCONF_ALL (net,ACCEPT_REDIRECTS ) = !on;IPV4_DEVCONF_DFLT (net,FORWARDING ) = on;read_lock (&dev_base_lock);
@@ -1361,7 +1361,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,if (write && *valp != val) {struct net *net = ctl->extra2; -if (valp == &IPV4_DEVCONF_ALL (FORWARDING )) +if (valp == &IPV4_DEVCONF_ALL (net,FORWARDING ))inet_forward_change (net);else if (valp != &IPV4_DEVCONF_DFLT (net,FORWARDING ))rt_cache_flush (0 );
net/ipv4/igmp.c +2 -2
@@ -130,12 +130,12 @@*/ #define IGMP_V1_SEEN (in_dev) \ - (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 1 || \ + (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \ IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ ((in_dev)->mr_v1_seen && \ time_before(jiffies, (in_dev)->mr_v1_seen)))#define IGMP_V2_SEEN (in_dev) \ - (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 2 || \ + (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \ IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ ((in_dev)->mr_v2_seen && \ time_before(jiffies, (in_dev)->mr_v2_seen)))
net/ipv4/ipmr.c +2 -2
@@ -849,7 +849,7 @@ static void mrtsock_destruct(struct sock *sk) {rtnl_lock ();if (sk == mroute_socket) { -IPV4_DEVCONF_ALL (MC_FORWARDING )--; +IPV4_DEVCONF_ALL (sk->sk_net,MC_FORWARDING )--;write_lock_bh (&mrt_lock); mroute_socket=NULL ;
@@ -898,7 +898,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt mroute_socket=sk;write_unlock_bh (&mrt_lock); -IPV4_DEVCONF_ALL (MC_FORWARDING )++; +IPV4_DEVCONF_ALL (sk->sk_net,MC_FORWARDING )++; }rtnl_unlock ();return ret;
net/ipv4/proc.c +2 -1
@@ -309,7 +309,8 @@ static int snmp_seq_show(struct seq_file *seq, void *v)seq_printf (seq," %s" , snmp4_ipstats_list[i].name);seq_printf (seq,"\nIp: %d %d" , -IPV4_DEVCONF_ALL (FORWARDING ) ?1 :2 , sysctl_ip_default_ttl); +IPV4_DEVCONF_ALL (&init_net,FORWARDING ) ?1 :2 , + sysctl_ip_default_ttl);for (i =0 ; snmp4_ipstats_list[i].name !=NULL ; i++) seq_printf(seq, " %lu",
net/ipv4/route.c +1 -1
@@ -2615,7 +2615,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,__be32 dst = rt->rt_dst;if (MULTICAST (dst) && !LOCAL_MCAST (dst) && -IPV4_DEVCONF_ALL (MC_FORWARDING )) { +IPV4_DEVCONF_ALL (&init_net,MC_FORWARDING )) {int err =ipmr_get_route (skb, r, nowait);if (err <=0 ) {if (!nowait) {
Signature · 1 line
1.5.3.4
Re: [PATCH net-2.6.25 7/7] Switch users of ipv4_devconf(_all) to use the pernet one
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Dec 2007 21:02:18 +0300
Quoted 6 lines
These are scattered over the code, but almost all the "critical" places already have the proper struct net at hand except for snmp proc showing function and routing rtnl handler.
Signed-off-by Pavel Emelyanov <[email protected]>
Applied.