From eea39974adc641c8c26985709af9b405ef1c9189 Mon Sep 17 00:00:00 2001 From: zmw12306 Date: Mon, 24 Mar 2025 15:55:08 -0400 Subject: [PATCH] babeld: add check incorrect AE value for NH TLV. According to RFC 8966, for NH TLV, AE SHOULD be 1 (IPv4) or 3 (link-local IPv6), and MUST NOT be 0. Signed-off-by: zmw12306 --- babeld/message.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/babeld/message.c b/babeld/message.c index 5a33d5c288..d7213f5f4f 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -552,6 +552,13 @@ parse_packet(const unsigned char *from, struct interface *ifp, } else if(type == MESSAGE_NH) { unsigned char nh[16]; int rc; + if(message[2] != 1 && message[2] != 3) { + debugf(BABEL_DEBUG_COMMON,"Received NH with incorrect AE %d.", + message[2]); + have_v4_nh = 0; + have_v6_nh = 0; + goto fail; + } rc = network_address(message[2], message + 4, len - 2, nh); if(rc <= 0) { have_v4_nh = 0; -- 2.39.5