]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
vti/vti6: Minor improvements
authorSerhey Popovych <serhe.popovych@gmail.com>
Fri, 19 Jan 2018 16:44:02 +0000 (18:44 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 23 Jan 2018 22:50:59 +0000 (14:50 -0800)
In prepare of link_vti.c and link_vti6.c merge:

  1) Make @fwmark of __u32 type instead of unsigned int
     in vti to match with rest tunneling code.

  2) Report when unable to translate @link network device
     name to index instead of silently exiting in vti6.

  3) Remove newline separating local/remote attributes
     from the ikey/okey in vti6 to match vti module.

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

index 1439e53c61171d082f7b34f436ee3df87b5b5b76..6a088c6f32f92f5510020cbca7b650ac86c38cc5 100644 (file)
@@ -69,7 +69,7 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv,
        unsigned int saddr = 0;
        unsigned int daddr = 0;
        unsigned int link = 0;
-       unsigned int fwmark = 0;
+       __u32 fwmark = 0;
        int len;
 
        if (!(n->nlmsg_flags & NLM_F_CREATE)) {
index 2a86d59222a68f6074aba8b0f65d97b709df771f..a11f389cdd91f2142f7b8c21db29ac3e362c850d 100644 (file)
@@ -144,8 +144,11 @@ get_failed:
                } else if (!matches(*argv, "dev")) {
                        NEXT_ARG();
                        link = if_nametoindex(*argv);
-                       if (link == 0)
+                       if (link == 0) {
+                               fprintf(stderr, "Cannot find device \"%s\"\n",
+                                       *argv);
                                exit(-1);
+                       }
                } else if (strcmp(*argv, "fwmark") == 0) {
                        NEXT_ARG();
                        if (get_u32(&fwmark, *argv, 0))
@@ -157,7 +160,6 @@ get_failed:
 
        addattr32(n, 1024, IFLA_VTI_IKEY, ikey);
        addattr32(n, 1024, IFLA_VTI_OKEY, okey);
-
        addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr));
        addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr));
        addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark);