net: ip: Fix IPv6 RS message doesn't comply RFC4291

Current implementation of net_ipv6_send_rs() uses
net_ipv6_addr_create_ll_allnodes_mcast() for creating RS packet.
As result we send RS packet to all-nodes destination [FF02::1],
but RFC4291 requires all-routers destination [FF02::2] for RS packets.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
This commit is contained in:
Eug Krashtan 2020-07-11 10:27:29 +03:00 committed by Carles Cufí
parent a3621cecd5
commit ad59e7fec5
2 changed files with 11 additions and 1 deletions

View file

@ -1055,6 +1055,16 @@ static inline void net_ipv6_addr_create_ll_allnodes_mcast(struct in6_addr *addr)
net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001);
}
/**
* @brief Create link local allrouters multicast IPv6 address
*
* @param addr IPv6 address
*/
static inline void net_ipv6_addr_create_ll_allrouters_mcast(struct in6_addr *addr)
{
net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002);
}
/**
* @brief Create IPv6 address interface identifier
*

View file

@ -1968,7 +1968,7 @@ int net_ipv6_send_rs(struct net_if *iface)
struct in6_addr dst;
struct net_pkt *pkt;
net_ipv6_addr_create_ll_allnodes_mcast(&dst);
net_ipv6_addr_create_ll_allrouters_mcast(&dst);
src = net_if_ipv6_select_src_addr(iface, &dst);
if (!net_ipv6_is_addr_unspecified(src)) {