From ad5bf1937d2bb16bd0c80e08fce5738597ff23e3 Mon Sep 17 00:00:00 2001 From: Yang Hongyang Date: Tue, 16 Dec 2008 02:06:23 -0800 Subject: [PATCH] --- yaml --- r: 122731 b: refs/heads/master c: b24a2516d10751d7ed5afb58420df25370c9dffb h: refs/heads/master i: 122729: 3ae7013ca8b478968c372c65201617a1f8741da0 122727: 0b89414cdfb83f9a09e1f161ba1bdb6c17b180c1 v: v3 --- [refs] | 2 +- trunk/include/linux/ipv6.h | 1 + trunk/net/ipv6/ipv6_sockglue.c | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 35ccf3c37dc2..a931e037be57 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bc02ff95fe4ebd3e5ee7455c0aa6f76ebe39ebca +refs/heads/master: b24a2516d10751d7ed5afb58420df25370c9dffb diff --git a/trunk/include/linux/ipv6.h b/trunk/include/linux/ipv6.h index 641e026eee8f..0b816cae533e 100644 --- a/trunk/include/linux/ipv6.h +++ b/trunk/include/linux/ipv6.h @@ -278,6 +278,7 @@ struct ipv6_pinfo { struct in6_addr saddr; struct in6_addr rcv_saddr; struct in6_addr daddr; + struct in6_pktinfo sticky_pktinfo; struct in6_addr *daddr_cache; #ifdef CONFIG_IPV6_SUBTREES struct in6_addr *saddr_cache; diff --git a/trunk/net/ipv6/ipv6_sockglue.c b/trunk/net/ipv6/ipv6_sockglue.c index 2aa294be0c79..0feaee38bc37 100644 --- a/trunk/net/ipv6/ipv6_sockglue.c +++ b/trunk/net/ipv6/ipv6_sockglue.c @@ -395,6 +395,28 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, break; } + case IPV6_PKTINFO: + { + struct in6_pktinfo pkt; + + if (optlen == 0) + goto e_inval; + else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL) + goto e_inval; + + if (copy_from_user(&pkt, optval, optlen)) { + retv = -EFAULT; + break; + } + if (sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if) + goto e_inval; + + np->sticky_pktinfo.ipi6_ifindex = pkt.ipi6_ifindex; + ipv6_addr_copy(&np->sticky_pktinfo.ipi6_addr, &pkt.ipi6_addr); + retv = 0; + break; + } + case IPV6_2292PKTOPTIONS: { struct ipv6_txoptions *opt = NULL;