From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, devel@openvz.org,
containers@lists.osdl.org, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 7/17] [NETNS]: Disable multicaststing configuration inside namespace.
Date: Wed, 6 Feb 2008 13:53:27 +0300 [thread overview]
Message-ID: <1202295217-22769-7-git-send-email-den@openvz.org> (raw)
In-Reply-To: <47A99196.2030105@sw.ru>
Do not calls hooks from device notifiers and disallow configuration from
ioctl/netlink layer.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv4/igmp.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 994648b..fe2e6cd 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1199,6 +1199,9 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
for (im=in_dev->mc_list; im; im=im->next) {
if (im->multiaddr == addr) {
im->users++;
@@ -1278,6 +1281,9 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
if (i->multiaddr==addr) {
if (--i->users == 0) {
@@ -1305,6 +1311,9 @@ void ip_mc_down(struct in_device *in_dev)
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
for (i=in_dev->mc_list; i; i=i->next)
igmp_group_dropped(i);
@@ -1325,6 +1334,9 @@ void ip_mc_init_dev(struct in_device *in_dev)
{
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
in_dev->mc_tomb = NULL;
#ifdef CONFIG_IP_MULTICAST
in_dev->mr_gq_running = 0;
@@ -1348,6 +1360,9 @@ void ip_mc_up(struct in_device *in_dev)
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
for (i=in_dev->mc_list; i; i=i->next)
@@ -1364,6 +1379,9 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
ASSERT_RTNL();
+ if (in_dev->dev->nd_net != &init_net)
+ return;
+
/* Deactivate timers */
ip_mc_down(in_dev);
@@ -1745,6 +1763,9 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
if (!ipv4_is_multicast(addr))
return -EINVAL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
in_dev = ip_mc_find_dev(imr);
@@ -1813,6 +1834,9 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
u32 ifindex;
int ret = -EADDRNOTAVAIL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
in_dev = ip_mc_find_dev(imr);
ifindex = imr->imr_ifindex;
@@ -1858,6 +1882,9 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
if (!ipv4_is_multicast(addr))
return -EINVAL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
imr.imr_multiaddr.s_addr = mreqs->imr_multiaddr;
@@ -1991,6 +2018,9 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
msf->imsf_fmode != MCAST_EXCLUDE)
return -EINVAL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
imr.imr_multiaddr.s_addr = msf->imsf_multiaddr;
@@ -2071,6 +2101,9 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
if (!ipv4_is_multicast(addr))
return -EINVAL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
imr.imr_multiaddr.s_addr = msf->imsf_multiaddr;
@@ -2133,6 +2166,9 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
if (!ipv4_is_multicast(addr))
return -EINVAL;
+ if (sk->sk_net != &init_net)
+ return -EPROTONOSUPPORT;
+
rtnl_lock();
err = -EADDRNOTAVAIL;
@@ -2217,6 +2253,9 @@ void ip_mc_drop_socket(struct sock *sk)
if (inet->mc_list == NULL)
return;
+ if (sk->sk_net != &init_net)
+ return;
+
rtnl_lock();
while ((iml = inet->mc_list) != NULL) {
struct in_device *in_dev;
--
1.5.3.rc5
next prev parent reply other threads:[~2008-02-06 10:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 10:53 [PATCH 0/17] Finish IPv4 infrastructure namespacing Denis V. Lunev
2008-02-06 10:53 ` [PATCH 1/17] [IPV4]: Remove ifa != NULL check Denis V. Lunev
2008-02-06 10:53 ` [PATCH 2/17] [IPV4]: Remove check for ifa->ifa_dev != NULL Denis V. Lunev
2008-02-06 10:53 ` [PATCH 3/17] [IPV4]: Consolidate masq_inet_event and masq_device_event Denis V. Lunev
2008-02-06 10:53 ` [PATCH 4/17] [NETNS]: Disable address notifiers in namespaces other than initial Denis V. Lunev
2008-02-06 10:53 ` [PATCH 5/17] [NETNS]: Register neighbour parameters of the net device in the correct namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 6/17] [NETNS]: Default arp parameters lookup Denis V. Lunev
2008-02-06 10:53 ` Denis V. Lunev [this message]
2008-02-06 10:53 ` [PATCH 8/17] [NETNS]: Enable inetdev_event notifier Denis V. Lunev
2008-02-06 10:53 ` [PATCH 9/17] [NETNS]: DST cleanup routines should be called inside namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 10/17] [NETNS]: Process ip_rt_redirect in the correct namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 11/17] [IPV4]: rt_cache_get_next should take rt_genid into account Denis V. Lunev
2008-02-06 10:53 ` [PATCH 12/17] [NETNS]: Process /proc/net/rt_cache inside a namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 13/17] [NETNS]: Register /proc/net/rt_cache for each namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 14/17] [NETNS]: Process devinet ioctl in the correct namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 15/17] [NETNS]: Enable all routing manipulation via netlink inside namespace Denis V. Lunev
2008-02-06 10:53 ` [PATCH 16/17] [NETNS]: Enable IPv4 address manipulations " Denis V. Lunev
2008-02-06 10:53 ` [PATCH 17/17] [NETNS]: Process inet_select_addr inside a namespace Denis V. Lunev
2008-02-06 11:27 ` [PATCH 0/17] Finish IPv4 infrastructure namespacing David Miller
2008-02-06 11:34 ` Denis V. Lunev
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=1202295217-22769-7-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=netdev@vger.kernel.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).