diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-07-01 00:43:24 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-07-01 00:43:24 +0200 |
commit | 93c1defdb03729ae8b41752d2155dff65964df5b (patch) | |
tree | 0e3d6a75d857c82a18f5584fa5bc08c828ae856d /proto | |
parent | daf113ac66fb9dc83a904ce9bcc68e90830624d0 (diff) |
BGP: Fix parsing of MPLS withdrawals
RFC 3107 was bit vague with regard to labeled withdrawals, RFC 8277
clarified that. The old code was incompatible with some implementations,
namely with Juniper.
Thanks to Vadim Fedorenko for the original patch.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bgp/packets.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 190fd6fe..d67ef0b2 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1165,9 +1165,10 @@ bgp_decode_mpls_labels(struct bgp_parse_state *s, byte **pos, uint *len, uint *p ADVANCE(*pos, *len, 3); *pxlen -= 24; - /* Withdraw: Magic label stack value 0x800000 according to RFC 3107, section 3, last paragraph */ - if (!a && !s->err_withdraw && (lnum == 1) && (label == BGP_MPLS_MAGIC)) - break; + /* RFC 8277 2.4 - withdraw does not have variable-size MPLS stack but + fixed-size 24-bit Compatibility field, which MUST be ignored */ + if (!a && !s->err_withdraw) + return; } while (!(label & BGP_MPLS_BOS)); |