diff options
-rw-r--r-- | include/linux/inetdevice.h | 12 | ||||
-rw-r--r-- | net/ipv4/arp.c | 4 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 6 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 4 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 4 | ||||
-rw-r--r-- | net/ipv4/proc.c | 3 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 |
7 files changed, 20 insertions, 15 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 962a062b44ff..b3c5081de02d 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -44,7 +44,8 @@ struct in_device | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) | 46 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) |
47 | #define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr) | 47 | #define IPV4_DEVCONF_ALL(net, attr) \ |
48 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) | ||
48 | 49 | ||
49 | static inline int ipv4_devconf_get(struct in_device *in_dev, int index) | 50 | static inline int ipv4_devconf_get(struct in_device *in_dev, int index) |
50 | { | 51 | { |
@@ -71,11 +72,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
71 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 72 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) |
72 | 73 | ||
73 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 74 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
74 | (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr)) | 75 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ |
76 | IN_DEV_CONF_GET((in_dev), attr)) | ||
75 | #define IN_DEV_ORCONF(in_dev, attr) \ | 77 | #define IN_DEV_ORCONF(in_dev, attr) \ |
76 | (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr)) | 78 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ |
79 | IN_DEV_CONF_GET((in_dev), attr)) | ||
77 | #define IN_DEV_MAXCONF(in_dev, attr) \ | 80 | #define IN_DEV_MAXCONF(in_dev, attr) \ |
78 | (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) | 81 | (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ |
82 | IN_DEV_CONF_GET((in_dev), attr))) | ||
79 | 83 | ||
80 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 84 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
81 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 85 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 5daf504ba3b3..1102fb3d8018 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -860,7 +860,7 @@ static int arp_process(struct sk_buff *skb) | |||
860 | 860 | ||
861 | n = __neigh_lookup(&arp_tbl, &sip, dev, 0); | 861 | n = __neigh_lookup(&arp_tbl, &sip, dev, 0); |
862 | 862 | ||
863 | if (IPV4_DEVCONF_ALL(ARP_ACCEPT)) { | 863 | if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) { |
864 | /* Unsolicited ARP is not accepted by default. | 864 | /* Unsolicited ARP is not accepted by default. |
865 | It is possible, that this option should be enabled for some | 865 | It is possible, that this option should be enabled for some |
866 | devices (strip is candidate) | 866 | devices (strip is candidate) |
@@ -955,7 +955,7 @@ out_of_mem: | |||
955 | static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on) | 955 | static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on) |
956 | { | 956 | { |
957 | if (dev == NULL) { | 957 | if (dev == NULL) { |
958 | IPV4_DEVCONF_ALL(PROXY_ARP) = on; | 958 | IPV4_DEVCONF_ALL(net, PROXY_ARP) = on; |
959 | return 0; | 959 | return 0; |
960 | } | 960 | } |
961 | if (__in_dev_get_rtnl(dev)) { | 961 | if (__in_dev_get_rtnl(dev)) { |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 4c01c55c381d..1f21f4a2df86 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1258,9 +1258,9 @@ static void devinet_copy_dflt_conf(struct net *net, int i) | |||
1258 | static void inet_forward_change(struct net *net) | 1258 | static void inet_forward_change(struct net *net) |
1259 | { | 1259 | { |
1260 | struct net_device *dev; | 1260 | struct net_device *dev; |
1261 | int on = IPV4_DEVCONF_ALL(FORWARDING); | 1261 | int on = IPV4_DEVCONF_ALL(net, FORWARDING); |
1262 | 1262 | ||
1263 | IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on; | 1263 | IPV4_DEVCONF_ALL(net, ACCEPT_REDIRECTS) = !on; |
1264 | IPV4_DEVCONF_DFLT(net, FORWARDING) = on; | 1264 | IPV4_DEVCONF_DFLT(net, FORWARDING) = on; |
1265 | 1265 | ||
1266 | read_lock(&dev_base_lock); | 1266 | read_lock(&dev_base_lock); |
@@ -1360,7 +1360,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1360 | if (write && *valp != val) { | 1360 | if (write && *valp != val) { |
1361 | struct net *net = ctl->extra2; | 1361 | struct net *net = ctl->extra2; |
1362 | 1362 | ||
1363 | if (valp == &IPV4_DEVCONF_ALL(FORWARDING)) | 1363 | if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) |
1364 | inet_forward_change(net); | 1364 | inet_forward_change(net); |
1365 | else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) | 1365 | else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) |
1366 | rt_cache_flush(0); | 1366 | rt_cache_flush(0); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c560a9392b1d..d3d5906e1b3d 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -130,12 +130,12 @@ | |||
130 | */ | 130 | */ |
131 | 131 | ||
132 | #define IGMP_V1_SEEN(in_dev) \ | 132 | #define IGMP_V1_SEEN(in_dev) \ |
133 | (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 1 || \ | 133 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \ |
134 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ | 134 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ |
135 | ((in_dev)->mr_v1_seen && \ | 135 | ((in_dev)->mr_v1_seen && \ |
136 | time_before(jiffies, (in_dev)->mr_v1_seen))) | 136 | time_before(jiffies, (in_dev)->mr_v1_seen))) |
137 | #define IGMP_V2_SEEN(in_dev) \ | 137 | #define IGMP_V2_SEEN(in_dev) \ |
138 | (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 2 || \ | 138 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \ |
139 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ | 139 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ |
140 | ((in_dev)->mr_v2_seen && \ | 140 | ((in_dev)->mr_v2_seen && \ |
141 | time_before(jiffies, (in_dev)->mr_v2_seen))) | 141 | time_before(jiffies, (in_dev)->mr_v2_seen))) |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 11879283ad52..9947f523862e 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -849,7 +849,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
849 | { | 849 | { |
850 | rtnl_lock(); | 850 | rtnl_lock(); |
851 | if (sk == mroute_socket) { | 851 | if (sk == mroute_socket) { |
852 | IPV4_DEVCONF_ALL(MC_FORWARDING)--; | 852 | IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)--; |
853 | 853 | ||
854 | write_lock_bh(&mrt_lock); | 854 | write_lock_bh(&mrt_lock); |
855 | mroute_socket=NULL; | 855 | mroute_socket=NULL; |
@@ -898,7 +898,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
898 | mroute_socket=sk; | 898 | mroute_socket=sk; |
899 | write_unlock_bh(&mrt_lock); | 899 | write_unlock_bh(&mrt_lock); |
900 | 900 | ||
901 | IPV4_DEVCONF_ALL(MC_FORWARDING)++; | 901 | IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)++; |
902 | } | 902 | } |
903 | rtnl_unlock(); | 903 | rtnl_unlock(); |
904 | return ret; | 904 | return ret; |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ce34b281803f..41734db677be 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -309,7 +309,8 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
309 | seq_printf(seq, " %s", snmp4_ipstats_list[i].name); | 309 | seq_printf(seq, " %s", snmp4_ipstats_list[i].name); |
310 | 310 | ||
311 | seq_printf(seq, "\nIp: %d %d", | 311 | seq_printf(seq, "\nIp: %d %d", |
312 | IPV4_DEVCONF_ALL(FORWARDING) ? 1 : 2, sysctl_ip_default_ttl); | 312 | IPV4_DEVCONF_ALL(&init_net, FORWARDING) ? 1 : 2, |
313 | sysctl_ip_default_ttl); | ||
313 | 314 | ||
314 | for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) | 315 | for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) |
315 | seq_printf(seq, " %lu", | 316 | seq_printf(seq, " %lu", |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 1b70ffd12615..36c7add8de84 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2619,7 +2619,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2619 | __be32 dst = rt->rt_dst; | 2619 | __be32 dst = rt->rt_dst; |
2620 | 2620 | ||
2621 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && | 2621 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && |
2622 | IPV4_DEVCONF_ALL(MC_FORWARDING)) { | 2622 | IPV4_DEVCONF_ALL(&init_net, MC_FORWARDING)) { |
2623 | int err = ipmr_get_route(skb, r, nowait); | 2623 | int err = ipmr_get_route(skb, r, nowait); |
2624 | if (err <= 0) { | 2624 | if (err <= 0) { |
2625 | if (!nowait) { | 2625 | if (!nowait) { |