From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: veth: Be more robust on network device creation when no attributes Date: Thu, 22 Jun 2017 11:16:42 -0400 (EDT) Message-ID: <20170622.111642.1304217851524877946.davem@davemloft.net> References: <1498035736-9330-1-git-send-email-serhe.popovych@gmail.com> <1498036344-10301-1-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: serhe.popovych@gmail.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:35956 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbdFVPQn (ORCPT ); Thu, 22 Jun 2017 11:16:43 -0400 In-Reply-To: <1498036344-10301-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Serhey Popovych Date: Wed, 21 Jun 2017 12:12:24 +0300 > There are number of problems with configuration peer > network device in absence of IFLA_VETH_PEER attributes > where attributes for main network device shared with > peer. > > First it is not feasible to configure both network > devices with same MAC address since this makes > communication in such configuration problematic. > > This case can be reproduced with following sequence: > > # ip link add address 02:11:22:33:44:55 type veth > # ip li sh > ... > 26: veth0@veth1: mtu 1500 qdisc \ > noop state DOWN mode DEFAULT qlen 1000 > link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff > 27: veth1@veth0: mtu 1500 qdisc \ > noop state DOWN mode DEFAULT qlen 1000 > link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff > > Second it is not possible to register both main and > peer network devices with same name, that happens > when name for main interface is given with IFLA_IFNAME > and same attribute reused for peer. > > This case can be reproduced with following sequence: > > # ip link add dev veth1a type veth > RTNETLINK answers: File exists > > To fix both of the cases check if corresponding netlink > attributes are taken from peer_tb when valid or > name based on rtnl ops kind and random address is used. > > Signed-off-by: Serhey Popovych Applied.