mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 09:16:20 +00:00
nd6: Update RA link-local addr option length check
lwIP might support different hardware address lengths (when using Ethernet and 6LoWPAN for instance). Match provided lladdr length from Router Advertisement to the current network interface instead of comparing against longest that can be stored.
This commit is contained in:
parent
4f78da983f
commit
7807f706f3
@ -6,6 +6,11 @@ HISTORY
|
|||||||
|
|
||||||
* [Enter new changes just after this line - do not remove this line]
|
* [Enter new changes just after this line - do not remove this line]
|
||||||
|
|
||||||
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2023-09-28: Erik Ekman
|
||||||
|
* Fix ND6 Router Advertisement parsing when NETIF_MAX_HWADDR_LEN is above 6.
|
||||||
|
|
||||||
(STABLE-2.2.0):
|
(STABLE-2.2.0):
|
||||||
|
|
||||||
2018-10-02: Dirk Ziegelmeier
|
2018-10-02: Dirk Ziegelmeier
|
||||||
|
@ -687,11 +687,12 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
case ND6_OPTION_TYPE_SOURCE_LLADDR:
|
case ND6_OPTION_TYPE_SOURCE_LLADDR:
|
||||||
{
|
{
|
||||||
struct lladdr_option *lladdr_opt;
|
struct lladdr_option *lladdr_opt;
|
||||||
if (option_len < sizeof(struct lladdr_option)) {
|
if (option_len < ND6_LLADDR_OPTION_MIN_LENGTH) {
|
||||||
goto lenerr_drop_free_return;
|
goto lenerr_drop_free_return;
|
||||||
}
|
}
|
||||||
lladdr_opt = (struct lladdr_option *)buffer;
|
lladdr_opt = (struct lladdr_option *)buffer;
|
||||||
if ((default_router_list[i].neighbor_entry != NULL) &&
|
if ((lladdr_opt->length == inp->hwaddr_len) &&
|
||||||
|
(default_router_list[i].neighbor_entry != NULL) &&
|
||||||
(default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) {
|
(default_router_list[i].neighbor_entry->state == ND6_INCOMPLETE)) {
|
||||||
SMEMCPY(default_router_list[i].neighbor_entry->lladdr, lladdr_opt->addr, inp->hwaddr_len);
|
SMEMCPY(default_router_list[i].neighbor_entry->lladdr, lladdr_opt->addr, inp->hwaddr_len);
|
||||||
default_router_list[i].neighbor_entry->state = ND6_REACHABLE;
|
default_router_list[i].neighbor_entry->state = ND6_REACHABLE;
|
||||||
|
@ -153,6 +153,7 @@ PACK_STRUCT_END
|
|||||||
/** Link-layer address option. */
|
/** Link-layer address option. */
|
||||||
#define ND6_OPTION_TYPE_SOURCE_LLADDR (0x01)
|
#define ND6_OPTION_TYPE_SOURCE_LLADDR (0x01)
|
||||||
#define ND6_OPTION_TYPE_TARGET_LLADDR (0x02)
|
#define ND6_OPTION_TYPE_TARGET_LLADDR (0x02)
|
||||||
|
#define ND6_LLADDR_OPTION_MIN_LENGTH (2)
|
||||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||||
# include "arch/bpstruct.h"
|
# include "arch/bpstruct.h"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user