vti/vti6: Minor improvements

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>
This commit is contained in:
Serhey Popovych 2018-01-19 18:44:02 +02:00 committed by Stephen Hemminger
parent c4743c4d9b
commit 9dc04a4fd2
2 changed files with 5 additions and 3 deletions

View 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)) {

View 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);