diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-04-23 23:15:07 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-04-23 23:15:07 +0200 |
commit | 64cf11f544257cae443d899111be1299b1ec0684 (patch) | |
tree | fda1268da6605decf27f18e53ae76737b3ebbe14 | |
parent | f307842ad85396f8186fa049d551b6cde9925484 (diff) | |
download | bird-64cf11f544257cae443d899111be1299b1ec0684.tar bird-64cf11f544257cae443d899111be1299b1ec0684.zip |
Fixes BGPv6 bug - missing endianity conversion.
Also removes code skipping SNPAs
(obsoleted by newer RFCs, should be ignored).
-rw-r--r-- | proto/bgp/packets.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index ce3d71e..1370ee7 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -777,19 +777,14 @@ bgp_do_rx_update(struct bgp_conn *conn, /* Create fake NEXT_HOP attribute */ if (len < 1 || (*x != 16 && *x != 32) || len < *x + 2) goto bad; - memcpy(bgp_attach_attr_wa(&a0->eattrs, bgp_linpool, BA_NEXT_HOP, 16), x+1, 16); - len -= *x + 2; - x += *x + 1; - /* Ignore SNPA info */ - i = *x++; - while (i--) - { - if (len < 1 || len < 1 + *x) - goto bad; - len -= *x + 1; - x += *x + 1; - } + byte *nh = bgp_attach_attr_wa(&a0->eattrs, bgp_linpool, BA_NEXT_HOP, 16); + memcpy(nh, x+1, 16); + ipa_ntoh(*(ip_addr *)nh); + + /* Also ignore one reserved byte */ + len -= *x + 2; + x += *x + 2; if (bgp_get_nexthop(p, a0)) { |