diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-04-29 02:50:29 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-04-29 02:50:29 +0200 |
commit | 17de3a023f7bde293892b41bfafe5740c8553fc8 (patch) | |
tree | abf6ea6675943bec8a34fccb52b8da11885cb86d | |
parent | b465604eb13fc57ebe240556ebf0d4469690c906 (diff) |
BGP: Fix handling of strange IPv6 link-local-only next hops
There are three common ways how to encode IPv6 link-local-only next hops:
(:: ll), (ll), and (ll ll). We use the first one but we should accept all
three. The patch fixes handling of the last one.
Thanks to Sebastian Hahn for the bugreport.
-rw-r--r-- | proto/bgp/packets.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index ee031c05..78fdd1e0 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1157,7 +1157,10 @@ bgp_decode_next_hop_ip(struct bgp_parse_state *s, byte *data, uint len, rta *a) nh[0] = ipa_from_ip6(get_ip6(data)); nh[1] = ipa_from_ip6(get_ip6(data+16)); - if (ipa_is_ip4(nh[0]) || !ip6_is_link_local(nh[1])) + if (ipa_is_link_local(nh[0])) + { nh[1] = nh[0]; nh[0] = IPA_NONE; } + + if (ipa_is_ip4(nh[0]) || !ipa_is_link_local(nh[1])) nh[1] = IPA_NONE; } else |