rxrpc: Add IPv6 support
Add IPv6 support to AF_RXRPC. With this, AF_RXRPC sockets can be created: service = socket(AF_RXRPC, SOCK_DGRAM, PF_INET6); instead of: service = socket(AF_RXRPC, SOCK_DGRAM, PF_INET); The AFS filesystem doesn't support IPv6 at the moment, though, since that requires upgrades to some of the RPC calls. Note that a good portion of this patch is replacing "%pI4:%u" in print statements with "%pISpc" which is able to handle both protocols and print the port. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -66,6 +66,30 @@ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local,
|
||||
}
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
srx.transport.sin6.sin6_port = serr->port;
|
||||
srx.transport_len = sizeof(struct sockaddr_in6);
|
||||
switch (serr->ee.ee_origin) {
|
||||
case SO_EE_ORIGIN_ICMP6:
|
||||
_net("Rx ICMP6");
|
||||
memcpy(&srx.transport.sin6.sin6_addr,
|
||||
skb_network_header(skb) + serr->addr_offset,
|
||||
sizeof(struct in6_addr));
|
||||
break;
|
||||
case SO_EE_ORIGIN_ICMP:
|
||||
_net("Rx ICMP on v6 sock");
|
||||
memcpy(&srx.transport.sin6.sin6_addr.s6_addr + 12,
|
||||
skb_network_header(skb) + serr->addr_offset,
|
||||
sizeof(struct in_addr));
|
||||
break;
|
||||
default:
|
||||
memcpy(&srx.transport.sin6.sin6_addr,
|
||||
&ipv6_hdr(skb)->saddr,
|
||||
sizeof(struct in6_addr));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
Reference in New Issue
Block a user