diff options
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 415 |
1 files changed, 179 insertions, 236 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7f95e6e9beeb..abf6352f990f 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 | ||
@@ -321,12 +327,8 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | |||
321 | } | 327 | } |
322 | 328 | ||
323 | } | 329 | } |
324 | if (destroy) { | 330 | if (destroy) |
325 | inet_free_ifa(ifa1); | 331 | inet_free_ifa(ifa1); |
326 | |||
327 | if (!in_dev->ifa_list) | ||
328 | inetdev_destroy(in_dev); | ||
329 | } | ||
330 | } | 332 | } |
331 | 333 | ||
332 | static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | 334 | static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, |
@@ -399,12 +401,10 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) | |||
399 | ASSERT_RTNL(); | 401 | ASSERT_RTNL(); |
400 | 402 | ||
401 | if (!in_dev) { | 403 | if (!in_dev) { |
402 | in_dev = inetdev_init(dev); | 404 | inet_free_ifa(ifa); |
403 | if (!in_dev) { | 405 | return -ENOBUFS; |
404 | inet_free_ifa(ifa); | ||
405 | return -ENOBUFS; | ||
406 | } | ||
407 | } | 406 | } |
407 | ipv4_devconf_setall(in_dev); | ||
408 | if (ifa->ifa_dev != in_dev) { | 408 | if (ifa->ifa_dev != in_dev) { |
409 | BUG_TRAP(!ifa->ifa_dev); | 409 | BUG_TRAP(!ifa->ifa_dev); |
410 | in_dev_hold(in_dev); | 410 | in_dev_hold(in_dev); |
@@ -514,13 +514,12 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | |||
514 | 514 | ||
515 | in_dev = __in_dev_get_rtnl(dev); | 515 | in_dev = __in_dev_get_rtnl(dev); |
516 | if (in_dev == NULL) { | 516 | if (in_dev == NULL) { |
517 | in_dev = inetdev_init(dev); | 517 | err = -ENOBUFS; |
518 | if (in_dev == NULL) { | 518 | goto errout; |
519 | err = -ENOBUFS; | ||
520 | goto errout; | ||
521 | } | ||
522 | } | 519 | } |
523 | 520 | ||
521 | ipv4_devconf_setall(in_dev); | ||
522 | |||
524 | ifa = inet_alloc_ifa(); | 523 | ifa = inet_alloc_ifa(); |
525 | if (ifa == NULL) { | 524 | if (ifa == NULL) { |
526 | /* | 525 | /* |
@@ -1057,11 +1056,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1057 | if (!in_dev) { | 1056 | if (!in_dev) { |
1058 | if (event == NETDEV_REGISTER) { | 1057 | if (event == NETDEV_REGISTER) { |
1059 | in_dev = inetdev_init(dev); | 1058 | in_dev = inetdev_init(dev); |
1060 | if (!in_dev) | ||
1061 | panic("devinet: Failed to create loopback\n"); | ||
1062 | if (dev == &loopback_dev) { | 1059 | if (dev == &loopback_dev) { |
1063 | in_dev->cnf.no_xfrm = 1; | 1060 | if (!in_dev) |
1064 | in_dev->cnf.no_policy = 1; | 1061 | panic("devinet: " |
1062 | "Failed to create loopback\n"); | ||
1063 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | ||
1064 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | ||
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | goto out; | 1067 | goto out; |
@@ -1237,13 +1237,98 @@ errout: | |||
1237 | 1237 | ||
1238 | #ifdef CONFIG_SYSCTL | 1238 | #ifdef CONFIG_SYSCTL |
1239 | 1239 | ||
1240 | static void devinet_copy_dflt_conf(int i) | ||
1241 | { | ||
1242 | struct net_device *dev; | ||
1243 | |||
1244 | read_lock(&dev_base_lock); | ||
1245 | for_each_netdev(dev) { | ||
1246 | struct in_device *in_dev; | ||
1247 | rcu_read_lock(); | ||
1248 | in_dev = __in_dev_get_rcu(dev); | ||
1249 | if (in_dev && !test_bit(i, in_dev->cnf.state)) | ||
1250 | in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i]; | ||
1251 | rcu_read_unlock(); | ||
1252 | } | ||
1253 | read_unlock(&dev_base_lock); | ||
1254 | } | ||
1255 | |||
1256 | static int devinet_conf_proc(ctl_table *ctl, int write, | ||
1257 | struct file* filp, void __user *buffer, | ||
1258 | size_t *lenp, loff_t *ppos) | ||
1259 | { | ||
1260 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | ||
1261 | |||
1262 | if (write) { | ||
1263 | struct ipv4_devconf *cnf = ctl->extra1; | ||
1264 | int i = (int *)ctl->data - cnf->data; | ||
1265 | |||
1266 | set_bit(i, cnf->state); | ||
1267 | |||
1268 | if (cnf == &ipv4_devconf_dflt) | ||
1269 | devinet_copy_dflt_conf(i); | ||
1270 | } | ||
1271 | |||
1272 | return ret; | ||
1273 | } | ||
1274 | |||
1275 | static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, | ||
1276 | void __user *oldval, size_t __user *oldlenp, | ||
1277 | void __user *newval, size_t newlen) | ||
1278 | { | ||
1279 | struct ipv4_devconf *cnf; | ||
1280 | int *valp = table->data; | ||
1281 | int new; | ||
1282 | int i; | ||
1283 | |||
1284 | if (!newval || !newlen) | ||
1285 | return 0; | ||
1286 | |||
1287 | if (newlen != sizeof(int)) | ||
1288 | return -EINVAL; | ||
1289 | |||
1290 | if (get_user(new, (int __user *)newval)) | ||
1291 | return -EFAULT; | ||
1292 | |||
1293 | if (new == *valp) | ||
1294 | return 0; | ||
1295 | |||
1296 | if (oldval && oldlenp) { | ||
1297 | size_t len; | ||
1298 | |||
1299 | if (get_user(len, oldlenp)) | ||
1300 | return -EFAULT; | ||
1301 | |||
1302 | if (len) { | ||
1303 | if (len > table->maxlen) | ||
1304 | len = table->maxlen; | ||
1305 | if (copy_to_user(oldval, valp, len)) | ||
1306 | return -EFAULT; | ||
1307 | if (put_user(len, oldlenp)) | ||
1308 | return -EFAULT; | ||
1309 | } | ||
1310 | } | ||
1311 | |||
1312 | *valp = new; | ||
1313 | |||
1314 | cnf = table->extra1; | ||
1315 | i = (int *)table->data - cnf->data; | ||
1316 | |||
1317 | set_bit(i, cnf->state); | ||
1318 | |||
1319 | if (cnf == &ipv4_devconf_dflt) | ||
1320 | devinet_copy_dflt_conf(i); | ||
1321 | |||
1322 | return 1; | ||
1323 | } | ||
1324 | |||
1240 | void inet_forward_change(void) | 1325 | void inet_forward_change(void) |
1241 | { | 1326 | { |
1242 | struct net_device *dev; | 1327 | struct net_device *dev; |
1243 | int on = ipv4_devconf.forwarding; | 1328 | int on = IPV4_DEVCONF_ALL(FORWARDING); |
1244 | 1329 | ||
1245 | ipv4_devconf.accept_redirects = !on; | 1330 | IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on; |
1246 | ipv4_devconf_dflt.forwarding = on; | 1331 | IPV4_DEVCONF_DFLT(FORWARDING) = on; |
1247 | 1332 | ||
1248 | read_lock(&dev_base_lock); | 1333 | read_lock(&dev_base_lock); |
1249 | for_each_netdev(dev) { | 1334 | for_each_netdev(dev) { |
@@ -1251,7 +1336,7 @@ void inet_forward_change(void) | |||
1251 | rcu_read_lock(); | 1336 | rcu_read_lock(); |
1252 | in_dev = __in_dev_get_rcu(dev); | 1337 | in_dev = __in_dev_get_rcu(dev); |
1253 | if (in_dev) | 1338 | if (in_dev) |
1254 | in_dev->cnf.forwarding = on; | 1339 | IN_DEV_CONF_SET(in_dev, FORWARDING, on); |
1255 | rcu_read_unlock(); | 1340 | rcu_read_unlock(); |
1256 | } | 1341 | } |
1257 | read_unlock(&dev_base_lock); | 1342 | read_unlock(&dev_base_lock); |
@@ -1268,9 +1353,9 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1268 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1353 | int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); |
1269 | 1354 | ||
1270 | if (write && *valp != val) { | 1355 | if (write && *valp != val) { |
1271 | if (valp == &ipv4_devconf.forwarding) | 1356 | if (valp == &IPV4_DEVCONF_ALL(FORWARDING)) |
1272 | inet_forward_change(); | 1357 | inet_forward_change(); |
1273 | else if (valp != &ipv4_devconf_dflt.forwarding) | 1358 | else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING)) |
1274 | rt_cache_flush(0); | 1359 | rt_cache_flush(0); |
1275 | } | 1360 | } |
1276 | 1361 | ||
@@ -1295,42 +1380,43 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, | |||
1295 | void __user *oldval, size_t __user *oldlenp, | 1380 | void __user *oldval, size_t __user *oldlenp, |
1296 | void __user *newval, size_t newlen) | 1381 | void __user *newval, size_t newlen) |
1297 | { | 1382 | { |
1298 | int *valp = table->data; | 1383 | int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, |
1299 | int new; | 1384 | newval, newlen); |
1300 | 1385 | ||
1301 | if (!newval || !newlen) | 1386 | if (ret == 1) |
1302 | return 0; | 1387 | rt_cache_flush(0); |
1303 | 1388 | ||
1304 | if (newlen != sizeof(int)) | 1389 | return ret; |
1305 | return -EINVAL; | 1390 | } |
1306 | 1391 | ||
1307 | if (get_user(new, (int __user *)newval)) | ||
1308 | return -EFAULT; | ||
1309 | 1392 | ||
1310 | if (new == *valp) | 1393 | #define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc, sysctl) \ |
1311 | return 0; | 1394 | { \ |
1395 | .ctl_name = NET_IPV4_CONF_ ## attr, \ | ||
1396 | .procname = name, \ | ||
1397 | .data = ipv4_devconf.data + \ | ||
1398 | NET_IPV4_CONF_ ## attr - 1, \ | ||
1399 | .maxlen = sizeof(int), \ | ||
1400 | .mode = mval, \ | ||
1401 | .proc_handler = proc, \ | ||
1402 | .strategy = sysctl, \ | ||
1403 | .extra1 = &ipv4_devconf, \ | ||
1404 | } | ||
1312 | 1405 | ||
1313 | if (oldval && oldlenp) { | 1406 | #define DEVINET_SYSCTL_RW_ENTRY(attr, name) \ |
1314 | size_t len; | 1407 | DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc, \ |
1408 | devinet_conf_sysctl) | ||
1315 | 1409 | ||
1316 | if (get_user(len, oldlenp)) | 1410 | #define DEVINET_SYSCTL_RO_ENTRY(attr, name) \ |
1317 | return -EFAULT; | 1411 | DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc, \ |
1412 | devinet_conf_sysctl) | ||
1318 | 1413 | ||
1319 | if (len) { | 1414 | #define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc, sysctl) \ |
1320 | if (len > table->maxlen) | 1415 | 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 | 1416 | ||
1417 | #define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \ | ||
1418 | DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush, \ | ||
1419 | ipv4_doint_and_flush_strategy) | ||
1334 | 1420 | ||
1335 | static struct devinet_sysctl_table { | 1421 | static struct devinet_sysctl_table { |
1336 | struct ctl_table_header *sysctl_header; | 1422 | struct ctl_table_header *sysctl_header; |
@@ -1341,178 +1427,34 @@ static struct devinet_sysctl_table { | |||
1341 | ctl_table devinet_root_dir[2]; | 1427 | ctl_table devinet_root_dir[2]; |
1342 | } devinet_sysctl = { | 1428 | } devinet_sysctl = { |
1343 | .devinet_vars = { | 1429 | .devinet_vars = { |
1344 | { | 1430 | DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding", |
1345 | .ctl_name = NET_IPV4_CONF_FORWARDING, | 1431 | devinet_sysctl_forward, |
1346 | .procname = "forwarding", | 1432 | devinet_conf_sysctl), |
1347 | .data = &ipv4_devconf.forwarding, | 1433 | DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"), |
1348 | .maxlen = sizeof(int), | 1434 | |
1349 | .mode = 0644, | 1435 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"), |
1350 | .proc_handler = &devinet_sysctl_forward, | 1436 | DEVINET_SYSCTL_RW_ENTRY(SECURE_REDIRECTS, "secure_redirects"), |
1351 | }, | 1437 | DEVINET_SYSCTL_RW_ENTRY(SHARED_MEDIA, "shared_media"), |
1352 | { | 1438 | DEVINET_SYSCTL_RW_ENTRY(RP_FILTER, "rp_filter"), |
1353 | .ctl_name = NET_IPV4_CONF_MC_FORWARDING, | 1439 | DEVINET_SYSCTL_RW_ENTRY(SEND_REDIRECTS, "send_redirects"), |
1354 | .procname = "mc_forwarding", | 1440 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE, |
1355 | .data = &ipv4_devconf.mc_forwarding, | 1441 | "accept_source_route"), |
1356 | .maxlen = sizeof(int), | 1442 | DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"), |
1357 | .mode = 0444, | 1443 | DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"), |
1358 | .proc_handler = &proc_dointvec, | 1444 | DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"), |
1359 | }, | 1445 | DEVINET_SYSCTL_RW_ENTRY(LOG_MARTIANS, "log_martians"), |
1360 | { | 1446 | DEVINET_SYSCTL_RW_ENTRY(TAG, "tag"), |
1361 | .ctl_name = NET_IPV4_CONF_ACCEPT_REDIRECTS, | 1447 | DEVINET_SYSCTL_RW_ENTRY(ARPFILTER, "arp_filter"), |
1362 | .procname = "accept_redirects", | 1448 | DEVINET_SYSCTL_RW_ENTRY(ARP_ANNOUNCE, "arp_announce"), |
1363 | .data = &ipv4_devconf.accept_redirects, | 1449 | DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"), |
1364 | .maxlen = sizeof(int), | 1450 | DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"), |
1365 | .mode = 0644, | 1451 | |
1366 | .proc_handler = &proc_dointvec, | 1452 | DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"), |
1367 | }, | 1453 | DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"), |
1368 | { | 1454 | DEVINET_SYSCTL_FLUSHING_ENTRY(FORCE_IGMP_VERSION, |
1369 | .ctl_name = NET_IPV4_CONF_SECURE_REDIRECTS, | 1455 | "force_igmp_version"), |
1370 | .procname = "secure_redirects", | 1456 | DEVINET_SYSCTL_FLUSHING_ENTRY(PROMOTE_SECONDARIES, |
1371 | .data = &ipv4_devconf.secure_redirects, | 1457 | "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 | }, | 1458 | }, |
1517 | .devinet_dev = { | 1459 | .devinet_dev = { |
1518 | { | 1460 | { |
@@ -1561,6 +1503,7 @@ static void devinet_sysctl_register(struct in_device *in_dev, | |||
1561 | return; | 1503 | return; |
1562 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { | 1504 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { |
1563 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; | 1505 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; |
1506 | t->devinet_vars[i].extra1 = p; | ||
1564 | } | 1507 | } |
1565 | 1508 | ||
1566 | if (dev) { | 1509 | if (dev) { |