--- embedaddon/bird/proto/babel/packets.c	2017/08/22 12:33:54	1.1.1.1
+++ embedaddon/bird/proto/babel/packets.c	2021/03/17 19:50:23	1.1.1.2
@@ -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,10 +104,14 @@ struct babel_tlv_seqno_request {
 } PACKED;
 
 
-#define BABEL_FLAG_DEF_PREFIX	0x80
-#define BABEL_FLAG_ROUTER_ID	0x40
+/* Hello flags */
+#define BABEL_HF_UNICAST	0x8000
 
+/* Update flags */
+#define BABEL_UF_DEF_PREFIX	0x80
+#define BABEL_UF_ROUTER_ID	0x40
 
+
 struct babel_parse_state {
   struct babel_proto *proto;
   struct babel_iface *ifa;
@@ -146,8 +150,6 @@ struct babel_write_state {
 #define TLV_HDR(tlv,t,l) ({ tlv->type = t; tlv->length = l - sizeof(struct babel_tlv); })
 #define TLV_HDR0(tlv,t) TLV_HDR(tlv, t, tlv_data[t].min_length)
 
-#define BYTES(n) ((((uint) n) + 7) / 8)
-
 static inline u16
 get_time16(const void *p)
 {
@@ -312,6 +314,11 @@ babel_read_hello(struct babel_tlv *hdr, union babel_ms
   struct babel_tlv_hello *tlv = (void *) hdr;
   struct babel_msg_hello *msg = &m->hello;
 
+  /* We currently don't support unicast Hello */
+  u16 flags = get_u16(&tlv->flags);
+  if (flags & BABEL_HF_UNICAST)
+    return PARSE_IGNORE;
+
   msg->type = BABEL_TLV_HELLO;
   msg->seqno = get_u16(&tlv->seqno);
   msg->interval = get_time16(&tlv->interval);
@@ -502,13 +509,13 @@ babel_read_update(struct babel_tlv *hdr, union babel_m
     msg->plen = tlv->plen;
     msg->prefix = ipa_from_ip6(get_ip6(buf));
 
-    if (tlv->flags & BABEL_FLAG_DEF_PREFIX)
+    if (tlv->flags & BABEL_UF_DEF_PREFIX)
     {
       put_ip6(state->def_ip6_prefix, msg->prefix);
       state->def_ip6_prefix_seen = 1;
     }
 
-    if (tlv->flags & BABEL_FLAG_ROUTER_ID)
+    if (tlv->flags & BABEL_UF_ROUTER_ID)
     {
       state->router_id = ((u64) _I2(msg->prefix)) << 32 | _I3(msg->prefix);
       state->router_id_seen = 1;
@@ -1080,6 +1087,8 @@ babel_open_socket(struct babel_iface *ifa)
   sk->sport = ifa->cf->port;
   sk->dport = ifa->cf->port;
   sk->iface = ifa->iface;
+  sk->saddr = ifa->addr;
+  sk->vrf = p->p.vrf;
 
   sk->rx_hook = babel_rx_hook;
   sk->tx_hook = babel_tx_hook;