net: if: Add helper to select src interface for a IPv4 dst addr
If we have multiple network interfaces and we want to send
a IPv4 network packet to certain destination, then this new
helper can be used to figure out what network interface to use.
Note that this commit only adds support to select the correct network
interface according to destination IPv4 address. This does not enable
any automatic routing to happen.
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 fa3b120..51b9b9e 100644
--- a/include/net/net_if.h
+++ b/include/net/net_if.h
@@ -1375,6 +1375,17 @@
struct in_addr *addr);
/**
+ * @brief Get a network interface that should be used when sending
+ * IPv4 network data to destination.
+ *
+ * @param dst IPv4 destination address
+ *
+ * @return Pointer to network interface to use, NULL if no suitable interface
+ * could be found.
+ */
+struct net_if *net_if_ipv4_select_src_iface(struct in_addr *dst);
+
+/**
* @brief Set IPv4 netmask for an interface.
*
* @param iface Interface to use.