From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: fubar@us.ibm.com, bonding-devel@lists.sourceforge.net,
davem@davemloft.net, shemminger@linux-foundation.org,
kaber@trash.net
Subject: [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type
Date: Wed, 10 Mar 2010 21:30:19 +0100 [thread overview]
Message-ID: <20100310203019.GF2834@psychotron.redhat.com> (raw)
In-Reply-To: <20100310202804.GC2834@psychotron.redhat.com>
It's not desired for underlaying devices to change type. At the time, there is
for example possible to have bond with changed type from Ethernet to Infiniband
as a port of a bridge. This patch fixes this.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/macvlan.c | 3 +++
net/8021q/vlan.c | 4 ++++
net/bridge/br_notify.c | 4 ++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 40faa36..445e73c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused,
list_for_each_entry_safe(vlan, next, &port->vlans, list)
vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL);
break;
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
return NOTIFY_DONE;
}
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4535122..c39a5f4 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
}
unregister_netdevice_many(&list);
break;
+
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
out:
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 763a3ec..1413b72 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
case NETDEV_UNREGISTER:
br_del_if(br, dev);
break;
+
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
/* Events that may cause spanning tree to refresh */
--
1.6.6.1
next prev parent reply other threads:[~2010-03-10 20:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
2010-03-10 20:28 ` [net-next-2.6 PATCH 1/3] net: rename notifier defines for netdev type change Jiri Pirko
2010-03-10 20:29 ` [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type Jiri Pirko
2010-03-10 22:47 ` [Bonding-devel] " Stephen Hemminger
2010-03-11 7:59 ` Jiri Pirko
2010-03-11 9:53 ` Jiri Pirko
2010-03-10 20:30 ` Jiri Pirko [this message]
2010-03-10 21:04 ` [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type Jay Vosburgh
2010-03-10 21:17 ` Jiri Pirko
2010-03-19 3:05 ` [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 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=20100310203019.GF2834@psychotron.redhat.com \
--to=jpirko@redhat.com \
--cc=bonding-devel@lists.sourceforge.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.