]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: add check incorrect AE value for NH TLV.
authorzmw12306 <zmw12306@gmail.com>
Mon, 24 Mar 2025 19:55:08 +0000 (15:55 -0400)
committerzmw12306 <zmw12306@gmail.com>
Mon, 24 Mar 2025 19:55:08 +0000 (15:55 -0400)
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 <zmw12306@gmail.com>
babeld/message.c

index 5a33d5c288ac6d6885143720f338ca99ba2f3e71..d7213f5f4f1e736f84d8970e870679bd7db49c61 100644 (file)
@@ -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;