From: Yang Hongyang Date: Tue, 16 Dec 2008 10:08:29 +0000 (-0800) Subject: ipv6: fix the outgoing interface selection order in udpv6_sendmsg() X-Git-Tag: v2.6.29-rc1~581^2~162 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9f690db7ff4cb32493c0b0b13334cc4f5fd49a6b;p=karo-tx-linux.git ipv6: fix the outgoing interface selection order in udpv6_sendmsg() 1.When no interface is specified in an IPV6_PKTINFO ancillary data item, the interface specified in an IPV6_PKTINFO sticky optionis is used. RFC3542: 6.7. Summary of Outgoing Interface Selection This document and [RFC-3493] specify various methods that affect the selection of the packet's outgoing interface. This subsection summarizes the ordering among those in order to ensure deterministic behavior. For a given outgoing packet on a given socket, the outgoing interface is determined in the following order: 1. if an interface is specified in an IPV6_PKTINFO ancillary data item, the interface is used. 2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky option, the interface is used. Signed-off-by: Yang Hongyang Signed-off-by: David S. Miller --- diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 38390dd19636..84b1a296eecb 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -793,6 +793,9 @@ do_udp_sendmsg: if (!fl.oif) fl.oif = sk->sk_bound_dev_if; + if (!fl.oif) + fl.oif = np->sticky_pktinfo.ipi6_ifindex; + if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions));