summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-01-02 16:57:45 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-01-02 16:57:45 +0100
commitd493d0f180e3df1f33d344d8b28cc1743201210b (patch)
tree12f7d0feac582708b1fea3f73a08838b7c10ac3e /proto
parente62cd033079c4bc988a467f4122c7c276c77fdde (diff)
BGP: Fix unknown attribute handling
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/attrs.c3
-rw-r--r--proto/bgp/packets.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index fdc981ca..0f41f818 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -701,7 +701,8 @@ bgp_format_mpls_label_stack(eattr *a, byte *buf, uint size)
static inline void
bgp_decode_unknown(struct bgp_parse_state *s, uint code, uint flags, byte *data, uint len, ea_list **to)
{
- bgp_set_attr_data(to, s->pool, code, flags, data, len);
+ /* Cannot use bgp_set_attr_data() as it works on known attributes only */
+ ea_set_attr_data(to, s->pool, EA_CODE(EAP_BGP, code), flags, EAF_TYPE_OPAQUE, data, len);
}
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index ca942880..95a974eb 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2284,6 +2284,8 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, uint len)
if (s.attr_len)
ea = bgp_decode_attrs(&s, s.attrs, s.attr_len);
+ else
+ ea = NULL;
/* Check for End-of-RIB marker */
if (!s.attr_len && !s.ip_unreach_len && !s.ip_reach_len)