From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2 1/3] vxcan,veth: Forbid "type" for peer device Date: Wed, 20 Dec 2017 09:37:29 +0200 Message-ID: <1513755451-9800-2-git-send-email-serhe.popovych@gmail.com> References: <1513755451-9800-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f65.google.com ([209.85.215.65]:35245 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932295AbdLTHiG (ORCPT ); Wed, 20 Dec 2017 02:38:06 -0500 Received: by mail-lf0-f65.google.com with SMTP id j124so22917462lfg.2 for ; Tue, 19 Dec 2017 23:38:05 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id a9sm3722880lfg.12.2017.12.19.23.38.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 23:38:03 -0800 (PST) In-Reply-To: <1513755451-9800-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: It is already given for original device we configure this peer for. Results from following command before/after change applied are shown below: $ ip link add dev veth1a type veth peer name veth1b \ type veth peer name veth1c Before: ------- After: ------ Error: argument "type" is wrong: not supported for peer Signed-off-by: Serhey Popovych --- ip/iplink_vxcan.c | 3 +++ ip/link_veth.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ip/iplink_vxcan.c b/ip/iplink_vxcan.c index c13224c..13f2577 100644 --- a/ip/iplink_vxcan.c +++ b/ip/iplink_vxcan.c @@ -65,6 +65,9 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv, if (err < 0) return err; + if (type) + invarg("not supported for peer", "type"); + if (name) { addattr_l(hdr, 1024, IFLA_IFNAME, name, strlen(name) + 1); diff --git a/ip/link_veth.c b/ip/link_veth.c index fcfd1ef..cc43198 100644 --- a/ip/link_veth.c +++ b/ip/link_veth.c @@ -63,6 +63,9 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv, if (err < 0) return err; + if (type) + invarg("not supported for peer", "type"); + if (name) { addattr_l(hdr, 1024, IFLA_IFNAME, name, strlen(name) + 1); -- 1.7.10.4