babeld: check valid babel port

Add checking for port == 6696.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
This commit is contained in:
zmw12306 2025-04-05 15:14:12 -04:00
parent 44c4743e08
commit 6f88868f32
2 changed files with 6 additions and 0 deletions

View file

@ -183,6 +183,10 @@ static void babel_read_protocol(struct event *thread)
flog_err_sys(EC_LIB_SOCKET, "recv: %s", safe_strerror(errno));
}
} else {
if(ntohs(sin6.sin6_port) != BABEL_PORT) {
return;
}
FOR_ALL_INTERFACES(vrf, ifp) {
if(!if_up(ifp))
continue;

View file

@ -21,6 +21,8 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#undef MAX
#undef MIN
#define BABEL_PORT 6696
#define MAX(x,y) ((x)<=(y)?(y):(x))
#define MIN(x,y) ((x)<=(y)?(x):(y))