babeld: This commit checks whether it is a valid MULTICAST hello, if not, the code logs a debug message and stops processing the packet.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
This commit is contained in:
zmw12306 2025-03-12 23:11:37 -04:00
parent 9b96394d05
commit f71846ec12

View file

@ -411,6 +411,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
unsigned int timestamp = 0;
#define BABEL_UNICAST_HELLO 0x8000
#define BABEL_MULTICAST_HELLO 0x0000
DO_NTOHS(flags, message + 2);
/*
@ -425,6 +426,13 @@ parse_packet(const unsigned char *from, struct interface *ifp,
goto done;
}
if (!CHECK_FLAG(flags, BABEL_MULTICAST_HELLO)) {
debugf(BABEL_DEBUG_COMMON,
"Received Hello from %s on %s with Unknown Flags %d",
format_address(from), ifp->name, flags);
goto done;
}
DO_NTOHS(seqno, message + 4);
DO_NTOHS(interval, message + 6);
debugf(BABEL_DEBUG_COMMON,