net: if: Add function to set IPv4 ttl to interface
We had a functio to get IPv4 ttl but none for setting it.
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 40b110b..807fcf4 100644
--- a/include/net/net_if.h
+++ b/include/net/net_if.h
@@ -1554,6 +1554,23 @@
}
/**
+ * @brief Set IPv4 time-to-live value specified to a given interface
+ *
+ * @param iface Network interface
+ * @param ttl Time-to-live value
+ */
+static inline void net_if_ipv4_set_ttl(struct net_if *iface, uint8_t ttl)
+{
+#if defined(CONFIG_NET_NATIVE_IPV4)
+ if (!iface->config.ip.ipv4) {
+ return;
+ }
+
+ iface->config.ip.ipv4->ttl = ttl;
+#endif
+}
+
+/**
* @brief Check if this IPv4 address belongs to one of the interfaces.
*
* @param addr IPv4 address