diff options
| author | zmw12306 <zmw12306@gmail.com> | 2025-03-24 15:55:08 -0400 |
|---|---|---|
| committer | zmw12306 <zmw12306@gmail.com> | 2025-03-24 15:55:08 -0400 |
| commit | eea39974adc641c8c26985709af9b405ef1c9189 (patch) | |
| tree | 90d0106cbb3acbdaf28eaa3b6acb3feb5bb0542a /babeld | |
| parent | 44c4743e08710fd9dda12105ff6fbec2547faf51 (diff) | |
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 <zmw12306@gmail.com>
Diffstat (limited to 'babeld')
| -rw-r--r-- | babeld/message.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |
