From: Tom Gundersen <teg@jklm.no>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
linux-kernel@vger.kernel.org, Tom Gundersen <teg@jklm.no>,
Patrick McHardy <kaber@trash.net>
Subject: [PATCH v8] net: vlan - set name assign type
Date: Thu, 17 Jul 2014 00:43:11 +0200 [thread overview]
Message-ID: <1405550594-11786-4-git-send-email-teg@jklm.no> (raw)
In-Reply-To: <1405550594-11786-1-git-send-email-teg@jklm.no>
When deriving the name from the real device, inherit the assign type, otherwise
set PREDICTABLE as the name will be uniquely determined by the VLANID.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Cc: Patrick McHardy <kaber@trash.net>
---
This patch goes on top of net-next.
net/8021q/vlan.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index cba9c21..cf88f7b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -212,6 +212,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
{
struct net_device *new_dev;
struct vlan_dev_priv *vlan;
+ unsigned char name_assign_type;
struct net *net = dev_net(real_dev);
struct vlan_net *vn = net_generic(net, vlan_net_id);
char name[IFNAMSIZ];
@@ -229,18 +230,21 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
case VLAN_NAME_TYPE_RAW_PLUS_VID:
/* name will look like: eth1.0005 */
snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, vlan_id);
+ name_assign_type = real_dev->name_assign_type;
break;
case VLAN_NAME_TYPE_PLUS_VID_NO_PAD:
/* Put our vlan.VID in the name.
* Name will look like: vlan5
*/
snprintf(name, IFNAMSIZ, "vlan%i", vlan_id);
+ name_assign_type = NET_NAME_PREDICTABLE;
break;
case VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD:
/* Put our vlan.VID in the name.
* Name will look like: eth0.5
*/
snprintf(name, IFNAMSIZ, "%s.%i", real_dev->name, vlan_id);
+ name_assign_type = real_dev->name_assign_type;
break;
case VLAN_NAME_TYPE_PLUS_VID:
/* Put our vlan.VID in the name.
@@ -248,10 +252,11 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
*/
default:
snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id);
+ name_assign_type = NET_NAME_PREDICTABLE;
}
new_dev = alloc_netdev(sizeof(struct vlan_dev_priv), name,
- NET_NAME_UNKNOWN, vlan_setup);
+ name_assign_type, vlan_setup);
if (new_dev == NULL)
return -ENOBUFS;
--
1.9.3
next prev parent reply other threads:[~2014-07-16 22:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 22:43 [PATCH v8] net: set name assign type for names assigned using a static string Tom Gundersen
2014-07-16 22:43 ` [PATCH v8] net: isdn - set name assign type Tom Gundersen
2014-07-16 22:43 ` [PATCH v8] net: openvswitch " Tom Gundersen
2014-07-16 23:00 ` Pravin Shelar
2014-07-16 23:16 ` Tom Gundersen
2014-07-16 23:24 ` Pravin Shelar
2014-07-16 22:43 ` Tom Gundersen [this message]
2014-07-16 22:43 ` [PATCH v8] net: nl80211 - make rdev_add_virtual_intf take name_assign_type Tom Gundersen
2014-07-16 22:43 ` [PATCH v8] net: nl802154 - make add_iface take name assign type Tom Gundersen
2014-07-16 22:43 ` [PATCH v8] net: ppp - set " Tom Gundersen
2014-07-17 6:56 ` [PATCH v8] net: set name assign type for names assigned using a static string David Miller
2014-07-17 7:17 ` Tom Gundersen
2014-07-17 7:26 ` Veaceslav Falico
2014-07-17 7:36 ` Tom Gundersen
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=1405550594-11786-4-git-send-email-teg@jklm.no \
--to=teg@jklm.no \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®