From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups Date: Tue, 6 Feb 2018 19:16:13 -0700 Message-ID: <652a40b7-6828-bb7b-ec08-0fa31ec17f06@gmail.com> References: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> <1517577055-23788-5-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Serhey Popovych , netdev@vger.kernel.org Return-path: Received: from mail-pf0-f181.google.com ([209.85.192.181]:36157 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbeBGCQS (ORCPT ); Tue, 6 Feb 2018 21:16:18 -0500 Received: by mail-pf0-f181.google.com with SMTP id k5so1509571pff.3 for ; Tue, 06 Feb 2018 18:16:18 -0800 (PST) In-Reply-To: <1517577055-23788-5-git-send-email-serhe.popovych@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2/2/18 6:10 AM, Serhey Popovych wrote: > @@ -414,15 +428,18 @@ static int do_tunnels_list(struct ip_tunnel_parm *p) > fprintf(stderr, "Failed to get type of \"%s\"\n", name); > continue; > } > - if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT) > + switch (type) { > + case ARPHRD_TUNNEL: > + case ARPHRD_IPGRE: > + case ARPHRD_SIT: > + break; > + default: > continue; > + } > + memset(p1, 0, sizeof(p1)); Shouldn't that be &p1 for the first arg? I get a compile failure: ip CC iptunnel.o CC ip6tunnel.o iptunnel.c: In function ‘do_tunnels_list’: iptunnel.c:439:10: error: incompatible type for argument 1 of ‘memset’ memset(p1, 0, sizeof(p1)); ^~ In file included from iptunnel.c:15:0: /usr/include/string.h:62:14: note: expected ‘void *’ but argument is of type ‘struct ip_tunnel_parm’ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^~~~~~ ../config.mk:48: recipe for target 'iptunnel.o' failed > if (tnl_get_ioctl(name, &p1)) > continue; > - if ((p->link && p1.link != p->link) || > - (p->name[0] && strcmp(p1.name, p->name)) || > - (p->iph.daddr && p1.iph.daddr != p->iph.daddr) || > - (p->iph.saddr && p1.iph.saddr != p->iph.saddr) || > - (p->i_key && p1.i_key != p->i_key)) > + if (!ip_tunnel_parm_match(p, &p1)) > continue; > print_tunnel(&p1); > if (show_stats) {