From: zmw12306 Date: Mon, 24 Mar 2025 19:55:08 +0000 (-0400) Subject: babeld: add check incorrect AE value for NH TLV. X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=eea39974adc641c8c26985709af9b405ef1c9189;p=matthieu%2Ffrr.git 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 --- 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;