From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2 3/4] vti/vti6: Minor improvements Date: Fri, 19 Jan 2018 18:44:02 +0200 Message-ID: <1516380243-32568-4-git-send-email-serhe.popovych@gmail.com> References: <1516380243-32568-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f67.google.com ([209.85.215.67]:39004 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756217AbeASQoO (ORCPT ); Fri, 19 Jan 2018 11:44:14 -0500 Received: by mail-lf0-f67.google.com with SMTP id m8so2818515lfc.6 for ; Fri, 19 Jan 2018 08:44:13 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id 77sm1785587ljx.58.2018.01.19.08.44.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 08:44:11 -0800 (PST) In-Reply-To: <1516380243-32568-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- ip/link_vti.c | 2 +- ip/link_vti6.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ip/link_vti.c b/ip/link_vti.c index 1439e53..6a088c6 100644 --- a/ip/link_vti.c +++ b/ip/link_vti.c @@ -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)) { diff --git a/ip/link_vti6.c b/ip/link_vti6.c index 2a86d59..a11f389 100644 --- a/ip/link_vti6.c +++ b/ip/link_vti6.c @@ -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); -- 1.7.10.4