]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: Add a check to prevent all-ones case
authorzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 19:21:27 +0000 (15:21 -0400)
committerzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 19:21:27 +0000 (15:21 -0400)
A router-id MUST NOT consist of either all binary zeroes (0000000000000000 hexadecimal) or all binary ones (FFFFFFFFFFFFFFFF hexadecimal).

Signed-off-by: zmw12306 <zmw12306@gmail.com>
babeld/babeld.c

index 4e68f05df4319fffe5302ae3ff5843ed7105df0d..c776df0d2bdab243e784b9fd7e218e985f84a025 100644 (file)
@@ -212,7 +212,8 @@ static void babel_init_routing_process(struct event *thread)
     babel_main_loop(thread);/* this function self-add to the t_update thread */
 }
 
-/* fill "myid" with an unique id (only if myid != {0}). */
+/* fill "myid" with an unique id (only if myid != {0} and myid != {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+     0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}). */
 static void
 babel_get_myid(void)
 {
@@ -222,7 +223,7 @@ babel_get_myid(void)
     int i;
 
     /* if we already have an id (from state file), we return. */
-    if (memcmp(myid, zeroes, 8) != 0) {
+    if (memcmp(myid, zeroes, 8) != 0 && memcmp(myid, ones, 8) != 0) {
         return;
     }