From: David Ahern <dsahern@gmail.com>
To: Roopa Prabhu <roopa@cumulusnetworks.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org, nikolay@cumulusnetworks.com
Subject: Re: [PATCH net-next 8/8] net: ipv6: RTM_GETROUTE: return matched fib result when requested
Date: Wed, 24 May 2017 20:35:24 -0600 [thread overview]
Message-ID: <2106987d-7c19-b739-0103-97af3a3071da@gmail.com> (raw)
In-Reply-To: <1495649951-30417-9-git-send-email-roopa@cumulusnetworks.com>
Since you have to do a v2 ...
On 5/24/17 12:19 PM, Roopa Prabhu wrote:
> @@ -3622,6 +3623,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
> memset(&fl6, 0, sizeof(fl6));
> rtm = nlmsg_data(nlh);
> fl6.flowlabel = ip6_make_flowinfo(rtm->rtm_tos, 0);
> + fibmatch = (rtm->rtm_flags & RTM_F_FIB_MATCH) ? true : false;
this is typically done as !!(rtm->rtm_flags & RTM_F_FIB_MATCH)
>
> if (tb[RTA_SRC]) {
> if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr))
> @@ -3667,12 +3669,27 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
> if (!ipv6_addr_any(&fl6.saddr))
> flags |= RT6_LOOKUP_F_HAS_SADDR;
>
> - rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6,
> - flags);
> + if (!fibmatch)
> + rt = (struct rt6_info *)ip6_route_input_lookup(net, dev,
> + &fl6,
> + flags);
> } else {
> fl6.flowi6_oif = oif;
>
> - rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6);
> + if (!fibmatch)
> + rt = (struct rt6_info *)ip6_route_output_flags(net,
> + NULL,
> + &fl6, 0);
> + }
> +
> + if (fibmatch) {
> + rt = (struct rt6_info *)ip6_route_lookup(net, &fl6, 0);
> + if (rt->dst.error) {
> + err = rt->dst.error;
> + ip6_rt_put(rt);
> + goto errout;
> + }
> +
I'd prefer to see the typecasts go away and use container_of to go from
dst_entry to rt6_info. I realize some of this is movement of existing
code, but better to clean up as we go.
next prev parent reply other threads:[~2017-05-25 2:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 18:19 [PATCH net-next 0/8] net: extend RTM_GETROUTE to return fib result Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 1/8] net: ipv4: refactor __ip_route_output_key_hash Roopa Prabhu
2017-05-24 19:33 ` Rosen, Rami
2017-05-25 1:10 ` David Ahern
2017-05-25 3:05 ` Roopa Prabhu
2017-05-25 1:30 ` kbuild test robot
2017-05-25 2:38 ` kbuild test robot
2017-05-24 18:19 ` [PATCH net-next 2/8] net: ipv4: refactor ip_route_input_noref Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 3/8] net: ipv4: Remove event arg to rt_fill_info Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 4/8] net: ipv4: Convert inet_rtm_getroute to rcu versions of route lookup Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 5/8] net: ipv4: Save trie prefix to fib lookup result Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 6/8] net: ipv4: add new RTM_F_FIB_MATCH flag for use with RTM_GETROUTE Roopa Prabhu
2017-05-24 18:19 ` [PATCH net-next 7/8] net: ipv4: RTM_GETROUTE: return matched fib result when requested Roopa Prabhu
2017-05-25 2:16 ` David Ahern
2017-05-24 18:19 ` [PATCH net-next 8/8] net: ipv6: " Roopa Prabhu
2017-05-25 2:35 ` David Ahern [this message]
2017-05-25 15:54 ` Roopa Prabhu
2017-05-25 16:00 ` David Ahern
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=2106987d-7c19-b739-0103-97af3a3071da@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
/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).