]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixes setting of IP addresses to route attributes (NEXT_HOP).
authorOndrej Zajicek <santiago@crfreenet.org>
Fri, 18 Sep 2009 11:59:04 +0000 (13:59 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Fri, 18 Sep 2009 11:59:04 +0000 (13:59 +0200)
filter/filter.c
proto/bgp/packets.c

index 6356632b1d1d7a9d7d696f98f6bbf24a7b85d19f..8c0c4ab5a76da24487c5cec9df686334912a5cd5 100644 (file)
@@ -664,6 +664,7 @@ interpret(struct f_inst *what)
        struct adata *ad = lp_alloc(f_pool, sizeof(struct adata) + len);
        ad->length = len;
        (* (ip_addr *) ad->data) = v1.val.px.ip;
+       l->attrs[0].u.ptr = ad;
        break;
       case EAF_TYPE_AS_PATH:
        if (v1.type != T_PATH)
index 49c2add6fefe24e218e950a29040d20203196b99..482b707dbc7c21acd4a59382b352f5ee5b7f6ac4 100644 (file)
@@ -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
                    {