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>
diff --git a/include/net/net_if.h b/include/net/net_if.h
index 5eab96f..49e092e 100644
--- a/include/net/net_if.h
+++ b/include/net/net_if.h
@@ -1502,10 +1502,23 @@
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
* has been sent.