From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: Re: [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups Date: Wed, 7 Feb 2018 08:20:19 +0200 Message-ID: <911a16d7-e210-2c12-e8ec-7c6ed055bfe4@gmail.com> References: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> <1517577055-23788-5-git-send-email-serhe.popovych@gmail.com> <652a40b7-6828-bb7b-ec08-0fa31ec17f06@gmail.com> <31e1a072-b1d8-6092-ffab-c3c3f9272cae@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gbuvSoXZDFGSgrQ05hy3IqihtuYzrNZKS" To: David Ahern , netdev@vger.kernel.org Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:40658 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbeBGGUX (ORCPT ); Wed, 7 Feb 2018 01:20:23 -0500 Received: by mail-wm0-f68.google.com with SMTP id v123so970895wmd.5 for ; Tue, 06 Feb 2018 22:20:23 -0800 (PST) In-Reply-To: <31e1a072-b1d8-6092-ffab-c3c3f9272cae@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gbuvSoXZDFGSgrQ05hy3IqihtuYzrNZKS Content-Type: multipart/mixed; boundary="bZ20AvlRqc9rIBN4md1a7HP6W5eceoYe6"; protected-headers="v1" From: Serhey Popovych To: David Ahern , netdev@vger.kernel.org Message-ID: <911a16d7-e210-2c12-e8ec-7c6ed055bfe4@gmail.com> Subject: Re: [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups References: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> <1517577055-23788-5-git-send-email-serhe.popovych@gmail.com> <652a40b7-6828-bb7b-ec08-0fa31ec17f06@gmail.com> <31e1a072-b1d8-6092-ffab-c3c3f9272cae@gmail.com> In-Reply-To: <31e1a072-b1d8-6092-ffab-c3c3f9272cae@gmail.com> --bZ20AvlRqc9rIBN4md1a7HP6W5eceoYe6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable David Ahern wrote: > On 2/6/18 7:16 PM, David Ahern wrote: >> On 2/2/18 6:10 AM, Serhey Popovych wrote: >>> @@ -414,15 +428,18 @@ static int do_tunnels_list(struct ip_tunnel_par= m *p) >>> fprintf(stderr, "Failed to get type of \"%s\"\n", name); >>> continue; >>> } >>> - if (type !=3D ARPHRD_TUNNEL && type !=3D ARPHRD_IPGRE && type !=3D= 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 =E2=80=98do_tunnels_list=E2=80=99: >> iptunnel.c:439:10: error: incompatible type for argument 1 of =E2=80=98= memset=E2=80=99 >> memset(p1, 0, sizeof(p1)); >> ^~ >> In file included from iptunnel.c:15:0: >> /usr/include/string.h:62:14: note: expected =E2=80=98void *=E2=80=99 b= ut argument is of >> type =E2=80=98struct ip_tunnel_parm=E2=80=99 >> extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnul= l >> ((1)); >> ^~~~~~ >> ../config.mk:48: recipe for target 'iptunnel.o' failed >> >=20 > Fixed by patch 5 which deletes do_tunnels_list. So why have a cleanup > patch that changes code you then delete? >=20 There at least two reasons: 1) Abstract tunnel matching code into a function that will be used as callback ->match() in upcoming change. 2) Make do_tunnels_list() ip and ipv6 variants diff contain only real differences to show upcoming change where common do_tunnels_list() introduced is correct. Will update comment for this patch in v2. --bZ20AvlRqc9rIBN4md1a7HP6W5eceoYe6-- --gbuvSoXZDFGSgrQ05hy3IqihtuYzrNZKS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJaepqjAAoJEBTawMmQ61bB0PQH/AhpNKP8Ce+gJIkjuoHF3qRI X02VwygNDwvls09qumKpyokgFnXtiOsk2DFXt1KpsoQHGNjq2AnWBiKm/hAK80+3 hwExykF0uGeWsqn7GBcQwIlccHW4+A57vV2+xTBt2d1v/T3lpyu/ohUb3gO8Sfte SW30go5IqGzwER2gbOG6ABxc9PsZ8k9nWkBIZR7teLBYBFAl3ByAAA8jHhdgbC8D SKVNvR7pwADYkwbRm5761LehL+I+UsofvDvPVbir1yNI+gbFOv87noo/2fUnQFfb PrTQoIAAd0/dMiPYQRVSE5ti3wAqjnzt6fDBG9m53VCBFSx00SbMLdm+LxOCyno= =NXQO -----END PGP SIGNATURE----- --gbuvSoXZDFGSgrQ05hy3IqihtuYzrNZKS--