From: Phil Sutter <phil@nwl.cc>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org,
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCH iproute2] utils: also check AF_INET family when rtm_type is RTN_MULTICAST
Date: Thu, 27 Jul 2017 11:11:20 +0200 [thread overview]
Message-ID: <20170727091120.GO2235@orbyte.nwl.cc> (raw)
In-Reply-To: <1501146109-30032-1-git-send-email-liuhangbin@gmail.com>
Hi Hangbin,
On Thu, Jul 27, 2017 at 05:01:49PM +0800, Hangbin Liu wrote:
[...]
> diff --git a/lib/utils.c b/lib/utils.c
> index e77bd30..0479e00 100644
> --- a/lib/utils.c
> +++ b/lib/utils.c
> @@ -1215,5 +1215,6 @@ int get_real_family(int rtm_type, int rtm_family)
> if (rtm_type != RTN_MULTICAST)
> return rtm_family;
>
> - return rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
> + return (rtm_family == RTNL_FAMILY_IPMR ||
> + rtm_family == AF_INET) ? AF_INET : AF_INET6;
> }
I think this is not very readable. How about this instead:
- return rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
+ if (rtm_family == RTNL_FAMILY_IPMR)
+ return AF_INET;
+
+ return rtm_family;
Thanks, Phil
next prev parent reply other threads:[~2017-07-27 9:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 9:01 [PATCH iproute2] utils: also check AF_INET family when rtm_type is RTN_MULTICAST Hangbin Liu
2017-07-27 9:11 ` Phil Sutter [this message]
2017-07-27 9:44 ` [PATCHv2 iproute2] utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR Hangbin Liu
2017-07-27 10:03 ` Phil Sutter
2017-07-27 18:28 ` Stephen Hemminger
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=20170727091120.GO2235@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).