summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-04-08 12:28:58 -0500
committerGitHub <noreply@github.com>2025-04-08 12:28:58 -0500
commit4281d2b2c70408fd3a053a8362ceded943db87ad (patch)
treed09b0cc49475ca2e5b2e7008671167ad2398f833 /babeld
parentc7a45b1beb6fe94f9e2826ff05e0d86ada784698 (diff)
parent6f88868f325f0269198fb8e0c00b40a7bbe0e53f (diff)
Merge pull request #18583 from zmw12306/source_port
babeld: check valid babel port
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 c776df0d2b..9943f2e02e 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))