[PATCH] babel: Ignore Hello TLVs with unicast flag set
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@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
Toke Høiland-Jørgensen <toke@toke.dk> writes:
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@toke.dk>
I have a partial implementation of the unicast hello mechanism lying around, but it is written before we agreed on the details, so it needs to be updated. I'll get around to that and send it along later, but for now this patch at least guarantees that we are compatible with any other implementation that does send unicast hellos. -Toke
On Mon, Oct 30, 2017 at 02:30:25PM +0100, Toke Høiland-Jørgensen wrote:
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.
Thanks, will merge. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Ondrej Zajicek -
Toke Høiland-Jørgensen