mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 11:04:25 +00:00
ipv4: add ip_sock_set_pktinfo
Add a helper to directly set the IP_PKTINFO sockopt from kernel space without going through a fake uaccess. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2de569bda2
commit
c1f9ec5776
3 changed files with 11 additions and 3 deletions
|
@ -767,6 +767,7 @@ static inline bool inetdev_valid_mtu(unsigned int mtu)
|
||||||
|
|
||||||
void ip_sock_set_freebind(struct sock *sk);
|
void ip_sock_set_freebind(struct sock *sk);
|
||||||
int ip_sock_set_mtu_discover(struct sock *sk, int val);
|
int ip_sock_set_mtu_discover(struct sock *sk, int val);
|
||||||
|
void ip_sock_set_pktinfo(struct sock *sk);
|
||||||
void ip_sock_set_recverr(struct sock *sk);
|
void ip_sock_set_recverr(struct sock *sk);
|
||||||
void ip_sock_set_tos(struct sock *sk, int val);
|
void ip_sock_set_tos(struct sock *sk, int val);
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,14 @@ int ip_sock_set_mtu_discover(struct sock *sk, int val)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ip_sock_set_mtu_discover);
|
EXPORT_SYMBOL(ip_sock_set_mtu_discover);
|
||||||
|
|
||||||
|
void ip_sock_set_pktinfo(struct sock *sk)
|
||||||
|
{
|
||||||
|
lock_sock(sk);
|
||||||
|
inet_sk(sk)->cmsg_flags |= IP_CMSG_PKTINFO;
|
||||||
|
release_sock(sk);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(ip_sock_set_pktinfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Socket option code for IP. This is the end of the line after any
|
* Socket option code for IP. This is the end of the line after any
|
||||||
* TCP,UDP etc options on an IP socket.
|
* TCP,UDP etc options on an IP socket.
|
||||||
|
|
|
@ -616,9 +616,8 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
|
||||||
/* make sure we get destination address info */
|
/* make sure we get destination address info */
|
||||||
switch (svsk->sk_sk->sk_family) {
|
switch (svsk->sk_sk->sk_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
level = SOL_IP;
|
ip_sock_set_pktinfo(svsk->sk_sock->sk);
|
||||||
optname = IP_PKTINFO;
|
return;
|
||||||
break;
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
level = SOL_IPV6;
|
level = SOL_IPV6;
|
||||||
optname = IPV6_RECVPKTINFO;
|
optname = IPV6_RECVPKTINFO;
|
||||||
|
|
Loading…
Add table
Reference in a new issue