forked from luck/tmp_suning_uos_patched
rxrpc: Fix transport sockopts to get IPv4 errors on an IPv6 socket
It seems that enabling IPV6_RECVERR on an IPv6 socket doesn't also turn on
IP_RECVERR, so neither local errors nor ICMP-transported remote errors from
IPv4 peer addresses are returned to the AF_RXRPC protocol.
Make the sockopt setting code in rxrpc_open_socket() fall through from the
AF_INET6 case to the AF_INET case to turn on all the AF_INET options too in
the AF_INET6 case.
Fixes: f2aeed3a59
("rxrpc: Fix error reception on AF_INET6 sockets")
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
0099dc589b
commit
37a675e768
|
@ -135,6 +135,29 @@ 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;
|
||||
}
|
||||
|
||||
/* we want to set the don't fragment bit */
|
||||
opt = IPV6_PMTUDISC_DO;
|
||||
ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,
|
||||
(char *) &opt, sizeof(opt));
|
||||
if (ret < 0) {
|
||||
_debug("setsockopt failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Fall through and set IPv4 options too otherwise we don't get
|
||||
* errors from IPv4 packets sent through the IPv6 socket.
|
||||
*/
|
||||
|
||||
case AF_INET:
|
||||
/* we want to receive ICMP errors */
|
||||
opt = 1;
|
||||
|
@ -153,26 +176,6 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
|
|||
_debug("setsockopt failed");
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
/* we want to receive ICMP errors */
|
||||
opt = 1;
|
||||
ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,
|
||||
(char *) &opt, sizeof(opt));
|
||||
if (ret < 0) {
|
||||
_debug("setsockopt failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* we want to set the don't fragment bit */
|
||||
opt = IPV6_PMTUDISC_DO;
|
||||
ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,
|
||||
(char *) &opt, sizeof(opt));
|
||||
if (ret < 0) {
|
||||
_debug("setsockopt failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* We want receive timestamps. */
|
||||
opt = 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user