From: Benjamin Thery <benjamin.thery@bull.net>
To: Dave Miller <davem@davemloft.net>,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: netdev <netdev@vger.kernel.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
Daniel Lezcano <dlezcano@fr.ibm.com>,
Benjamin Thery <benjamin.thery@bull.net>
Subject: [PATCH 4/8] netns: ip6mr: Declare mroute_do_assert and mroute_do_pim per-namespace
Date: Mon, 08 Dec 2008 17:02:00 +0100 [thread overview]
Message-ID: <20081208160157.354650339@localhost.localdomain> (raw)
In-Reply-To: 20081208160156.343758157@localhost.localdomain
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>
---
include/net/netns/ipv6.h | 2 ++
net/ipv6/ip6mr.c | 26 ++++++++++----------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 14c1bbe..b17e522 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -60,6 +60,8 @@ struct netns_ipv6 {
struct mfc6_cache **mfc6_cache_array;
struct mif_device *vif6_table;
int maxvif;
+ int mroute_do_assert;
+ int mroute_do_pim;
#endif
};
#endif
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 565e81e..94a3133 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -61,13 +61,6 @@ static DEFINE_RWLOCK(mrt_lock);
#define MIF_EXISTS(_net, _idx) ((_net)->ipv6.vif6_table[_idx].dev != NULL)
-static int mroute_do_assert; /* Set in PIM assert */
-#ifdef CONFIG_IPV6_PIMSM_V2
-static int mroute_do_pim;
-#else
-#define mroute_do_pim 0
-#endif
-
static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */
static atomic_t cache_resolve_queue_len; /* Size of unresolved */
@@ -1296,7 +1289,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
int v;
if (get_user(v, (int __user *)optval))
return -EFAULT;
- mroute_do_assert = !!v;
+ init_net.ipv6.mroute_do_assert = !!v;
return 0;
}
@@ -1309,10 +1302,10 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
v = !!v;
rtnl_lock();
ret = 0;
- if (v != mroute_do_pim) {
- mroute_do_pim = v;
- mroute_do_assert = v;
- if (mroute_do_pim)
+ if (v != init_net.ipv6.mroute_do_pim) {
+ init_net.ipv6.mroute_do_pim = v;
+ init_net.ipv6.mroute_do_assert = v;
+ if (init_net.ipv6.mroute_do_pim)
ret = inet6_add_protocol(&pim6_protocol,
IPPROTO_PIM);
else
@@ -1351,11 +1344,11 @@ int ip6_mroute_getsockopt(struct sock *sk, int optname, char __user *optval,
break;
#ifdef CONFIG_IPV6_PIMSM_V2
case MRT6_PIM:
- val = mroute_do_pim;
+ val = init_net.ipv6.mroute_do_pim;
break;
#endif
case MRT6_ASSERT:
- val = mroute_do_assert;
+ val = init_net.ipv6.mroute_do_assert;
break;
default:
return -ENOPROTOOPT;
@@ -1543,13 +1536,14 @@ static int ip6_mr_forward(struct sk_buff *skb, struct mfc6_cache *cache)
cache->mfc_un.res.wrong_if++;
true_vifi = ip6mr_find_vif(skb->dev);
- if (true_vifi >= 0 && mroute_do_assert &&
+ if (true_vifi >= 0 && init_net.ipv6.mroute_do_assert &&
/* pimsm uses asserts, when switching from RPT to SPT,
so that we cannot check that packet arrived on an oif.
It is bad, but otherwise we would need to move pretty
large chunk of pimd to kernel. Ough... --ANK
*/
- (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) &&
+ (init_net.ipv6.mroute_do_pim ||
+ cache->mfc_un.res.ttls[true_vifi] < 255) &&
time_after(jiffies,
cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) {
cache->mfc_un.res.last_assert = jiffies;
next prev parent reply other threads:[~2008-12-08 16:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-08 16:01 [PATCH 0/8] netns: make IPv6 multicast forwarding per-namespace Benjamin Thery
2008-12-08 16:01 ` [PATCH 1/8] netns: ip6mr: allocate mroute6_socket per-namespace Benjamin Thery
2008-12-08 16:01 ` [PATCH 2/8] netns: ip6mr: dynamically allocates vif6_table Benjamin Thery
2008-12-08 16:01 ` [PATCH 3/8] netns: ip6mr: Dynamically allocates mfc6_cache_array Benjamin Thery
2008-12-08 16:02 ` Benjamin Thery [this message]
2008-12-08 16:02 ` [PATCH 5/8] netns: ip6mr: store netns in struct mfc6_cache Benjamin Thery
2008-12-08 16:02 ` [PATCH 6/8] netns: ip6mr: declare reg_vif_num per-namespace Benjamin Thery
2008-12-08 16:02 ` [PATCH 7/8] netns: ip6mr: declare ip6mr /proc/net entries per-namespace Benjamin Thery
2008-12-08 16:02 ` [PATCH 8/8] ipv6: netns: enable namespace support in ipv6 multicast forwarding code Benjamin Thery
2008-12-09 16:56 ` [PATCH 0/8] netns: make IPv6 multicast forwarding per-namespace Benjamin Thery
2008-12-09 23:53 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081208160157.354650339@localhost.localdomain \
--to=benjamin.thery@bull.net \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=dlezcano@fr.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).