diff options
author | Christoph Hellwig <hch@lst.de> | 2020-05-28 07:12:32 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-28 11:11:45 -0700 |
commit | fce934949c0f0003c1777fbf8c0706ba82a8cf7e (patch) | |
tree | c8b856938147bb2c526782d1ec30c0393fd2520c /net/rxrpc | |
parent | 9b115749acb24d11083ded4fe947ddd654a940e3 (diff) | |
download | linux-fce934949c0f0003c1777fbf8c0706ba82a8cf7e.tar.gz linux-fce934949c0f0003c1777fbf8c0706ba82a8cf7e.tar.bz2 linux-fce934949c0f0003c1777fbf8c0706ba82a8cf7e.zip |
ipv6: add ip6_sock_set_recverr
Add a helper to directly set the IPV6_RECVERR sockopt from kernel space
without going through a fake uaccess.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/local_object.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 6f4e6b4817cf..c8b2097f499c 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -107,7 +107,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet, static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) { struct sock *usk; - int ret, opt; + int ret; _enter("%p{%d,%d}", local, local->srx.transport_type, local->srx.transport.family); @@ -157,13 +157,7 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) switch (local->srx.transport.family) { case AF_INET6: /* we want to receive ICMPv6 errors */ - opt = 1; - ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, - (char *) &opt, sizeof(opt)); - if (ret < 0) { - _debug("setsockopt failed"); - goto error; - } + ip6_sock_set_recverr(local->socket->sk); /* Fall through and set IPv4 options too otherwise we don't get * errors from IPv4 packets sent through the IPv6 socket. |