Skip to content

Commit

Permalink
ipv6: fix the outgoing interface selection order in udpv6_sendmsg()
Browse files Browse the repository at this point in the history
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 <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yang Hongyang authored and David S. Miller committed Dec 16, 2008
1 parent f250dcd commit 9f690db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,9 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
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));
Expand Down

0 comments on commit 9f690db

Please sign in to comment.