From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Emmanuel Thierry <emmanuel.thierry@telecom-bretagne.eu>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: Re: [RFC PATCH 1/2] ipv6: select oif corresponding to source address
Date: Fri, 01 Nov 2013 22:42:12 +0300 [thread overview]
Message-ID: <52740414.3000806@cogentembedded.com> (raw)
In-Reply-To: <06F9072B-27A3-4A21-ADE2-A5B3FE817A1F@telecom-bretagne.eu>
Hello.
On 11/01/2013 08:17 PM, Emmanuel Thierry wrote:
> When selecting the next hop, prefer the interface to which the
> source address is associated. This preference fixes problems for
> IPv6 hosts in multi-interfaces setup.
> In the case where a host has:
> * multiple links, each providing internet connectivity
> * both links advertising prefix and default route via Router
> Advertisements
> The current route selection process completly ignores whether or
> not the next hop is consistent with the source address. This may
> lead to packets being sent with a specific source address on the
> wrong link, then dropped by a router enforcing reverse path
> filtering.
> This fix pre-selects the output interface corresponding to the
> source address bound to the socket. The fl6->flowi6_oif
> attribute gives to the route selection algorithm an hint about
> what interface to choose in case of a tie between several routes
> of equal preferences (equal netmask, equal metrics and equal
> RFC 4191 preference values).
> Signed-off-by: Emmanuel Thierry <emmanuel.thierry@telecom-bretagne.eu>
> ---
> net/ipv6/ip6_output.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 91fb4e8..1a05395 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -848,8 +848,14 @@ static int ip6_dst_lookup_tail(struct sock *sk,
> #endif
> int err;
>
> - if (*dst == NULL)
> + if (*dst == NULL) {
> + struct inet6_ifaddr *ifp;
Empty line needed between declaration and other code.
> + if (!ipv6_addr_any(&fl6->saddr)) {
> + ifp = ipv6_get_ifaddr(net, &fl6->saddr, NULL, 1);
> + fl6->flowi6_oif = ifp->idev->dev->ifindex;
> + }
> *dst = ip6_route_output(net, sk, fl6);
> + }
>
> if ((err = (*dst)->error))
> goto out_err_release;
WBR, Sergei
prev parent reply other threads:[~2013-11-01 18:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 17:17 [RFC PATCH 1/2] ipv6: select oif corresponding to source address Emmanuel Thierry
2013-11-01 17:21 ` [RFC PATCH 2/2] ipv6: don't use routing cache for inexact matchings Emmanuel Thierry
2013-11-01 17:34 ` [RFC PATCH 1/2] ipv6: select oif corresponding to source address Emmanuel Thierry
2013-11-01 18:04 ` Hannes Frederic Sowa
2013-11-01 19:42 ` Sergei Shtylyov [this message]
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=52740414.3000806@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=emmanuel.thierry@telecom-bretagne.eu \
--cc=hannes@stressinduktion.org \
--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).