net: ipv6: Move unspecified address getter to ipv6.c
More logical place for net_ipv6_unspecified_address() is in ipv6.c instead of net_if.c. Removing the net_if_ipv6_unspecified_addr() variant as it is no longer needed. Change-Id: Ib5b4f6748030a8bf50fb848a87eef2968e2bcbc8 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
59f4810d0a
commit
1b58d970ca
6 changed files with 12 additions and 23 deletions
|
@ -806,13 +806,6 @@ static inline uint32_t net_if_ipv6_get_retrans_timer(struct net_if *iface)
|
||||||
const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *iface,
|
const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *iface,
|
||||||
struct in6_addr *dst);
|
struct in6_addr *dst);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return IPv6 any address (all zeros, ::)
|
|
||||||
*
|
|
||||||
* @return IPv6 any address with all bits set to zero.
|
|
||||||
*/
|
|
||||||
const struct in6_addr *net_if_ipv6_unspecified_addr(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a IPv6 link local address in a given state.
|
* @brief Get a IPv6 link local address in a given state.
|
||||||
*
|
*
|
||||||
|
|
|
@ -471,17 +471,12 @@ static inline bool net_is_ipv6_ll_addr(const struct in6_addr *addr)
|
||||||
((addr->s6_addr[1]) == 0x80);
|
((addr->s6_addr[1]) == 0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct in6_addr *net_if_ipv6_unspecified_addr(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return pointer to any (all bits zeros) IPv6 address.
|
* @brief Return pointer to any (all bits zeros) IPv6 address.
|
||||||
*
|
*
|
||||||
* @return Any IPv6 address.
|
* @return Any IPv6 address.
|
||||||
*/
|
*/
|
||||||
static inline const struct in6_addr *net_ipv6_unspecified_address(void)
|
const struct in6_addr *net_ipv6_unspecified_address(void);
|
||||||
{
|
|
||||||
return net_if_ipv6_unspecified_addr();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return pointer to any (all bits zeros) IPv4 address.
|
* @brief Return pointer to any (all bits zeros) IPv4 address.
|
||||||
|
|
|
@ -285,6 +285,13 @@ struct in6_addr *net_ipv6_nbr_lookup_by_index(struct net_if *iface,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_IPV6_ND */
|
#endif /* CONFIG_NET_IPV6_ND */
|
||||||
|
|
||||||
|
const struct in6_addr *net_ipv6_unspecified_address(void)
|
||||||
|
{
|
||||||
|
static const struct in6_addr addr = IN6ADDR_ANY_INIT;
|
||||||
|
|
||||||
|
return &addr;
|
||||||
|
}
|
||||||
|
|
||||||
struct net_buf *net_ipv6_create_raw(struct net_buf *buf,
|
struct net_buf *net_ipv6_create_raw(struct net_buf *buf,
|
||||||
uint16_t reserve,
|
uint16_t reserve,
|
||||||
const struct in6_addr *src,
|
const struct in6_addr *src,
|
||||||
|
@ -1394,7 +1401,7 @@ int net_ipv6_send_ns(struct net_if *iface,
|
||||||
if (is_my_address) {
|
if (is_my_address) {
|
||||||
/* DAD */
|
/* DAD */
|
||||||
net_ipaddr_copy(&NET_IPV6_BUF(buf)->src,
|
net_ipaddr_copy(&NET_IPV6_BUF(buf)->src,
|
||||||
net_if_ipv6_unspecified_addr());
|
net_ipv6_unspecified_address());
|
||||||
|
|
||||||
NET_IPV6_BUF(buf)->len[1] -= llao_len;
|
NET_IPV6_BUF(buf)->len[1] -= llao_len;
|
||||||
|
|
||||||
|
|
|
@ -695,12 +695,6 @@ struct net_if_router *net_if_ipv6_router_add(struct net_if *iface,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct in6_addr *net_if_ipv6_unspecified_addr(void)
|
|
||||||
{
|
|
||||||
static const struct in6_addr addr = IN6ADDR_ANY_INIT;
|
|
||||||
|
|
||||||
return &addr;
|
|
||||||
}
|
|
||||||
struct in6_addr *net_if_ipv6_get_ll(struct net_if *iface,
|
struct in6_addr *net_if_ipv6_get_ll(struct net_if *iface,
|
||||||
enum net_addr_state addr_state)
|
enum net_addr_state addr_state)
|
||||||
{
|
{
|
||||||
|
@ -892,7 +886,7 @@ const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *dst_iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src) {
|
if (!src) {
|
||||||
return net_if_ipv6_unspecified_addr();
|
return net_ipv6_unspecified_address();
|
||||||
}
|
}
|
||||||
|
|
||||||
return src;
|
return src;
|
||||||
|
|
|
@ -2970,7 +2970,7 @@ int net_rpl_dao_send(struct net_if *iface,
|
||||||
|
|
||||||
src = net_if_ipv6_select_src_addr(iface, dst);
|
src = net_if_ipv6_select_src_addr(iface, dst);
|
||||||
|
|
||||||
if (net_ipv6_addr_cmp(src, net_if_ipv6_unspecified_addr())) {
|
if (net_ipv6_addr_cmp(src, net_ipv6_unspecified_address())) {
|
||||||
NET_DBG("Invalid src addr %s found",
|
NET_DBG("Invalid src addr %s found",
|
||||||
net_sprint_ipv6_addr(src));
|
net_sprint_ipv6_addr(src));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -328,7 +328,7 @@ static bool run_tests(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(net_if_ipv6_unspecified_addr(), &any, sizeof(any))) {
|
if (memcmp(net_ipv6_unspecified_address(), &any, sizeof(any))) {
|
||||||
printk("My IPv6 unspecified address check failed\n");
|
printk("My IPv6 unspecified address check failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue