diff options
author | Benjamin Thery <benjamin.thery@bull.net> | 2008-12-10 19:28:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-10 19:28:44 -0500 |
commit | a21f3f997c73ced682129aedd372bb6b53041510 (patch) | |
tree | f236a2ef74036df4929f99350316096c6603a3ae /net | |
parent | 4045e57c19bee150370390545ee8a933b3f7a18d (diff) |
netns: ip6mr: declare mroute_do_assert and mroute_do_pim per-namespace
Preliminary work to make IPv6 multicast forwarding netns-aware.
Declare IPv6 multicast forwarding variables 'mroute_do_assert' and
'mroute_do_pim' per-namespace in struct netns_ipv6.
At the moment, these variables are only referenced in init_net.
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6mr.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 077c8198eb53..2d2ac23b8606 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -61,13 +61,6 @@ static DEFINE_RWLOCK(mrt_lock); | |||
61 | 61 | ||
62 | #define MIF_EXISTS(_net, _idx) ((_net)->ipv6.vif6_table[_idx].dev != NULL) | 62 | #define MIF_EXISTS(_net, _idx) ((_net)->ipv6.vif6_table[_idx].dev != NULL) |
63 | 63 | ||
64 | static int mroute_do_assert; /* Set in PIM assert */ | ||
65 | #ifdef CONFIG_IPV6_PIMSM_V2 | ||
66 | static int mroute_do_pim; | ||
67 | #else | ||
68 | #define mroute_do_pim 0 | ||
69 | #endif | ||
70 | |||
71 | static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */ | 64 | static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */ |
72 | 65 | ||
73 | /* Special spinlock for queue of unresolved entries */ | 66 | /* Special spinlock for queue of unresolved entries */ |
@@ -1306,7 +1299,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int | |||
1306 | int v; | 1299 | int v; |
1307 | if (get_user(v, (int __user *)optval)) | 1300 | if (get_user(v, (int __user *)optval)) |
1308 | return -EFAULT; | 1301 | return -EFAULT; |
1309 | mroute_do_assert = !!v; | 1302 | init_net.ipv6.mroute_do_assert = !!v; |
1310 | return 0; | 1303 | return 0; |
1311 | } | 1304 | } |
1312 | 1305 | ||
@@ -1319,10 +1312,10 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int | |||
1319 | v = !!v; | 1312 | v = !!v; |
1320 | rtnl_lock(); | 1313 | rtnl_lock(); |
1321 | ret = 0; | 1314 | ret = 0; |
1322 | if (v != mroute_do_pim) { | 1315 | if (v != init_net.ipv6.mroute_do_pim) { |
1323 | mroute_do_pim = v; | 1316 | init_net.ipv6.mroute_do_pim = v; |
1324 | mroute_do_assert = v; | 1317 | init_net.ipv6.mroute_do_assert = v; |
1325 | if (mroute_do_pim) | 1318 | if (init_net.ipv6.mroute_do_pim) |
1326 | ret = inet6_add_protocol(&pim6_protocol, | 1319 | ret = inet6_add_protocol(&pim6_protocol, |
1327 | IPPROTO_PIM); | 1320 | IPPROTO_PIM); |
1328 | else | 1321 | else |
@@ -1361,11 +1354,11 @@ int ip6_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, | |||
1361 | break; | 1354 | break; |
1362 | #ifdef CONFIG_IPV6_PIMSM_V2 | 1355 | #ifdef CONFIG_IPV6_PIMSM_V2 |
1363 | case MRT6_PIM: | 1356 | case MRT6_PIM: |
1364 | val = mroute_do_pim; | 1357 | val = init_net.ipv6.mroute_do_pim; |
1365 | break; | 1358 | break; |
1366 | #endif | 1359 | #endif |
1367 | case MRT6_ASSERT: | 1360 | case MRT6_ASSERT: |
1368 | val = mroute_do_assert; | 1361 | val = init_net.ipv6.mroute_do_assert; |
1369 | break; | 1362 | break; |
1370 | default: | 1363 | default: |
1371 | return -ENOPROTOOPT; | 1364 | return -ENOPROTOOPT; |
@@ -1553,13 +1546,14 @@ static int ip6_mr_forward(struct sk_buff *skb, struct mfc6_cache *cache) | |||
1553 | cache->mfc_un.res.wrong_if++; | 1546 | cache->mfc_un.res.wrong_if++; |
1554 | true_vifi = ip6mr_find_vif(skb->dev); | 1547 | true_vifi = ip6mr_find_vif(skb->dev); |
1555 | 1548 | ||
1556 | if (true_vifi >= 0 && mroute_do_assert && | 1549 | if (true_vifi >= 0 && init_net.ipv6.mroute_do_assert && |
1557 | /* pimsm uses asserts, when switching from RPT to SPT, | 1550 | /* pimsm uses asserts, when switching from RPT to SPT, |
1558 | so that we cannot check that packet arrived on an oif. | 1551 | so that we cannot check that packet arrived on an oif. |
1559 | It is bad, but otherwise we would need to move pretty | 1552 | It is bad, but otherwise we would need to move pretty |
1560 | large chunk of pimd to kernel. Ough... --ANK | 1553 | large chunk of pimd to kernel. Ough... --ANK |
1561 | */ | 1554 | */ |
1562 | (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && | 1555 | (init_net.ipv6.mroute_do_pim || |
1556 | cache->mfc_un.res.ttls[true_vifi] < 255) && | ||
1563 | time_after(jiffies, | 1557 | time_after(jiffies, |
1564 | cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { | 1558 | cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { |
1565 | cache->mfc_un.res.last_assert = jiffies; | 1559 | cache->mfc_un.res.last_assert = jiffies; |