summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-06-08 14:41:05 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-06-09 13:04:01 +0200
commit54a3e60b3ebd3621c4dd90b0b49e8e36e4e100d8 (patch)
tree0fbcddb44f0c5737a5ad548a52da763279e66c40 /babeld
parentMerge pull request #11370 from donaldsharp/lib_zebra_cleanup (diff)
downloadfrr-54a3e60b3ebd3621c4dd90b0b49e8e36e4e100d8.tar.xz
frr-54a3e60b3ebd3621c4dd90b0b49e8e36e4e100d8.zip
babeld: Update to ignore unicast hellos
RFC 8966 requires a bit of work to make FRR forward compabitble with it for the moment. tl;dr -> Flags of hellos should be 0 except the main bit and The Unicast Hello bit if set should cause the packet to be ignored. Additionally FRR needs to ignore Hello packets with the interval field set to 0. Fixes: #11349 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'babeld')
-rw-r--r--babeld/message.c84
1 files changed, 63 insertions, 21 deletions
diff --git a/babeld/message.c b/babeld/message.c
index 0ddfda8d7..8d3ee6f34 100644
--- a/babeld/message.c
+++ b/babeld/message.c
@@ -398,27 +398,69 @@ parse_packet(const unsigned char *from, struct interface *ifp,
format_address(from), ifp->name);
/* Nothing right now */
} else if(type == MESSAGE_HELLO) {
- unsigned short seqno, interval;
- int changed;
- unsigned int timestamp = 0;
- DO_NTOHS(seqno, message + 4);
- DO_NTOHS(interval, message + 6);
- debugf(BABEL_DEBUG_COMMON,"Received hello %d (%d) from %s on %s.",
- seqno, interval,
- format_address(from), ifp->name);
- changed = update_neighbour(neigh, seqno, interval);
- update_neighbour_metric(neigh, changed);
- if(interval > 0)
- /* Multiply by 3/2 to allow hellos to expire. */
- schedule_neighbours_check(interval * 15, 0);
- /* Sub-TLV handling. */
- if(len > 8) {
- if(parse_hello_subtlv(message + 8, len - 6, &timestamp) > 0) {
- neigh->hello_send_us = timestamp;
- neigh->hello_rtt_receive_time = babel_now;
- have_hello_rtt = 1;
- }
- }
+ unsigned short seqno, interval, flags;
+ int changed;
+ unsigned int timestamp = 0;
+
+#define BABEL_UNICAST_HELLO 0x8000
+ DO_NTOHS(flags, message + 2);
+
+ /*
+ * RFC 8966 4.6.5
+ * All other bits MUST be sent as a 0 and silently
+ * ignored on reception
+ */
+ if (CHECK_FLAG(flags, ~BABEL_UNICAST_HELLO)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received Hello from %s on %s that does not have all 0's in the unused section of flags, ignoring",
+ format_address(from), ifp->name);
+ continue;
+ }
+
+ /*
+ * RFC 8966 Appendix F
+ * TL;DR -> Please ignore Unicast hellos until FRR's
+ * BABEL is brought up to date
+ */
+ if (CHECK_FLAG(flags, BABEL_UNICAST_HELLO)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received Unicast Hello from %s on %s that FRR is not prepared to understand yet",
+ format_address(from), ifp->name);
+ continue;
+ }
+
+ DO_NTOHS(seqno, message + 4);
+ DO_NTOHS(interval, message + 6);
+ debugf(BABEL_DEBUG_COMMON,
+ "Received hello %d (%d) from %s on %s.", seqno, interval,
+ format_address(from), ifp->name);
+
+ /*
+ * RFC 8966 Appendix F
+ * TL;DR -> Please ignore any Hello packets with the interval
+ * field set to 0
+ */
+ if (interval == 0) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received hello from %s on %s should be ignored as that this version of FRR does not know how to properly handle interval == 0",
+ format_address(from), ifp->name);
+ continue;
+ }
+
+ changed = update_neighbour(neigh, seqno, interval);
+ update_neighbour_metric(neigh, changed);
+ if (interval > 0)
+ /* Multiply by 3/2 to allow hellos to expire. */
+ schedule_neighbours_check(interval * 15, 0);
+ /* Sub-TLV handling. */
+ if (len > 8) {
+ if (parse_hello_subtlv(message + 8, len - 6,
+ &timestamp) > 0) {
+ neigh->hello_send_us = timestamp;
+ neigh->hello_rtt_receive_time = babel_now;
+ have_hello_rtt = 1;
+ }
+ }
} else if(type == MESSAGE_IHU) {
unsigned short txcost, interval;
unsigned char address[16];