]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixes BGPv6 bug - missing endianity conversion.
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 23 Apr 2009 21:15:07 +0000 (23:15 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 23 Apr 2009 21:15:07 +0000 (23:15 +0200)
Also removes code skipping SNPAs
(obsoleted by newer RFCs, should be ignored).

proto/bgp/packets.c

index ce3d71e202272fb1b2975a80c74b8a1a1bf72c53..1370ee709d438efd0f1d176198ecd6c25beb6585 100644 (file)
@@ -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))
        {