mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 02:04:05 +08:00
rxrpc: Fix error reception on AF_INET6 sockets
AF_RXRPC tries to turn on IP_RECVERR and IP_MTU_DISCOVER on the UDP socket
it just opened for communications with the outside world, regardless of the
type of socket. Unfortunately, this doesn't work with an AF_INET6 socket.
Fix this by turning on IPV6_RECVERR and IPV6_MTU_DISCOVER instead if the
socket is of the AF_INET6 family.
Without this, kAFS server and address rotation doesn't work correctly
because the algorithm doesn't detect received network errors.
Fixes: 75b54cb57c
("rxrpc: Add IPv6 support")
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
c54e43d752
commit
f2aeed3a59
@ -134,22 +134,49 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we want to receive ICMP errors */
|
switch (local->srx.transport.family) {
|
||||||
opt = 1;
|
case AF_INET:
|
||||||
ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR,
|
/* we want to receive ICMP errors */
|
||||||
(char *) &opt, sizeof(opt));
|
opt = 1;
|
||||||
if (ret < 0) {
|
ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR,
|
||||||
_debug("setsockopt failed");
|
(char *) &opt, sizeof(opt));
|
||||||
goto error;
|
if (ret < 0) {
|
||||||
}
|
_debug("setsockopt failed");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* we want to set the don't fragment bit */
|
/* we want to set the don't fragment bit */
|
||||||
opt = IP_PMTUDISC_DO;
|
opt = IP_PMTUDISC_DO;
|
||||||
ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER,
|
ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER,
|
||||||
(char *) &opt, sizeof(opt));
|
(char *) &opt, sizeof(opt));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
_debug("setsockopt failed");
|
_debug("setsockopt failed");
|
||||||
goto error;
|
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;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the socket up */
|
/* set the socket up */
|
||||||
|
Loading…
Reference in New Issue
Block a user