[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <86924b2059b7460b8998fac46f0d7262d7c358d4.1497621810.git.serhe.popovych@gmail.com>
Date: Fri, 16 Jun 2017 17:23:53 +0300
From: Serhey Popovych <serhe.popovych@...il.com>
To: netdev@...r.kernel.org
Subject: [PATCH 3/3] veth: Set ifindex only if given and not negative
There is already check for ifindex being non negative in
register_netdevice(). Do the same here for convenience.
Fixes: e6f8f1a739b6 ("veth: Allow to create peer link with given ifindex")
Signed-off-by: Serhey Popovych <serhe.popovych@...il.com>
---
drivers/net/veth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0156fe8..0689433 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -405,7 +405,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
if (tbp[IFLA_ADDRESS] == NULL)
eth_hw_addr_random(peer);
- if (ifmp && (dev->ifindex != 0))
+ if (ifmp && dev->ifindex > 0)
peer->ifindex = ifmp->ifi_index;
err = register_netdevice(peer);
--
1.8.3.1
Powered by blists - more mailing lists