Skip to content

Commit

Permalink
babeld: Add MBZ and Reserved field checking
Browse files Browse the repository at this point in the history
Signed-off-by: zmw12306 <[email protected]>
  • Loading branch information
zmw12306 committed Sep 3, 2024
1 parent 9b96394 commit af11e08
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions babeld/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,24 @@ parse_packet(const unsigned char *from, struct interface *ifp,
len = message[1];

if(type == MESSAGE_PADN) {
for (int i = 0; i < len; i++) {
if (message[i + 2] != 0) {
debugf(BABEL_DEBUG_COMMON,"Received pad%d with non zero MBZ field from %s on %s.",
len, format_address(from), ifp->name);
}
}
debugf(BABEL_DEBUG_COMMON,"Received pad%d from %s on %s.",
len, format_address(from), ifp->name);
} else if(type == MESSAGE_ACK_REQ) {
unsigned short nonce, interval;
DO_NTOHS(Reserved, message + 2);
DO_NTOHS(nonce, message + 4);
DO_NTOHS(interval, message + 6);
if (Reserved != 0) {
debugf(BABEL_DEBUG_COMMON,"Received ack-req (%04X %d) with non zero Reserved from %s on %s.",
nonce, interval, format_address(from), ifp->name);
goto done;
}
debugf(BABEL_DEBUG_COMMON,"Received ack-req (%04X %d) from %s on %s.",
nonce, interval, format_address(from), ifp->name);
send_ack(neigh, nonce, interval);
Expand Down

0 comments on commit af11e08

Please sign in to comment.