diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-07 20:08:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-07 20:08:06 -0400 |
commit | df3872a9664667edae729361c9948b652de5c6f4 (patch) | |
tree | d191c1e6413f82b7a3f074a29b2d1fb92476d30f /net/ipv4/devinet.c | |
parent | e5e3c84b70e58fc605635fd340fb8dba3cc59058 (diff) | |
parent | 4aa2e62c45b5ca08be2d0d3c0744d7585b56e860 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (24 commits)
xfrm: Add security check before flushing SAD/SPD
[NET_SCHED]: Fix filter double free
[NET]: Avoid duplicate netlink notification when changing link state
[UDP]: Revert 2-pass hashing changes.
[AF_UNIX]: Fix stream recvmsg() race.
[NETFILTER]: nf_conntrack_amanda: fix textsearch_prepare() error check
[NETFILTER]: ip_tables: fix compat related crash
[NETFILTER]: nf_conntrack: fix helper module unload races
[RTNETLINK]: ifindex 0 does not exist
[NETLINK]: Mark netlink policies const
[TCP] tcp_probe: Attach printf attribute properly to printl().
[TCP]: Use LIMIT_NETDEBUG in tcp_retransmit_timer().
[NET]: Merge dst_discard_in and dst_discard_out.
[RFKILL]: Make rfkill->name const
[IPV4]: Restore old behaviour of default config values
[IPV4]: Add default config support after inetdev_init
[IPV4]: Convert IPv4 devconf to an array
[IPV4]: Only panic if inetdev_init fails for loopback
[TCP]: Honour sk_bound_dev_if in tcp_v4_send_ack
[BNX2]: Update version and reldate.
...
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 409 |
1 files changed, 178 insertions, 231 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7f95e6e9beeb..fa97b96a3d89 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -64,21 +64,27 @@ | |||
64 | #include <net/rtnetlink.h> | 64 | #include <net/rtnetlink.h> |
65 | 65 | ||
66 | struct ipv4_devconf ipv4_devconf = { | 66 | struct ipv4_devconf ipv4_devconf = { |
67 | .accept_redirects = 1, | 67 | .data = { |
68 | .send_redirects = 1, | 68 | [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, |
69 | .secure_redirects = 1, | 69 | [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, |
70 | .shared_media = 1, | 70 | [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, |
71 | [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, | ||
72 | }, | ||
71 | }; | 73 | }; |
72 | 74 | ||
73 | static struct ipv4_devconf ipv4_devconf_dflt = { | 75 | static struct ipv4_devconf ipv4_devconf_dflt = { |
74 | .accept_redirects = 1, | 76 | .data = { |
75 | .send_redirects = 1, | 77 | [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, |
76 | .secure_redirects = 1, | 78 | [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, |
77 | .shared_media = 1, | 79 | [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, |
78 | .accept_source_route = 1, | 80 | [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, |
81 | [NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE - 1] = 1, | ||
82 | }, | ||
79 | }; | 83 | }; |
80 | 84 | ||
81 | static struct nla_policy ifa_ipv4_policy[IFA_MAX+1] __read_mostly = { | 85 | #define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr) |
86 | |||
87 | static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { | ||
82 | [IFA_LOCAL] = { .type = NLA_U32 }, | 88 | [IFA_LOCAL] = { .type = NLA_U32 }, |
83 | [IFA_ADDRESS] = { .type = NLA_U32 }, | 89 | [IFA_ADDRESS] = { .type = NLA_U32 }, |
84 | [IFA_BROADCAST] = { .type = NLA_U32 }, | 90 | [IFA_BROADCAST] = { .type = NLA_U32 }, |
@@ -141,7 +147,7 @@ void in_dev_finish_destroy(struct in_device *idev) | |||
141 | } | 147 | } |
142 | } | 148 | } |
143 | 149 | ||
144 | struct in_device *inetdev_init(struct net_device *dev) | 150 | static struct in_device *inetdev_init(struct net_device *dev) |
145 | { | 151 | { |
146 | struct in_device *in_dev; | 152 | struct in_device *in_dev; |
147 | 153 | ||
@@ -399,12 +405,10 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) | |||
399 | ASSERT_RTNL(); | 405 | ASSERT_RTNL(); |
400 | 406 | ||
401 | if (!in_dev) { | 407 | if (!in_dev) { |
402 | in_dev = inetdev_init(dev); | 408 | inet_free_ifa(ifa); |
403 | if (!in_dev) { | 409 | return -ENOBUFS; |
404 | inet_free_ifa(ifa); | ||
405 | return -ENOBUFS; | ||
406 | } | ||
407 | } | 410 | } |
411 | ipv4_devconf_setall(in_dev); | ||
408 | if (ifa->ifa_dev != in_dev) { | 412 | if (ifa->ifa_dev != in_dev) { |
409 | BUG_TRAP(!ifa->ifa_dev); | 413 | BUG_TRAP(!ifa->ifa_dev); |
410 | in_dev_hold(in_dev); | 414 | in_dev_hold(in_dev); |
@@ -514,13 +518,12 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | |||
514 | 518 | ||
515 | in_dev = __in_dev_get_rtnl(dev); | 519 | in_dev = __in_dev_get_rtnl(dev); |
516 | if (in_dev == NULL) { | 520 | if (in_dev == NULL) { |
517 | in_dev = inetdev_init(dev); | 521 | err = -ENOBUFS; |
518 | if (in_dev == NULL) { | 522 | goto errout; |
519 | err = -ENOBUFS; | ||
520 | goto errout; | ||
521 | } | ||
522 | } | 523 | } |
523 | 524 | ||
525 | ipv4_devconf_setall(in_dev); | ||
526 | |||
524 | ifa = inet_alloc_ifa(); | 527 | ifa = inet_alloc_ifa(); |
525 | if (ifa == NULL) { | 528 | if (ifa == NULL) { |
526 | /* | 529 | /* |
@@ -1057,11 +1060,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1057 | if (!in_dev) { | 1060 | if (!in_dev) { |
1058 | if (event == NETDEV_REGISTER) { | 1061 | if (event == NETDEV_REGISTER) { |
1059 | in_dev = inetdev_init(dev); | 1062 | in_dev = inetdev_init(dev); |
1060 | if (!in_dev) | ||
1061 | panic("devinet: Failed to create loopback\n"); | ||
1062 | if (dev == &loopback_dev) { | 1063 | if (dev == &loopback_dev) { |
1063 | in_dev->cnf.no_xfrm = 1; | 1064 | if (!in_dev) |
1064 | in_dev->cnf.no_policy = 1; | 1065 | panic("devinet: " |
1066 | "Failed to create loopback\n"); | ||
1067 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | ||
1068 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | ||
1065 | } | 1069 | } |
1066 | } | 1070 | } |
1067 | goto out; | 1071 | goto out; |
@@ -1237,13 +1241,98 @@ errout: | |||
1237 | 1241 | ||
1238 | #ifdef CONFIG_SYSCTL | 1242 | #ifdef CONFIG_SYSCTL |
1239 | 1243 | ||
1244 | static void devinet_copy_dflt_conf(int i) | ||
1245 | { | ||
1246 | struct net_device *dev; | ||
1247 | |||
1248 | read_lock(&dev_base_lock); | ||
1249 | for_each_netdev(dev) { | ||
1250 | struct in_device *in_dev; | ||
1251 | rcu_read_lock(); | ||
1252 | in_dev = __in_dev_get_rcu(dev); | ||
1253 | if (in_dev && !test_bit(i, in_dev->cnf.state)) | ||
1254 | in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i]; | ||
1255 | rcu_read_unlock(); | ||
1256 | } | ||
1257 | read_unlock(&dev_base_lock); | ||
1258 | } | ||
1259 | |||
1260 | static int devinet_conf_proc(ctl_table *ctl, int write, | ||
1261 | struct file* filp, void __user *buffer, | ||
1262 | size_t *lenp, loff_t *ppos) | ||
1263 | { | ||
1264 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | ||
1265 | |||
1266 | if (write) { | ||
1267 | struct ipv4_devconf *cnf = ctl->extra1; | ||
1268 | int i = (int *)ctl->data - cnf->data; | ||
1269 | |||
1270 | set_bit(i, cnf->state); | ||
1271 | |||
1272 | if (cnf == &ipv4_devconf_dflt) | ||
1273 | devinet_copy_dflt_conf(i); | ||
1274 | } | ||
1275 | |||
1276 | return ret; | ||
1277 | } | ||
1278 | |||
1279 | static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, | ||
1280 | void __user *oldval, size_t __user *oldlenp, | ||
1281 | void __user *newval, size_t newlen) | ||
1282 | { | ||
1283 | struct ipv4_devconf *cnf; | ||
1284 | int *valp = table->data; | ||
1285 | int new; | ||
1286 | int i; | ||
1287 | |||
1288 | if (!newval || !newlen) | ||
1289 | return 0; | ||
1290 | |||
1291 | if (newlen != sizeof(int)) | ||
1292 | return -EINVAL; | ||
1293 | |||
1294 | if (get_user(new, (int __user *)newval)) | ||
1295 | return -EFAULT; | ||
1296 | |||
1297 | if (new == *valp) | ||
1298 | return 0; | ||
1299 | |||
1300 | if (oldval && oldlenp) { | ||
1301 | size_t len; | ||
1302 | |||
1303 | if (get_user(len, oldlenp)) | ||
1304 | return -EFAULT; | ||
1305 | |||
1306 | if (len) { | ||
1307 | if (len > table->maxlen) | ||
1308 | len = table->maxlen; | ||
1309 | if (copy_to_user(oldval, valp, len)) | ||
1310 | return -EFAULT; | ||
1311 | if (put_user(len, oldlenp)) | ||
1312 | return -EFAULT; | ||
1313 | } | ||
1314 | } | ||
1315 | |||
1316 | *valp = new; | ||
1317 | |||
1318 | cnf = table->extra1; | ||
1319 | i = (int *)table->data - cnf->data; | ||
1320 | |||
1321 | set_bit(i, cnf->state); | ||
1322 | |||
1323 | if (cnf == &ipv4_devconf_dflt) | ||
1324 | devinet_copy_dflt_conf(i); | ||
1325 | |||
1326 | return 1; | ||
1327 | } | ||
1328 | |||
1240 | void inet_forward_change(void) | 1329 | void inet_forward_change(void) |
1241 | { | 1330 | { |
1242 | struct net_device *dev; | 1331 | struct net_device *dev; |
1243 | int on = ipv4_devconf.forwarding; | 1332 | int on = IPV4_DEVCONF_ALL(FORWARDING); |
1244 | 1333 | ||
1245 | ipv4_devconf.accept_redirects = !on; | 1334 | IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on; |
1246 | ipv4_devconf_dflt.forwarding = on; | 1335 | IPV4_DEVCONF_DFLT(FORWARDING) = on; |
1247 | 1336 | ||
1248 | read_lock(&dev_base_lock); | 1337 | read_lock(&dev_base_lock); |
1249 | for_each_netdev(dev) { | 1338 | for_each_netdev(dev) { |
@@ -1251,7 +1340,7 @@ void inet_forward_change(void) | |||
1251 | rcu_read_lock(); | 1340 | rcu_read_lock(); |
1252 | in_dev = __in_dev_get_rcu(dev); | 1341 | in_dev = __in_dev_get_rcu(dev); |
1253 | if (in_dev) | 1342 | if (in_dev) |
1254 | in_dev->cnf.forwarding = on; | 1343 | IN_DEV_CONF_SET(in_dev, FORWARDING, on); |
1255 | rcu_read_unlock(); | 1344 | rcu_read_unlock(); |
1256 | } | 1345 | } |
1257 | read_unlock(&dev_base_lock); | 1346 | read_unlock(&dev_base_lock); |
@@ -1268,9 +1357,9 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1268 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1357 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); |
1269 | 1358 | ||
1270 | if (write && *valp != val) { | 1359 | if (write && *valp != val) { |
1271 | if (valp == &ipv4_devconf.forwarding) | 1360 | if (valp == &IPV4_DEVCONF_ALL(FORWARDING)) |
1272 | inet_forward_change(); | 1361 | inet_forward_change(); |
1273 | else if (valp != &ipv4_devconf_dflt.forwarding) | 1362 | else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING)) |
1274 | rt_cache_flush(0); | 1363 | rt_cache_flush(0); |
1275 | } | 1364 | } |
1276 | 1365 | ||
@@ -1295,42 +1384,43 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, | |||
1295 | void __user *oldval, size_t __user *oldlenp, | 1384 | void __user *oldval, size_t __user *oldlenp, |
1296 | void __user *newval, size_t newlen) | 1385 | void __user *newval, size_t newlen) |
1297 | { | 1386 | { |
1298 | int *valp = table->data; | 1387 | int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, |
1299 | int new; | 1388 | newval, newlen); |
1300 | 1389 | ||
1301 | if (!newval || !newlen) | 1390 | if (ret == 1) |
1302 | return 0; | 1391 | rt_cache_flush(0); |
1303 | 1392 | ||
1304 | if (newlen != sizeof(int)) | 1393 | return ret; |
1305 | return -EINVAL; | 1394 | } |
1306 | 1395 | ||
1307 | if (get_user(new, (int __user *)newval)) | ||
1308 | return -EFAULT; | ||
1309 | 1396 | ||
1310 | if (new == *valp) | 1397 | #define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc, sysctl) \ |
1311 | return 0; | 1398 | { \ |
1399 | .ctl_name = NET_IPV4_CONF_ ## attr, \ | ||
1400 | .procname = name, \ | ||
1401 | .data = ipv4_devconf.data + \ | ||
1402 | NET_IPV4_CONF_ ## attr - 1, \ | ||
1403 | .maxlen = sizeof(int), \ | ||
1404 | .mode = mval, \ | ||
1405 | .proc_handler = proc, \ | ||
1406 | .strategy = sysctl, \ | ||
1407 | .extra1 = &ipv4_devconf, \ | ||
1408 | } | ||
1312 | 1409 | ||
1313 | if (oldval && oldlenp) { | 1410 | #define DEVINET_SYSCTL_RW_ENTRY(attr, name) \ |
1314 | size_t len; | 1411 | DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc, \ |
1412 | devinet_conf_sysctl) | ||
1315 | 1413 | ||
1316 | if (get_user(len, oldlenp)) | 1414 | #define DEVINET_SYSCTL_RO_ENTRY(attr, name) \ |
1317 | return -EFAULT; | 1415 | DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc, \ |
1416 | devinet_conf_sysctl) | ||
1318 | 1417 | ||
1319 | if (len) { | 1418 | #define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc, sysctl) \ |
1320 | if (len > table->maxlen) | 1419 | DEVINET_SYSCTL_ENTRY(attr, name, 0644, proc, sysctl) |
1321 | len = table->maxlen; | ||
1322 | if (copy_to_user(oldval, valp, len)) | ||
1323 | return -EFAULT; | ||
1324 | if (put_user(len, oldlenp)) | ||
1325 | return -EFAULT; | ||
1326 | } | ||
1327 | } | ||
1328 | |||
1329 | *valp = new; | ||
1330 | rt_cache_flush(0); | ||
1331 | return 1; | ||
1332 | } | ||
1333 | 1420 | ||
1421 | #define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \ | ||
1422 | DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush, \ | ||
1423 | ipv4_doint_and_flush_strategy) | ||
1334 | 1424 | ||
1335 | static struct devinet_sysctl_table { | 1425 | static struct devinet_sysctl_table { |
1336 | struct ctl_table_header *sysctl_header; | 1426 | struct ctl_table_header *sysctl_header; |
@@ -1341,178 +1431,34 @@ static struct devinet_sysctl_table { | |||
1341 | ctl_table devinet_root_dir[2]; | 1431 | ctl_table devinet_root_dir[2]; |
1342 | } devinet_sysctl = { | 1432 | } devinet_sysctl = { |
1343 | .devinet_vars = { | 1433 | .devinet_vars = { |
1344 | { | 1434 | DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding", |
1345 | .ctl_name = NET_IPV4_CONF_FORWARDING, | 1435 | devinet_sysctl_forward, |
1346 | .procname = "forwarding", | 1436 | devinet_conf_sysctl), |
1347 | .data = &ipv4_devconf.forwarding, | 1437 | DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"), |
1348 | .maxlen = sizeof(int), | 1438 | |
1349 | .mode = 0644, | 1439 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"), |
1350 | .proc_handler = &devinet_sysctl_forward, | 1440 | DEVINET_SYSCTL_RW_ENTRY(SECURE_REDIRECTS, "secure_redirects"), |
1351 | }, | 1441 | DEVINET_SYSCTL_RW_ENTRY(SHARED_MEDIA, "shared_media"), |
1352 | { | 1442 | DEVINET_SYSCTL_RW_ENTRY(RP_FILTER, "rp_filter"), |
1353 | .ctl_name = NET_IPV4_CONF_MC_FORWARDING, | 1443 | DEVINET_SYSCTL_RW_ENTRY(SEND_REDIRECTS, "send_redirects"), |
1354 | .procname = "mc_forwarding", | 1444 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE, |
1355 | .data = &ipv4_devconf.mc_forwarding, | 1445 | "accept_source_route"), |
1356 | .maxlen = sizeof(int), | 1446 | DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"), |
1357 | .mode = 0444, | 1447 | DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"), |
1358 | .proc_handler = &proc_dointvec, | 1448 | DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"), |
1359 | }, | 1449 | DEVINET_SYSCTL_RW_ENTRY(LOG_MARTIANS, "log_martians"), |
1360 | { | 1450 | DEVINET_SYSCTL_RW_ENTRY(TAG, "tag"), |
1361 | .ctl_name = NET_IPV4_CONF_ACCEPT_REDIRECTS, | 1451 | DEVINET_SYSCTL_RW_ENTRY(ARPFILTER, "arp_filter"), |
1362 | .procname = "accept_redirects", | 1452 | DEVINET_SYSCTL_RW_ENTRY(ARP_ANNOUNCE, "arp_announce"), |
1363 | .data = &ipv4_devconf.accept_redirects, | 1453 | DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"), |
1364 | .maxlen = sizeof(int), | 1454 | DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"), |
1365 | .mode = 0644, | 1455 | |
1366 | .proc_handler = &proc_dointvec, | 1456 | DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"), |
1367 | }, | 1457 | DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"), |
1368 | { | 1458 | DEVINET_SYSCTL_FLUSHING_ENTRY(FORCE_IGMP_VERSION, |
1369 | .ctl_name = NET_IPV4_CONF_SECURE_REDIRECTS, | 1459 | "force_igmp_version"), |
1370 | .procname = "secure_redirects", | 1460 | DEVINET_SYSCTL_FLUSHING_ENTRY(PROMOTE_SECONDARIES, |
1371 | .data = &ipv4_devconf.secure_redirects, | 1461 | "promote_secondaries"), |
1372 | .maxlen = sizeof(int), | ||
1373 | .mode = 0644, | ||
1374 | .proc_handler = &proc_dointvec, | ||
1375 | }, | ||
1376 | { | ||
1377 | .ctl_name = NET_IPV4_CONF_SHARED_MEDIA, | ||
1378 | .procname = "shared_media", | ||
1379 | .data = &ipv4_devconf.shared_media, | ||
1380 | .maxlen = sizeof(int), | ||
1381 | .mode = 0644, | ||
1382 | .proc_handler = &proc_dointvec, | ||
1383 | }, | ||
1384 | { | ||
1385 | .ctl_name = NET_IPV4_CONF_RP_FILTER, | ||
1386 | .procname = "rp_filter", | ||
1387 | .data = &ipv4_devconf.rp_filter, | ||
1388 | .maxlen = sizeof(int), | ||
1389 | .mode = 0644, | ||
1390 | .proc_handler = &proc_dointvec, | ||
1391 | }, | ||
1392 | { | ||
1393 | .ctl_name = NET_IPV4_CONF_SEND_REDIRECTS, | ||
1394 | .procname = "send_redirects", | ||
1395 | .data = &ipv4_devconf.send_redirects, | ||
1396 | .maxlen = sizeof(int), | ||
1397 | .mode = 0644, | ||
1398 | .proc_handler = &proc_dointvec, | ||
1399 | }, | ||
1400 | { | ||
1401 | .ctl_name = NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, | ||
1402 | .procname = "accept_source_route", | ||
1403 | .data = &ipv4_devconf.accept_source_route, | ||
1404 | .maxlen = sizeof(int), | ||
1405 | .mode = 0644, | ||
1406 | .proc_handler = &proc_dointvec, | ||
1407 | }, | ||
1408 | { | ||
1409 | .ctl_name = NET_IPV4_CONF_PROXY_ARP, | ||
1410 | .procname = "proxy_arp", | ||
1411 | .data = &ipv4_devconf.proxy_arp, | ||
1412 | .maxlen = sizeof(int), | ||
1413 | .mode = 0644, | ||
1414 | .proc_handler = &proc_dointvec, | ||
1415 | }, | ||
1416 | { | ||
1417 | .ctl_name = NET_IPV4_CONF_MEDIUM_ID, | ||
1418 | .procname = "medium_id", | ||
1419 | .data = &ipv4_devconf.medium_id, | ||
1420 | .maxlen = sizeof(int), | ||
1421 | .mode = 0644, | ||
1422 | .proc_handler = &proc_dointvec, | ||
1423 | }, | ||
1424 | { | ||
1425 | .ctl_name = NET_IPV4_CONF_BOOTP_RELAY, | ||
1426 | .procname = "bootp_relay", | ||
1427 | .data = &ipv4_devconf.bootp_relay, | ||
1428 | .maxlen = sizeof(int), | ||
1429 | .mode = 0644, | ||
1430 | .proc_handler = &proc_dointvec, | ||
1431 | }, | ||
1432 | { | ||
1433 | .ctl_name = NET_IPV4_CONF_LOG_MARTIANS, | ||
1434 | .procname = "log_martians", | ||
1435 | .data = &ipv4_devconf.log_martians, | ||
1436 | .maxlen = sizeof(int), | ||
1437 | .mode = 0644, | ||
1438 | .proc_handler = &proc_dointvec, | ||
1439 | }, | ||
1440 | { | ||
1441 | .ctl_name = NET_IPV4_CONF_TAG, | ||
1442 | .procname = "tag", | ||
1443 | .data = &ipv4_devconf.tag, | ||
1444 | .maxlen = sizeof(int), | ||
1445 | .mode = 0644, | ||
1446 | .proc_handler = &proc_dointvec, | ||
1447 | }, | ||
1448 | { | ||
1449 | .ctl_name = NET_IPV4_CONF_ARPFILTER, | ||
1450 | .procname = "arp_filter", | ||
1451 | .data = &ipv4_devconf.arp_filter, | ||
1452 | .maxlen = sizeof(int), | ||
1453 | .mode = 0644, | ||
1454 | .proc_handler = &proc_dointvec, | ||
1455 | }, | ||
1456 | { | ||
1457 | .ctl_name = NET_IPV4_CONF_ARP_ANNOUNCE, | ||
1458 | .procname = "arp_announce", | ||
1459 | .data = &ipv4_devconf.arp_announce, | ||
1460 | .maxlen = sizeof(int), | ||
1461 | .mode = 0644, | ||
1462 | .proc_handler = &proc_dointvec, | ||
1463 | }, | ||
1464 | { | ||
1465 | .ctl_name = NET_IPV4_CONF_ARP_IGNORE, | ||
1466 | .procname = "arp_ignore", | ||
1467 | .data = &ipv4_devconf.arp_ignore, | ||
1468 | .maxlen = sizeof(int), | ||
1469 | .mode = 0644, | ||
1470 | .proc_handler = &proc_dointvec, | ||
1471 | }, | ||
1472 | { | ||
1473 | .ctl_name = NET_IPV4_CONF_ARP_ACCEPT, | ||
1474 | .procname = "arp_accept", | ||
1475 | .data = &ipv4_devconf.arp_accept, | ||
1476 | .maxlen = sizeof(int), | ||
1477 | .mode = 0644, | ||
1478 | .proc_handler = &proc_dointvec, | ||
1479 | }, | ||
1480 | { | ||
1481 | .ctl_name = NET_IPV4_CONF_NOXFRM, | ||
1482 | .procname = "disable_xfrm", | ||
1483 | .data = &ipv4_devconf.no_xfrm, | ||
1484 | .maxlen = sizeof(int), | ||
1485 | .mode = 0644, | ||
1486 | .proc_handler = &ipv4_doint_and_flush, | ||
1487 | .strategy = &ipv4_doint_and_flush_strategy, | ||
1488 | }, | ||
1489 | { | ||
1490 | .ctl_name = NET_IPV4_CONF_NOPOLICY, | ||
1491 | .procname = "disable_policy", | ||
1492 | .data = &ipv4_devconf.no_policy, | ||
1493 | .maxlen = sizeof(int), | ||
1494 | .mode = 0644, | ||
1495 | .proc_handler = &ipv4_doint_and_flush, | ||
1496 | .strategy = &ipv4_doint_and_flush_strategy, | ||
1497 | }, | ||
1498 | { | ||
1499 | .ctl_name = NET_IPV4_CONF_FORCE_IGMP_VERSION, | ||
1500 | .procname = "force_igmp_version", | ||
1501 | .data = &ipv4_devconf.force_igmp_version, | ||
1502 | .maxlen = sizeof(int), | ||
1503 | .mode = 0644, | ||
1504 | .proc_handler = &ipv4_doint_and_flush, | ||
1505 | .strategy = &ipv4_doint_and_flush_strategy, | ||
1506 | }, | ||
1507 | { | ||
1508 | .ctl_name = NET_IPV4_CONF_PROMOTE_SECONDARIES, | ||
1509 | .procname = "promote_secondaries", | ||
1510 | .data = &ipv4_devconf.promote_secondaries, | ||
1511 | .maxlen = sizeof(int), | ||
1512 | .mode = 0644, | ||
1513 | .proc_handler = &ipv4_doint_and_flush, | ||
1514 | .strategy = &ipv4_doint_and_flush_strategy, | ||
1515 | }, | ||
1516 | }, | 1462 | }, |
1517 | .devinet_dev = { | 1463 | .devinet_dev = { |
1518 | { | 1464 | { |
@@ -1561,6 +1507,7 @@ static void devinet_sysctl_register(struct in_device *in_dev, | |||
1561 | return; | 1507 | return; |
1562 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { | 1508 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { |
1563 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; | 1509 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; |
1510 | t->devinet_vars[i].extra1 = p; | ||
1564 | } | 1511 | } |
1565 | 1512 | ||
1566 | if (dev) { | 1513 | if (dev) { |