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>
This commit is contained in:
parent
5c4bcf110d
commit
e2083ea099
1 changed files with 17 additions and 0 deletions
|
@ -1553,6 +1553,23 @@ static inline uint8_t net_if_ipv4_get_ttl(struct net_if *iface)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue