mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #15370 from YannCharbon/sockopt_interface_id
Fix socket default interface ID only being used partiallypull/15378/head
commit
a852898ad1
|
@ -1570,8 +1570,17 @@ struct protocol_interface_info_entry *socket_interface_determine(const socket_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try a routing table entry for greater-than-realm scope */
|
/* For greater-than-realm scope, use default interface if a default interface ID */
|
||||||
|
/* has been set (e.g. using setsockopt), else try a routing table entry */
|
||||||
if (addr_ipv6_scope(buf->dst_sa.address, NULL) > IPV6_SCOPE_REALM_LOCAL) {
|
if (addr_ipv6_scope(buf->dst_sa.address, NULL) > IPV6_SCOPE_REALM_LOCAL) {
|
||||||
|
if (socket_ptr->default_interface_id != -1) {
|
||||||
|
cur_interface = protocol_stack_interface_info_get_by_id(socket_ptr->default_interface_id);
|
||||||
|
if (cur_interface) {
|
||||||
|
return cur_interface;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ipv6_buffer_route(buf)) {
|
if (ipv6_buffer_route(buf)) {
|
||||||
return buf->interface;
|
return buf->interface;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue