]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
vxcan,veth: Forbid "type" for peer device
authorSerhey Popovych <serhe.popovych@gmail.com>
Thu, 28 Dec 2017 11:01:04 +0000 (13:01 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 28 Dec 2017 17:35:27 +0000 (09:35 -0800)
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:
-------

<no output, no netdevs created>

After:
------

Error: duplicate "type": "veth" is the second value.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/iplink_vxcan.c
ip/link_veth.c

index c13224c3dccdf5ed6f64f60fb43eb19589772f94..ed0ad8b98ce87d1b0f8635c0909db02662634b67 100644 (file)
@@ -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);
index fcfd1ef32d02c9b63800421163317ffdb1ad83df..fddb7ac3c6a5cbd62a462cb6ab57247a62dec7c4 100644 (file)
@@ -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);