diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-09-18 13:59:04 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-09-18 13:59:04 +0200 |
commit | 54fe0d9230be440d9f627ff7f94a202e6117e1b9 (patch) | |
tree | 2c72ea7fc093a528bbd14bb70542fd912bc6bfa7 /proto/bgp | |
parent | db96fccb31bc0436ec182ff825f592d6c16dc930 (diff) |
Fixes setting of IP addresses to route attributes (NEXT_HOP).
Diffstat (limited to 'proto/bgp')
-rw-r--r-- | proto/bgp/packets.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 49c2add6..482b707d 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -234,7 +234,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf) { struct bgp_proto *p = conn->bgp; struct bgp_bucket *buck; - int size; + int size, second; int remains = BGP_MAX_PACKET_LENGTH - BGP_HEADER_LENGTH - 4; byte *w, *tmp, *tstart; ip_addr *ipp, ip, ip_ll; @@ -292,7 +292,9 @@ bgp_create_update(struct bgp_conn *conn, byte *buf) nh = ea_find(buck->eattrs, EA_CODE(EAP_BGP, BA_NEXT_HOP)); ASSERT(nh); - /* We have two addresses here in 'nh'. Really. */ + /* We have two addresses here in 'nh'. Really. + Unless NEXT_HOP was modified by filter */ + second = (nh->u.ptr->length == NEXT_HOP_LENGTH); ipp = (ip_addr *) nh->u.ptr->data; ip = ipp[0]; ip_ll = IPA_NONE; @@ -316,7 +318,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf) n = neigh_find(&p->p, &ip, 0); if (n && n->iface == p->neigh->iface) { - if (ipa_nonzero(ipp[1])) + if (second && ipa_nonzero(ipp[1])) ip_ll = ipp[1]; else { |