summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorzmw12306 <zmw12306@gmail.com>2025-04-05 15:14:12 -0400
committerzmw12306 <zmw12306@gmail.com>2025-04-05 15:14:12 -0400
commit6f88868f325f0269198fb8e0c00b40a7bbe0e53f (patch)
tree83a1cc031a1ce34ed08726095cb16b734b6f778e /babeld
parent44c4743e08710fd9dda12105ff6fbec2547faf51 (diff)
babeld: check valid babel port
Add checking for port == 6696. Signed-off-by: zmw12306 <zmw12306@gmail.com>
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babeld.c4
-rw-r--r--babeld/babeld.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 4e68f05df4..2050c84582 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -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;
diff --git a/babeld/babeld.h b/babeld/babeld.h
index 17a0381d2c..f4ee09a761 100644
--- a/babeld/babeld.h
+++ b/babeld/babeld.h
@@ -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))