Commit 7d7207c2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

ipv6: add ip6_sock_set_recvpktinfo

Add a helper to directly set the IPV6_RECVPKTINFO sockopt from kernel
space without going through a fake uaccess.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18d5ad62
...@@ -1262,4 +1262,11 @@ static inline int ip6_sock_set_addr_preferences(struct sock *sk, bool val) ...@@ -1262,4 +1262,11 @@ static inline int ip6_sock_set_addr_preferences(struct sock *sk, bool val)
return ret; return ret;
} }
static inline void ip6_sock_set_recvpktinfo(struct sock *sk)
{
lock_sock(sk);
inet6_sk(sk)->rxopt.bits.rxinfo = true;
release_sock(sk);
}
#endif /* _NET_IPV6_H */ #endif /* _NET_IPV6_H */
...@@ -595,8 +595,6 @@ static struct svc_xprt_class svc_udp_class = { ...@@ -595,8 +595,6 @@ static struct svc_xprt_class svc_udp_class = {
static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
{ {
int err, level, optname, one = 1;
svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_udp_class, svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_udp_class,
&svsk->sk_xprt, serv); &svsk->sk_xprt, serv);
clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags); clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
...@@ -617,17 +615,13 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) ...@@ -617,17 +615,13 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
switch (svsk->sk_sk->sk_family) { switch (svsk->sk_sk->sk_family) {
case AF_INET: case AF_INET:
ip_sock_set_pktinfo(svsk->sk_sock->sk); ip_sock_set_pktinfo(svsk->sk_sock->sk);
return; break;
case AF_INET6: case AF_INET6:
level = SOL_IPV6; ip6_sock_set_recvpktinfo(svsk->sk_sock->sk);
optname = IPV6_RECVPKTINFO;
break; break;
default: default:
BUG(); BUG();
} }
err = kernel_setsockopt(svsk->sk_sock, level, optname,
(char *)&one, sizeof(one));
dprintk("svc: kernel_setsockopt returned %d\n", err);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment