diff --git a/include/net/yaip/net_if.h b/include/net/yaip/net_if.h index cd67423680e..3c4af2b951d 100644 --- a/include/net/yaip/net_if.h +++ b/include/net/yaip/net_if.h @@ -79,6 +79,31 @@ struct net_if_mcast_addr { struct net_addr address; }; +#if defined(CONFIG_NET_IPV6) +/** + * @brief Network Interface IPv6 prefixes + * + * Stores the multicast IP addresses assigned to this network interface. + * + */ +struct net_if_ipv6_prefix { + /** Is this prefix used or not */ + bool is_used; + + /** IPv6 prefix */ + struct in6_addr prefix; + + /** Prefix length */ + uint8_t len; + + /** Is the IP prefix valid forever */ + bool is_infinite; + + /** Prefix lifetime */ + struct nano_timer lifetime; +}; +#endif /* CONFIG_NET_IPV6 */ + /** * @brief Network Interface structure * @@ -105,12 +130,16 @@ struct net_if { #if defined(CONFIG_NET_IPV6) #define NET_IF_MAX_IPV6_ADDR CONFIG_NET_IFACE_UNICAST_IPV6_ADDR_COUNT #define NET_IF_MAX_IPV6_MADDR CONFIG_NET_IFACE_MCAST_IPV6_ADDR_COUNT +#define NET_IF_MAX_IPV6_PREFIX CONFIG_NET_IFACE_IPV6_PREFIX_COUNT struct { /** Unicast IP addresses */ struct net_if_addr unicast[NET_IF_MAX_IPV6_ADDR]; /** Multicast IP addresses */ struct net_if_mcast_addr mcast[NET_IF_MAX_IPV6_MADDR]; + + /** Prefixes */ + struct net_if_ipv6_prefix prefix[NET_IF_MAX_IPV6_PREFIX]; } ipv6; uint8_t hop_limit; diff --git a/net/yaip/Kconfig b/net/yaip/Kconfig index 21361f179e8..219468e7643 100644 --- a/net/yaip/Kconfig +++ b/net/yaip/Kconfig @@ -27,3 +27,7 @@ config NET_IFACE_UNICAST_IPV6_ADDR_COUNT config NET_IFACE_MCAST_IPV6_ADDR_COUNT int "Max number of multicast IPv6 addresses assigned to network interface" default 1 + +config NET_IFACE_IPV6_PREFIX_COUNT + int "Max number of IPv6 prefixes assigned to network interface" + default 2