All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serhey Popovych <serhe.popovych@gmail.com>
To: David Ahern <dsahern@gmail.com>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups
Date: Wed, 7 Feb 2018 08:20:19 +0200	[thread overview]
Message-ID: <911a16d7-e210-2c12-e8ec-7c6ed055bfe4@gmail.com> (raw)
In-Reply-To: <31e1a072-b1d8-6092-ffab-c3c3f9272cae@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1722 bytes --]

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_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
>>
> 
> Fixed by patch 5 which deletes do_tunnels_list. So why have a cleanup
> patch that changes code you then delete?
> 

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2018-02-07  6:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 13:10 [PATCH iproute2-next 0/6] ip: Use netlink to walk through network device list Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 1/6] ipaddress: Unify print_link_stats() and print_link_stats64() Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 2/6] ip: Introduce get_rtnl_link_stats_rta() to get link statistics Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 3/6] tunnel: Split statistic getting and printing Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups Serhey Popovych
2018-02-07  2:16   ` David Ahern
2018-02-07  2:19     ` David Ahern
2018-02-07  6:20       ` Serhey Popovych [this message]
2018-02-07  6:15     ` Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 5/6] iptunnel/ip6tunnel: Use netlink to walk through tunnels list Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 6/6] tuntap: Use netlink to walk through tuntap list Serhey Popovych
2018-02-02 13:21 ` [PATCH iproute2-next 0/6] ip: Use netlink to walk through network device list Serhey Popovych

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=911a16d7-e210-2c12-e8ec-7c6ed055bfe4@gmail.com \
    --to=serhe.popovych@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.