net: if: Add net_if_select_src_iface() function
Add a function which returns proper network interface to send either IPv4 or IPv6 network packet to corresponding destination address. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
05d9b0461c
commit
d0205693ae
2 changed files with 44 additions and 1 deletions
|
@ -1502,9 +1502,22 @@ static inline void net_if_ipv4_set_gw(struct net_if *iface,
|
|||
|
||||
net_ipaddr_copy(&iface->config.ip.ipv4->gw, gw);
|
||||
}
|
||||
|
||||
#else
|
||||
#define net_if_ipv4_select_src_iface(...) NULL
|
||||
#endif /* CONFIG_NET_IPV4 */
|
||||
|
||||
/**
|
||||
* @brief Get a network interface that should be used when sending
|
||||
* IPv6 or IPv4 network data to destination.
|
||||
*
|
||||
* @param dst IPv6 or IPv4 destination address
|
||||
*
|
||||
* @return Pointer to network interface to use. Note that the function
|
||||
* will return the default network interface if the best network interface
|
||||
* is not found.
|
||||
*/
|
||||
struct net_if *net_if_select_src_iface(const struct sockaddr *dst);
|
||||
|
||||
/**
|
||||
* @typedef net_if_link_callback_t
|
||||
* @brief Define callback that is called after a network packet
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue