net: socket: Allow same port if different address family
It is always possible to bind to same port if the sockets are in different address family. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
12720fec51
commit
37b8dc17bc
1 changed files with 4 additions and 2 deletions
|
@ -132,7 +132,8 @@ static int check_used_port(enum net_ip_protocol proto,
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV6) &&
|
if (IS_ENABLED(CONFIG_NET_IPV6) &&
|
||||||
local_addr->sa_family == AF_INET6) {
|
local_addr->sa_family == AF_INET6) {
|
||||||
if (net_sin6_ptr(&contexts[i].local)->sin6_addr == NULL) {
|
if (net_sin6_ptr(&contexts[i].local)->sin6_addr == NULL ||
|
||||||
|
net_sin6_ptr(&contexts[i].local)->sin6_family != AF_INET6) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +188,8 @@ static int check_used_port(enum net_ip_protocol proto,
|
||||||
}
|
}
|
||||||
} else if (IS_ENABLED(CONFIG_NET_IPV4) &&
|
} else if (IS_ENABLED(CONFIG_NET_IPV4) &&
|
||||||
local_addr->sa_family == AF_INET) {
|
local_addr->sa_family == AF_INET) {
|
||||||
if (net_sin_ptr(&contexts[i].local)->sin_addr == NULL) {
|
if (net_sin_ptr(&contexts[i].local)->sin_addr == NULL ||
|
||||||
|
net_sin_ptr(&contexts[i].local)->sin_family != AF_INET) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue