diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-11-18 17:44:34 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-11-18 17:56:51 +0100 |
commit | 0f88200247cc61175c7a1d98a3e935aedce93f3b (patch) | |
tree | 15d9b25b233f2c97856365dd6653752e0c6db607 /proto/bgp | |
parent | 53401bef63013dfee01b65d071ffbd88e457539f (diff) |
BGP: Fix processing of IPv6 Flowspec
During NLRI parsing of IPv6 Flowspec, dst prefix was not properly
extracted from NLRI, therefore a received flow was stored in a different
position in flowspec routing table, and was not reachable by command
'show route <flow>'.
Add proper prefix part accessors to flowspec code and use them from BGP
NLRI parsing code.
Thanks to Alex D. for the bugreport.
Diffstat (limited to 'proto/bgp')
-rw-r--r-- | proto/bgp/packets.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index c3bd600a..0bc63c55 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1831,13 +1831,9 @@ bgp_decode_nlri_flow4(struct bgp_parse_state *s, byte *pos, uint len, rta *a) } /* Decode dst prefix */ - ip4_addr px = IP4_NONE; + ip4_addr px = flow_read_ip4_part(data); uint pxlen = data[1]; - // FIXME: Use some generic function - memcpy(&px, data+2, BYTES(pxlen)); - px = ip4_and(ip4_ntoh(px), ip4_mkmask(pxlen)); - /* Prepare the flow */ net_addr *n = alloca(sizeof(struct net_addr_flow4) + flen); net_fill_flow4(n, px, pxlen, pos, flen); @@ -1923,13 +1919,9 @@ bgp_decode_nlri_flow6(struct bgp_parse_state *s, byte *pos, uint len, rta *a) } /* Decode dst prefix */ - ip6_addr px = IP6_NONE; + ip6_addr px = flow_read_ip6_part(data); uint pxlen = data[1]; - // FIXME: Use some generic function - memcpy(&px, data+2, BYTES(pxlen)); - px = ip6_and(ip6_ntoh(px), ip6_mkmask(pxlen)); - /* Prepare the flow */ net_addr *n = alloca(sizeof(struct net_addr_flow6) + flen); net_fill_flow6(n, px, pxlen, pos, flen); |