]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Fix route-map peer-address configuration and operation.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 12 Jun 2015 14:59:08 +0000 (07:59 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 12 Jun 2015 14:59:08 +0000 (07:59 -0700)
bgpd/bgp_routemap.c

index 57f67e6de0cb91eb10a6ffd9e2c75946c53bdc42..81786541876b55c5960546b687fd2ec697a54cb9 100644 (file)
@@ -2326,31 +2326,35 @@ route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
                                              peer_addr_buf,
                                              INET6_ADDRSTRLEN),
                     &peer_address);
+          /* Set next hop value and length in attribute. */
+          if (IN6_IS_ADDR_LINKLOCAL(&peer_address))
+            {
+              (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local = peer_address;
+              if (bgp_info->attr->extra->mp_nexthop_len != 32)
+                bgp_info->attr->extra->mp_nexthop_len = 32;
+            }
+          else
+            {
+              (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global = peer_address;
+              if (bgp_info->attr->extra->mp_nexthop_len == 0)
+                bgp_info->attr->extra->mp_nexthop_len = 16;
+            }
+
        }
       else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT))
        {
+          /* The next hop value will be set as part of packet rewrite.
+           * Set the flags here to indicate that rewrite needs to be done.
+           * Also, clear the value - we clear both global and link-local
+           * nexthops, whether we send one or both is determined elsewhere.
+           */
          SET_FLAG(bgp_info->attr->rmap_change_flags,
                   BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
           /* clear next hop value. */
           memset (&((bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global),
                   0, sizeof (struct in6_addr));
-       }
-
-      if (IN6_IS_ADDR_LINKLOCAL(&peer_address))
-       {
-         /* The next hop value will be set as part of packet rewrite. */
-
-         /* Set nexthop length. */
-         if (bgp_info->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
-           bgp_info->attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
-       }
-      else
-       {
-         /* The next hop value will be set as part of packet rewrite. */
-
-         /* Set nexthop length. */
-         if (bgp_info->attr->extra->mp_nexthop_len == 0)
-           bgp_info->attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
+          memset (&((bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local),
+                  0, sizeof (struct in6_addr));
        }
     }
 
@@ -4404,7 +4408,7 @@ DEFUN (no_set_ipv6_nexthop_peer,
        "IPv6 next-hop address\n"
        )
 {
-  return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop", argv[0]);
+  return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop peer-address", NULL);
 }
 
 DEFUN (set_ipv6_nexthop_global,