aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-10-27 18:15:57 -0400
committerMichal Marek <mmarek@suse.cz>2010-10-27 18:15:57 -0400
commitb74b953b998bcc2db91b694446f3a2619ec32de6 (patch)
tree6ce24caabd730f6ae9287ed0676ec32e6ff31e9d /net/ipv4/devinet.c
parentabb438526201c6a79949ad45375c051b6681c253 (diff)
parentf6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff)
Merge commit 'v2.6.36' into kbuild/misc
Update to be able to fix a recent change to scripts/basic/docproc.c (commit eda603f).
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 040c4f05b653..da14c49284f4 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -50,6 +50,7 @@
50#include <linux/notifier.h> 50#include <linux/notifier.h>
51#include <linux/inetdevice.h> 51#include <linux/inetdevice.h>
52#include <linux/igmp.h> 52#include <linux/igmp.h>
53#include <linux/slab.h>
53#ifdef CONFIG_SYSCTL 54#ifdef CONFIG_SYSCTL
54#include <linux/sysctl.h> 55#include <linux/sysctl.h>
55#endif 56#endif
@@ -64,20 +65,20 @@
64 65
65static struct ipv4_devconf ipv4_devconf = { 66static struct ipv4_devconf ipv4_devconf = {
66 .data = { 67 .data = {
67 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, 68 [IPV4_DEVCONF_ACCEPT_REDIRECTS - 1] = 1,
68 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, 69 [IPV4_DEVCONF_SEND_REDIRECTS - 1] = 1,
69 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, 70 [IPV4_DEVCONF_SECURE_REDIRECTS - 1] = 1,
70 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, 71 [IPV4_DEVCONF_SHARED_MEDIA - 1] = 1,
71 }, 72 },
72}; 73};
73 74
74static struct ipv4_devconf ipv4_devconf_dflt = { 75static struct ipv4_devconf ipv4_devconf_dflt = {
75 .data = { 76 .data = {
76 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, 77 [IPV4_DEVCONF_ACCEPT_REDIRECTS - 1] = 1,
77 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, 78 [IPV4_DEVCONF_SEND_REDIRECTS - 1] = 1,
78 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, 79 [IPV4_DEVCONF_SECURE_REDIRECTS - 1] = 1,
79 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, 80 [IPV4_DEVCONF_SHARED_MEDIA - 1] = 1,
80 [NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE - 1] = 1, 81 [IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE - 1] = 1,
81 }, 82 },
82}; 83};
83 84
@@ -1080,6 +1081,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1080 } 1081 }
1081 ip_mc_up(in_dev); 1082 ip_mc_up(in_dev);
1082 /* fall through */ 1083 /* fall through */
1084 case NETDEV_NOTIFY_PEERS:
1083 case NETDEV_CHANGEADDR: 1085 case NETDEV_CHANGEADDR:
1084 /* Send gratuitous ARP to notify of link change */ 1086 /* Send gratuitous ARP to notify of link change */
1085 if (IN_DEV_ARP_NOTIFY(in_dev)) { 1087 if (IN_DEV_ARP_NOTIFY(in_dev)) {
@@ -1095,10 +1097,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1095 case NETDEV_DOWN: 1097 case NETDEV_DOWN:
1096 ip_mc_down(in_dev); 1098 ip_mc_down(in_dev);
1097 break; 1099 break;
1098 case NETDEV_BONDING_OLDTYPE: 1100 case NETDEV_PRE_TYPE_CHANGE:
1099 ip_mc_unmap(in_dev); 1101 ip_mc_unmap(in_dev);
1100 break; 1102 break;
1101 case NETDEV_BONDING_NEWTYPE: 1103 case NETDEV_POST_TYPE_CHANGE:
1102 ip_mc_remap(in_dev); 1104 ip_mc_remap(in_dev);
1103 break; 1105 break;
1104 case NETDEV_CHANGEMTU: 1106 case NETDEV_CHANGEMTU:
@@ -1194,7 +1196,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1194 hlist_for_each_entry_rcu(dev, node, head, index_hlist) { 1196 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
1195 if (idx < s_idx) 1197 if (idx < s_idx)
1196 goto cont; 1198 goto cont;
1197 if (idx > s_idx) 1199 if (h > s_h || idx > s_idx)
1198 s_ip_idx = 0; 1200 s_ip_idx = 0;
1199 in_dev = __in_dev_get_rcu(dev); 1201 in_dev = __in_dev_get_rcu(dev);
1200 if (!in_dev) 1202 if (!in_dev)
@@ -1317,14 +1319,19 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
1317{ 1319{
1318 int *valp = ctl->data; 1320 int *valp = ctl->data;
1319 int val = *valp; 1321 int val = *valp;
1322 loff_t pos = *ppos;
1320 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); 1323 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
1321 1324
1322 if (write && *valp != val) { 1325 if (write && *valp != val) {
1323 struct net *net = ctl->extra2; 1326 struct net *net = ctl->extra2;
1324 1327
1325 if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) { 1328 if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) {
1326 if (!rtnl_trylock()) 1329 if (!rtnl_trylock()) {
1330 /* Restore the original values before restarting */
1331 *valp = val;
1332 *ppos = pos;
1327 return restart_syscall(); 1333 return restart_syscall();
1334 }
1328 if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) { 1335 if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) {
1329 inet_forward_change(net); 1336 inet_forward_change(net);
1330 } else if (*valp) { 1337 } else if (*valp) {
@@ -1360,7 +1367,7 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1360 { \ 1367 { \
1361 .procname = name, \ 1368 .procname = name, \
1362 .data = ipv4_devconf.data + \ 1369 .data = ipv4_devconf.data + \
1363 NET_IPV4_CONF_ ## attr - 1, \ 1370 IPV4_DEVCONF_ ## attr - 1, \
1364 .maxlen = sizeof(int), \ 1371 .maxlen = sizeof(int), \
1365 .mode = mval, \ 1372 .mode = mval, \
1366 .proc_handler = proc, \ 1373 .proc_handler = proc, \
@@ -1381,7 +1388,7 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1381 1388
1382static struct devinet_sysctl_table { 1389static struct devinet_sysctl_table {
1383 struct ctl_table_header *sysctl_header; 1390 struct ctl_table_header *sysctl_header;
1384 struct ctl_table devinet_vars[__NET_IPV4_CONF_MAX]; 1391 struct ctl_table devinet_vars[__IPV4_DEVCONF_MAX];
1385 char *dev_name; 1392 char *dev_name;
1386} devinet_sysctl = { 1393} devinet_sysctl = {
1387 .devinet_vars = { 1394 .devinet_vars = {
@@ -1408,6 +1415,7 @@ static struct devinet_sysctl_table {
1408 DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"), 1415 DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"),
1409 DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"), 1416 DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"),
1410 DEVINET_SYSCTL_RW_ENTRY(ARP_NOTIFY, "arp_notify"), 1417 DEVINET_SYSCTL_RW_ENTRY(ARP_NOTIFY, "arp_notify"),
1418 DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP_PVLAN, "proxy_arp_pvlan"),
1411 1419
1412 DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"), 1420 DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),
1413 DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"), 1421 DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),
@@ -1486,8 +1494,7 @@ static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf)
1486 1494
1487static void devinet_sysctl_register(struct in_device *idev) 1495static void devinet_sysctl_register(struct in_device *idev)
1488{ 1496{
1489 neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4, 1497 neigh_sysctl_register(idev->dev, idev->arp_parms, "ipv4", NULL);
1490 NET_IPV4_NEIGH, "ipv4", NULL);
1491 __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, 1498 __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name,
1492 &idev->cnf); 1499 &idev->cnf);
1493} 1500}
@@ -1502,7 +1509,7 @@ static struct ctl_table ctl_forward_entry[] = {
1502 { 1509 {
1503 .procname = "ip_forward", 1510 .procname = "ip_forward",
1504 .data = &ipv4_devconf.data[ 1511 .data = &ipv4_devconf.data[
1505 NET_IPV4_CONF_FORWARDING - 1], 1512 IPV4_DEVCONF_FORWARDING - 1],
1506 .maxlen = sizeof(int), 1513 .maxlen = sizeof(int),
1507 .mode = 0644, 1514 .mode = 0644,
1508 .proc_handler = devinet_sysctl_forward, 1515 .proc_handler = devinet_sysctl_forward,
@@ -1546,7 +1553,7 @@ static __net_init int devinet_init_net(struct net *net)
1546 if (tbl == NULL) 1553 if (tbl == NULL)
1547 goto err_alloc_ctl; 1554 goto err_alloc_ctl;
1548 1555
1549 tbl[0].data = &all->data[NET_IPV4_CONF_FORWARDING - 1]; 1556 tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1];
1550 tbl[0].extra1 = all; 1557 tbl[0].extra1 = all;
1551 tbl[0].extra2 = net; 1558 tbl[0].extra2 = net;
1552#endif 1559#endif