From patchwork Tue Jul 9 13:16:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 1129776 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45jjWC32CVz9sBF for ; Tue, 9 Jul 2019 23:16:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbfGINQG (ORCPT ); Tue, 9 Jul 2019 09:16:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43460 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfGINQG (ORCPT ); Tue, 9 Jul 2019 09:16:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26CDD2F8BE1; Tue, 9 Jul 2019 13:16:06 +0000 (UTC) Received: from renaissance-vector.mxp.redhat.com (unknown [10.32.181.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5768D87031; Tue, 9 Jul 2019 13:16:04 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@kernel.org Subject: [PATCH iproute2 1/2] Revert "ip6tunnel: fix 'ip -6 {show|change} dev ' cmds" Date: Tue, 9 Jul 2019 15:16:50 +0200 Message-Id: <5caaac096e5bbbf88ad3aedcc50ff2451f94105c.1562667648.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 09 Jul 2019 13:16:06 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This reverts commit ba126dcad20e6d0e472586541d78bdd1ac4f1123. It breaks tunnel creation when using 'dev' parameter: $ ip link add type dummy $ ip -6 tunnel add ip6tnl1 mode ip6ip6 remote 2001:db8:ffff:100::2 local 2001:db8:ffff:100::1 hoplimit 1 tclass 0x0 dev dummy0 add tunnel "ip6tnl0" failed: File exists dev parameter must be used to specify the device to which the tunnel is binded, and not the tunnel itself. Reported-by: Jianwen Ji Reviewed-by: Matteo Croce Signed-off-by: Andrea Claudi --- ip/ip6tunnel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 56fd3466ed062..999408ed801b1 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -298,8 +298,6 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) p->link = ll_name_to_index(medium); if (!p->link) return nodev(medium); - else - strlcpy(p->name, medium, sizeof(p->name)); } return 0; } From patchwork Tue Jul 9 13:16:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 1129778 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45jjWK56yCz9s8m for ; Tue, 9 Jul 2019 23:16:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbfGINQM (ORCPT ); Tue, 9 Jul 2019 09:16:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfGINQM (ORCPT ); Tue, 9 Jul 2019 09:16:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38466A3B5D; Tue, 9 Jul 2019 13:16:08 +0000 (UTC) Received: from renaissance-vector.mxp.redhat.com (unknown [10.32.181.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696B587031; Tue, 9 Jul 2019 13:16:06 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@kernel.org Subject: [PATCH iproute2 2/2] ip tunnel: warn when changing IPv6 tunnel without tunnel name Date: Tue, 9 Jul 2019 15:16:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 09 Jul 2019 13:16:12 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Tunnel change fails if a tunnel name is not specified while using 'ip -6 tunnel change'. However, no warning message is printed and no error code is returned. $ ip -6 tunnel add ip6tnl1 mode ip6gre local fd::1 remote fd::2 tos inherit ttl 127 encaplimit none dev dummy0 $ ip -6 tunnel change dev dummy0 local 2001:1234::1 remote 2001:1234::2 $ ip -6 tunnel show ip6tnl1 ip6tnl1: gre/ipv6 remote fd::2 local fd::1 dev dummy0 encaplimit none hoplimit 127 tclass inherit flowlabel 0x00000 (flowinfo 0x00000000) This commit checks if tunnel interface name is equal to an empty string: in this case, it prints a warning message to the user. It intentionally avoids to return an error to not break existing script setup. This is the output after this commit: $ ip -6 tunnel add ip6tnl1 mode ip6gre local fd::1 remote fd::2 tos inherit ttl 127 encaplimit none dev dummy0 $ ip -6 tunnel change dev dummy0 local 2001:1234::1 remote 2001:1234::2 Tunnel interface name not specified $ ip -6 tunnel show ip6tnl1 ip6tnl1: gre/ipv6 remote fd::2 local fd::1 dev dummy0 encaplimit none hoplimit 127 tclass inherit flowlabel 0x00000 (flowinfo 0x00000000) Reviewed-by: Matteo Croce Signed-off-by: Andrea Claudi --- ip/ip6tunnel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 999408ed801b1..e3da11eb4518e 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -386,6 +386,9 @@ static int do_add(int cmd, int argc, char **argv) if (parse_args(argc, argv, cmd, &p) < 0) return -1; + if (!*p.name) + fprintf(stderr, "Tunnel interface name not specified\n"); + if (p.proto == IPPROTO_GRE) basedev = "ip6gre0"; else if (p.i_flags & VTI_ISVTI)