Only update source address when resolving is successful in ibcore.
When resolving an IP address in ibcore, only update the source address upon normal completion. The ibcore address resolve function does not care about the scope ID value of the IPv6 link-local addresses and expects this information has already been extracted into the bound_dev_if field. Because the same IPv6 link-local address can exist on multiple interfaces the ibcore address resolver gets confused and returns ENETUNREACH. Instead of updating both source address and bound_dev_if just keep the address set to any address until resolving completes. For the sake of code symmetry a similar change has been applied to the IPv4 address resolve path. MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
a733adf4f7
commit
49b050dc8d
@ -257,7 +257,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
|
||||
};
|
||||
struct sockaddr_in dst_tmp = *dst_in;
|
||||
in_port_t src_port;
|
||||
struct sockaddr *saddr;
|
||||
struct sockaddr *saddr = NULL;
|
||||
struct rtentry *rte;
|
||||
struct ifnet *ifp;
|
||||
int error;
|
||||
@ -333,11 +333,6 @@ static int addr4_resolve(struct sockaddr_in *src_in,
|
||||
/* get destination network interface from route */
|
||||
ifp = rte->rt_ifp;
|
||||
dev_hold(ifp);
|
||||
|
||||
/* update source address */
|
||||
src_port = src_in->sin_port;
|
||||
memcpy(src_in, saddr, rdma_addr_size(saddr));
|
||||
src_in->sin_port = src_port; /* preserve port number */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -369,6 +364,15 @@ static int addr4_resolve(struct sockaddr_in *src_in,
|
||||
addr->network = RDMA_NETWORK_IPV4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 4 - update source address, if any
|
||||
*/
|
||||
if (saddr != NULL) {
|
||||
src_port = src_in->sin_port;
|
||||
memcpy(src_in, saddr, rdma_addr_size(saddr));
|
||||
src_in->sin_port = src_port; /* preserve port number */
|
||||
}
|
||||
|
||||
if (rte != NULL)
|
||||
RTFREE(rte);
|
||||
|
||||
@ -412,7 +416,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
};
|
||||
struct sockaddr_in6 dst_tmp = *dst_in;
|
||||
in_port_t src_port;
|
||||
struct sockaddr *saddr;
|
||||
struct sockaddr *saddr = NULL;
|
||||
struct rtentry *rte;
|
||||
struct ifnet *ifp;
|
||||
int error;
|
||||
@ -502,10 +506,6 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
/* get destination network interface from route */
|
||||
ifp = rte->rt_ifp;
|
||||
dev_hold(ifp);
|
||||
|
||||
src_port = src_in->sin6_port;
|
||||
memcpy(src_in, saddr, rdma_addr_size(saddr));
|
||||
src_in->sin6_port = src_port; /* preserve port number */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -534,6 +534,15 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
addr->network = RDMA_NETWORK_IPV6;
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 4 - update source address, if any
|
||||
*/
|
||||
if (saddr != NULL) {
|
||||
src_port = src_in->sin6_port;
|
||||
memcpy(src_in, saddr, rdma_addr_size(saddr));
|
||||
src_in->sin6_port = src_port; /* preserve port number */
|
||||
}
|
||||
|
||||
if (rte != NULL)
|
||||
RTFREE(rte);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user