From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: Netdev <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [RFC] Inverse of flowi{4,6}_oif: flowi{4,6}_not_oif
Date: Wed, 3 Feb 2016 18:40:53 +0100 [thread overview]
Message-ID: <CAHmME9oTdm2NaFYKdx-=Ax2v=jDPLp3EGvyFMk0CPLt-ZdXMnA@mail.gmail.com> (raw)
In-Reply-To: <56B22A95.4010408@cumulusnetworks.com>
On Wed, Feb 3, 2016 at 5:28 PM, David Ahern <dsa@cumulusnetworks.com> wrote:
>
> For IPv6 start with ip6_pol_route_lookup and modifying rt6_device_match
>
If that's all it takes, then that turns out to be ridiculously easy
too. I'll get a patch together for this.
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -467,6 +467,7 @@ static inline struct rt6_info
*rt6_device_match(struct net *net,
struct rt6_info *rt,
const struct
in6_addr *saddr,
int oif,
+ int not_oif,
int flags)
{
struct rt6_info *local = NULL;
@@ -478,6 +479,9 @@ static inline struct rt6_info
*rt6_device_match(struct net *net,
for (sprt = rt; sprt; sprt = sprt->dst.rt6_next) {
struct net_device *dev = sprt->dst.dev;
+ if (not_oif && dev->ifindex == not_oif)
+ continue;
+
if (oif) {
if (dev->ifindex == oif)
return sprt;
@@ -856,7 +860,7 @@ static struct rt6_info
*ip6_pol_route_lookup(struct net *net,
fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
restart:
rt = fn->leaf;
- rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags);
+ rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif,
fl6->flowi6_not_oif, flags);
if (rt->rt6i_nsiblings && fl6->flowi6_oif == 0)
rt = rt6_multipath_select(rt, fl6, fl6->flowi6_oif, flags);
if (rt == net->ipv6.ip6_null_entry) {
next prev parent reply other threads:[~2016-02-03 17:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 22:42 [RFC] Inverse of flowi{4,6}_oif: flowi{4,6}_not_oif Jason A. Donenfeld
2016-02-03 14:27 ` Jason A. Donenfeld
2016-02-03 16:28 ` David Ahern
2016-02-03 17:40 ` Jason A. Donenfeld [this message]
2016-02-03 17:46 ` [PATCH] flowi: add concept of "not_oif" Jason A. Donenfeld
2016-02-03 20:42 ` Julian Anastasov
2016-02-03 21:02 ` Jason A. Donenfeld
2016-02-04 3:44 ` Eric Dumazet
2016-02-05 18:38 ` Jason A. Donenfeld
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='CAHmME9oTdm2NaFYKdx-=Ax2v=jDPLp3EGvyFMk0CPLt-ZdXMnA@mail.gmail.com' \
--to=jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=ebiederm@xmission.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 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).