From cd1d99611e445c9fe2452d05627ccfc624f35c39 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 19 Sep 2017 19:55:37 +0200 Subject: BGP: Shutdown communication (RFC 8203) The patch implements BGP Administrative Shutdown Communication (RFC 8203) allowing BGP operators to pass messages related to BGP session administrative shutdown/restart. It handles both transmit and receive of shutdown messages. Messages are logged and may be displayed by show protocol all command. Thanks to Job Snijders for the basic patch. --- proto/babel/packets.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'proto/babel') diff --git a/proto/babel/packets.c b/proto/babel/packets.c index 90421836..e9c6d51d 100644 --- a/proto/babel/packets.c +++ b/proto/babel/packets.c @@ -146,8 +146,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) { -- cgit v1.2.3 From 1e8721e2aeccfbc3f533e8b8abc07582cee77e9a Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 28 Nov 2017 19:33:33 +0100 Subject: Babel: Parse flags in Hello TLV 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 to Toke Hoiland-Jorgensen for the patch. --- proto/babel/packets.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'proto/babel') diff --git a/proto/babel/packets.c b/proto/babel/packets.c index e9c6d51d..768858d0 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,12 @@ 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 { @@ -310,6 +314,11 @@ 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; + /* 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); @@ -500,13 +509,13 @@ babel_read_update(struct babel_tlv *hdr, union babel_msg *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; -- cgit v1.2.3