]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: Hop Count must not be 0.
authorzmw12306 <zmw12306@gmail.com>
Mon, 31 Mar 2025 04:01:53 +0000 (00:01 -0400)
committerzmw12306 <zmw12306@gmail.com>
Mon, 31 Mar 2025 04:01:53 +0000 (00:01 -0400)
According to RFC 8966:
Hop Count The maximum number of times that this TLV may be forwarded, plus 1. This MUST NOT be 0.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
babeld/message.c

index 5a33d5c288ac6d6885143720f338ca99ba2f3e71..d72736f21e1f130ea22e86580116f64b08ccf5c7 100644 (file)
@@ -734,6 +734,10 @@ parse_packet(const unsigned char *from, struct interface *ifp,
                    format_prefix(prefix, plen),
                    format_address(from), ifp->name,
                    format_eui64(message + 8), seqno);
+            if(message[6] == 0) {
+                debugf(BABEL_DEBUG_COMMON, "Received request with invalid hop count 0");
+                goto done;
+            }
             handle_request(neigh, prefix, plen, message[6], seqno, message + 8);
         } else {
             debugf(BABEL_DEBUG_COMMON,"Received unknown packet type %d from %s on %s.",