diff options
author | Benjamin Thery <benjamin.thery@bull.net> | 2009-01-21 23:56:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-22 16:57:40 -0500 |
commit | 6f9374a9342e896c68df7cf7c0b039ab5cca994c (patch) | |
tree | ba03b8e9e70b0ae5f581444afb9a9ae43e579091 | |
parent | 1e8fb3b6a4ac6c5e486298d88289038456957545 (diff) |
netns: ipmr: declare mroute_do_assert and mroute_do_pim per-namespace
Preliminary work to make IPv4 multicast routing netns-aware.
Declare IPv multicast routing variables 'mroute_do_assert' and
'mroute_do_pim' per-namespace in struct netns_ipv4.
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>
-rw-r--r-- | include/net/netns/ipv4.h | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 90b7cd20aa69..8451722782bb 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -61,6 +61,8 @@ struct netns_ipv4 { | |||
61 | struct vif_device *vif_table; | 61 | struct vif_device *vif_table; |
62 | int maxvif; | 62 | int maxvif; |
63 | atomic_t cache_resolve_queue_len; | 63 | atomic_t cache_resolve_queue_len; |
64 | int mroute_do_assert; | ||
65 | int mroute_do_pim; | ||
64 | #endif | 66 | #endif |
65 | }; | 67 | }; |
66 | #endif | 68 | #endif |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index feafd14eb7b9..d6a28acc0683 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -79,9 +79,6 @@ static DEFINE_RWLOCK(mrt_lock); | |||
79 | 79 | ||
80 | #define VIF_EXISTS(_net, _idx) ((_net)->ipv4.vif_table[_idx].dev != NULL) | 80 | #define VIF_EXISTS(_net, _idx) ((_net)->ipv4.vif_table[_idx].dev != NULL) |
81 | 81 | ||
82 | static int mroute_do_assert; /* Set in PIM assert */ | ||
83 | static int mroute_do_pim; | ||
84 | |||
85 | static struct mfc_cache *mfc_unres_queue; /* Queue of unresolved entries */ | 82 | static struct mfc_cache *mfc_unres_queue; /* Queue of unresolved entries */ |
86 | 83 | ||
87 | /* Special spinlock for queue of unresolved entries */ | 84 | /* Special spinlock for queue of unresolved entries */ |
@@ -1003,7 +1000,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int | |||
1003 | int v; | 1000 | int v; |
1004 | if (get_user(v,(int __user *)optval)) | 1001 | if (get_user(v,(int __user *)optval)) |
1005 | return -EFAULT; | 1002 | return -EFAULT; |
1006 | mroute_do_assert=(v)?1:0; | 1003 | init_net.ipv4.mroute_do_assert = (v) ? 1 : 0; |
1007 | return 0; | 1004 | return 0; |
1008 | } | 1005 | } |
1009 | #ifdef CONFIG_IP_PIMSM | 1006 | #ifdef CONFIG_IP_PIMSM |
@@ -1017,11 +1014,11 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int | |||
1017 | 1014 | ||
1018 | rtnl_lock(); | 1015 | rtnl_lock(); |
1019 | ret = 0; | 1016 | ret = 0; |
1020 | if (v != mroute_do_pim) { | 1017 | if (v != init_net.ipv4.mroute_do_pim) { |
1021 | mroute_do_pim = v; | 1018 | init_net.ipv4.mroute_do_pim = v; |
1022 | mroute_do_assert = v; | 1019 | init_net.ipv4.mroute_do_assert = v; |
1023 | #ifdef CONFIG_IP_PIMSM_V2 | 1020 | #ifdef CONFIG_IP_PIMSM_V2 |
1024 | if (mroute_do_pim) | 1021 | if (init_net.ipv4.mroute_do_pim) |
1025 | ret = inet_add_protocol(&pim_protocol, | 1022 | ret = inet_add_protocol(&pim_protocol, |
1026 | IPPROTO_PIM); | 1023 | IPPROTO_PIM); |
1027 | else | 1024 | else |
@@ -1073,10 +1070,10 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int | |||
1073 | val = 0x0305; | 1070 | val = 0x0305; |
1074 | #ifdef CONFIG_IP_PIMSM | 1071 | #ifdef CONFIG_IP_PIMSM |
1075 | else if (optname == MRT_PIM) | 1072 | else if (optname == MRT_PIM) |
1076 | val = mroute_do_pim; | 1073 | val = init_net.ipv4.mroute_do_pim; |
1077 | #endif | 1074 | #endif |
1078 | else | 1075 | else |
1079 | val = mroute_do_assert; | 1076 | val = init_net.ipv4.mroute_do_assert; |
1080 | if (copy_to_user(optval, &val, olr)) | 1077 | if (copy_to_user(optval, &val, olr)) |
1081 | return -EFAULT; | 1078 | return -EFAULT; |
1082 | return 0; | 1079 | return 0; |
@@ -1356,13 +1353,14 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local | |||
1356 | cache->mfc_un.res.wrong_if++; | 1353 | cache->mfc_un.res.wrong_if++; |
1357 | true_vifi = ipmr_find_vif(skb->dev); | 1354 | true_vifi = ipmr_find_vif(skb->dev); |
1358 | 1355 | ||
1359 | if (true_vifi >= 0 && mroute_do_assert && | 1356 | if (true_vifi >= 0 && init_net.ipv4.mroute_do_assert && |
1360 | /* pimsm uses asserts, when switching from RPT to SPT, | 1357 | /* pimsm uses asserts, when switching from RPT to SPT, |
1361 | so that we cannot check that packet arrived on an oif. | 1358 | so that we cannot check that packet arrived on an oif. |
1362 | It is bad, but otherwise we would need to move pretty | 1359 | It is bad, but otherwise we would need to move pretty |
1363 | large chunk of pimd to kernel. Ough... --ANK | 1360 | large chunk of pimd to kernel. Ough... --ANK |
1364 | */ | 1361 | */ |
1365 | (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && | 1362 | (init_net.ipv4.mroute_do_pim || |
1363 | cache->mfc_un.res.ttls[true_vifi] < 255) && | ||
1366 | time_after(jiffies, | 1364 | time_after(jiffies, |
1367 | cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { | 1365 | cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { |
1368 | cache->mfc_un.res.last_assert = jiffies; | 1366 | cache->mfc_un.res.last_assert = jiffies; |
@@ -1550,7 +1548,7 @@ int pim_rcv_v1(struct sk_buff * skb) | |||
1550 | 1548 | ||
1551 | pim = igmp_hdr(skb); | 1549 | pim = igmp_hdr(skb); |
1552 | 1550 | ||
1553 | if (!mroute_do_pim || | 1551 | if (!init_net.ipv4.mroute_do_pim || |
1554 | pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) | 1552 | pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) |
1555 | goto drop; | 1553 | goto drop; |
1556 | 1554 | ||