[PATCH] babel: Ignore Hello TLVs with unicast flag set

Toke Høiland-Jørgensen toke at toke.dk
Mon Oct 30 14:30:25 CET 2017


RFC6126bis introduces a flags field for the Hello TLV, and adds a unicast flag
that is used to signify that a hello was sent as unicast. This adds parsing of
the flags field and ignores such unicast hellos, which preserves compatibility
until we can add a proper implementation of the unicast hello mechanism.

Signed-off-by: Toke Høiland-Jørgensen <toke at toke.dk>
---
 proto/babel/packets.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/proto/babel/packets.c b/proto/babel/packets.c
index efe05678..597ed60d 100644
--- a/proto/babel/packets.c
+++ b/proto/babel/packets.c
@@ -40,7 +40,7 @@ struct babel_tlv_ack {
 struct babel_tlv_hello {
   u8 type;
   u8 length;
-  u16 reserved;
+  u16 flags;
   u16 seqno;
   u16 interval;
 } PACKED;
@@ -104,8 +104,9 @@ struct babel_tlv_seqno_request {
 } PACKED;
 
 
-#define BABEL_FLAG_DEF_PREFIX	0x80
-#define BABEL_FLAG_ROUTER_ID	0x40
+#define BABEL_FLAG_DEF_PREFIX		0x80
+#define BABEL_FLAG_ROUTER_ID		0x40
+#define BABEL_FLAG_UNICAST_HELLO 	0x8000
 
 
 struct babel_parse_state {
@@ -340,6 +341,12 @@ babel_read_hello(struct babel_tlv *hdr, union babel_msg *m,
 {
   struct babel_tlv_hello *tlv = (void *) hdr;
   struct babel_msg_hello *msg = &m->hello;
+  u16 flags;
+
+  /* We currently don't support unicast Hello */
+  flags = get_u16(&tlv->flags);
+  if (flags & BABEL_FLAG_UNICAST_HELLO)
+	  return PARSE_IGNORE;
 
   msg->type = BABEL_TLV_HELLO;
   msg->seqno = get_u16(&tlv->seqno);
-- 
2.14.2



More information about the Bird-users mailing list