[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131101180433.GB30284@order.stressinduktion.org>
Date: Fri, 1 Nov 2013 19:04:33 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Emmanuel Thierry <emmanuel.thierry@...ecom-bretagne.eu>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [RFC PATCH 1/2] ipv6: select oif corresponding to source address
On Fri, Nov 01, 2013 at 06:17:36PM +0100, Emmanuel Thierry wrote:
> --- 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;
> + if (!ipv6_addr_any(&fl6->saddr)) {
> + ifp = ipv6_get_ifaddr(net, &fl6->saddr, NULL, 1);
> + fl6->flowi6_oif = ifp->idev->dev->ifindex;
Cool that you are working on this! :)
Small feedback that might help while you play with this:
You have to be careful here, ipv6_get_ifaddr increments the reference
count of the ifp, so you have to drop it again: in6_ifa_put(ifp);
For such short periods holding a reference does not always make sense. You
could check ipv6_get_lladdr/__ipv6_get_lladdr how you could do this
without touching the reference counters if you put this section in
a rcu_read_lock. This especially makes sense if this is a often used
code path.
> + }
> *dst = ip6_route_output(net, sk, fl6);
> + }
>
> if ((err = (*dst)->error))
> goto out_err_release;
I'll have to think about this carefully.
Thanks,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists