From patchwork Thu Dec 28 11:01:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhey Popovych X-Patchwork-Id: 853405 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NEwS77CW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z6mxP0hMtz9s74 for ; Thu, 28 Dec 2017 22:01:29 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753348AbdL1LBZ (ORCPT ); Thu, 28 Dec 2017 06:01:25 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35658 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbdL1LBY (ORCPT ); Thu, 28 Dec 2017 06:01:24 -0500 Received: by mail-lf0-f68.google.com with SMTP id h5so1281108lfj.2 for ; Thu, 28 Dec 2017 03:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=5vu4sQslbXrGY+HNoLDYACu4UNVGBViho/iD5UqFEDo=; b=NEwS77CWJQ+c8nQKUWUnIxCBEDD5f7iJNf7IshDu1xXJDT4i9y6foeRgrWwkW+tq9i HTBYiRgpFQhCW+soVsLpxFZeBH8gZRieJ4ZLkMCBF4ASb/4OWFPwZto4YojGyeXdcJZk 6TKX1wNkGTxVhgUGGyTjSoJ1gn75P8kLPssKLcBGu2evRtpz1eGIK3xDy52a+Vg3YVSK Z4p2FRYF8FMly+yKnqqDiDU8M8KA6QojehpA3JQG+gP1gvwRFXtxdGHK1/9WKHuA5HCB VZ4cFvR+3i0GZ/NqHpkvig0l4OzN24xbT1fhpRJkQoBXu3epOm5CgBqW9FoMFuo3b6S8 KbCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=5vu4sQslbXrGY+HNoLDYACu4UNVGBViho/iD5UqFEDo=; b=jMeAqIw9uygR+Zd2X9bWbog817MvPsd278XtRpygivxn4G4UX+mMxzkiuVpPQhZrj7 vGvsHjt+BuHCLi6SztyLPaYHeBAKWlAiRn1xtVDbipYjRD+xi1DOIdct5epFIb2Y4ksQ 1Fy+L58gLrfb7Mdk6BCCyB/T5EwyRpFW+CW8SUwTYwg3nI0mo//jgHgkDilbYCGpQBEv xGVfeD0P34LZqwXyPClaGPrZ8ABKgghsbqyS2+hG+/1x4dmAh4IizfccmbGqoOCCTNhJ 2/6nOoN+Ek/GVmMzUqIBalL3HoUFQJ7Zsme8A32Ap4Kdpge0JNkI5hHp7tWKVXJPL3GN c7Dg== X-Gm-Message-State: AKGB3mIUW0HGDk0+YOXsqE+upFMtKWwnT8LGxo/xWH4hSqRzmqjjI8s1 bZF/mf13kubqiXSRFbuN5B6Now== X-Google-Smtp-Source: ACJfBosAuj+GiNMJxLZZ7Ag9a8z5ZAEqWpC7947SfxBevX4SLNfxqeMJsjmDEwQU64P0LAiCjtUeDQ== X-Received: by 10.25.16.195 with SMTP id 64mr16994876lfq.66.1514458883293; Thu, 28 Dec 2017 03:01:23 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id j87sm4307875lfk.57.2017.12.28.03.01.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Dec 2017 03:01:22 -0800 (PST) From: Serhey Popovych To: netdev@vger.kernel.org Subject: [PATCH iproute2 1/3] vxcan,veth: Forbid "type" for peer device Date: Thu, 28 Dec 2017 13:01:04 +0200 Message-Id: <1514458864-17640-1-git-send-email-serhe.popovych@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20171226090535.51ac43ef@xeon-e3> References: <20171226090535.51ac43ef@xeon-e3> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: duplicate "type": "veth" is the second value. 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..ed0ad8b 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) + duparg("type", argv[err]); + 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..fddb7ac 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) + duparg("type", argv[err]); + if (name) { addattr_l(hdr, 1024, IFLA_IFNAME, name, strlen(name) + 1);