All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: yoshfuji@linux-ipv6.org, idosch@mellanox.com,
	roopa@cumulusnetworks.com, David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 2/3] net/ipv6: Add flags arg to ip6_nh_lookup_table
Date: Tue, 23 Jan 2018 19:00:03 -0800	[thread overview]
Message-ID: <20180124030004.4016-3-dsahern@gmail.com> (raw)
In-Reply-To: <20180124030004.4016-1-dsahern@gmail.com>

onlink verification needs to do a lookup without the
RT6_LOOKUP_F_IFACE flag. Change ip6_nh_lookup_table to take a
flags argument and pass RT6_LOOKUP_F_IFACE. Both verifications
want to ignore link state, so add that in the lookup helper.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 net/ipv6/route.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0ff4ca0948f0..00acf0103037 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2440,7 +2440,8 @@ static int ip6_convert_metrics(struct mx6_config *mxc,
 
 static struct rt6_info *ip6_nh_lookup_table(struct net *net,
 					    struct fib6_config *cfg,
-					    const struct in6_addr *gw_addr)
+					    const struct in6_addr *gw_addr,
+					    int flags)
 {
 	struct flowi6 fl6 = {
 		.flowi6_oif = cfg->fc_ifindex,
@@ -2449,7 +2450,6 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
 	};
 	struct fib6_table *table;
 	struct rt6_info *rt;
-	int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
 
 	table = fib6_get_table(net, cfg->fc_table);
 	if (!table)
@@ -2458,6 +2458,7 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
 	if (!ipv6_addr_any(&cfg->fc_prefsrc))
 		flags |= RT6_LOOKUP_F_HAS_SADDR;
 
+	flags |= RT6_LOOKUP_F_IGNORE_LINKSTATE;
 	rt = ip6_pol_route(net, table, cfg->fc_ifindex, &fl6, flags);
 
 	/* if table lookup failed, fall back to full lookup */
@@ -2480,7 +2481,9 @@ static int ip6_route_check_nh(struct net *net,
 	int err = -EHOSTUNREACH;
 
 	if (cfg->fc_table) {
-		grt = ip6_nh_lookup_table(net, cfg, gw_addr);
+		int flags = RT6_LOOKUP_F_IFACE;
+
+		grt = ip6_nh_lookup_table(net, cfg, gw_addr, flags);
 		if (grt) {
 			if (grt->rt6i_flags & RTF_GATEWAY ||
 			    (dev && dev != grt->dst.dev)) {
-- 
2.11.0

  parent reply	other threads:[~2018-01-24  3:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  3:00 [PATCH net-next 0/3] net/ipv6: Add support for ONLINK flag David Ahern
2018-01-24  3:00 ` [PATCH net-next 1/3] net/ipv6: Move gateway validation into helper David Ahern
2018-01-24  3:00 ` David Ahern [this message]
2018-01-24  3:00 ` [PATCH net-next 3/3] net/ipv6: Add support for onlink flag David Ahern
2018-01-24 22:08   ` David Ahern
2018-01-24 22:53     ` David Miller

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=20180124030004.4016-3-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=yoshfuji@linux-ipv6.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.