tag : Done
weight : Done
-o Local extensions
+o Local extention
set ipv6 next-hop global: Done
set ipv6 next-hop local : Done
*/
- /* generic as path object to be shared in multiple rules */
-
-static void *
-route_aspath_compile (const char *arg)
-{
- struct aspath *aspath;
-
- aspath = aspath_str2aspath (arg);
- if (! aspath)
- return NULL;
- return aspath;
-}
-
-static void
-route_aspath_free (void *rule)
-{
- struct aspath *aspath = rule;
- aspath_free (aspath);
-}
-
/* 'match peer (A.B.C.D|X:X::X:X)' */
/* Compares the peer specified in the 'match peer' clause with the peer
return RMAP_OKAY;
}
-/* Set as-path prepend rule structure. */
+/* Compile function for as-path prepend. */
+static void *
+route_set_aspath_prepend_compile (const char *arg)
+{
+ struct aspath *aspath;
+
+ aspath = aspath_str2aspath (arg);
+ if (! aspath)
+ return NULL;
+ return aspath;
+}
+
+/* Compile function for as-path prepend. */
+static void
+route_set_aspath_prepend_free (void *rule)
+{
+ struct aspath *aspath = rule;
+ aspath_free (aspath);
+}
+
+/* Set metric rule structure. */
struct route_map_rule_cmd route_set_aspath_prepend_cmd =
{
"as-path prepend",
route_set_aspath_prepend,
- route_aspath_compile,
- route_aspath_free,
+ route_set_aspath_prepend_compile,
+ route_set_aspath_prepend_free,
};
/* `set as-path exclude ASn' */
return RMAP_OKAY;
}
+/* FIXME: consider using route_set_aspath_prepend_compile() and
+ * route_set_aspath_prepend_free(), which two below function are
+ * exact clones of.
+ */
+
+/* Compile function for as-path exclude. */
+static void *
+route_set_aspath_exclude_compile (const char *arg)
+{
+ struct aspath *aspath;
+
+ aspath = aspath_str2aspath (arg);
+ if (! aspath)
+ return NULL;
+ return aspath;
+}
+
+static void
+route_set_aspath_exclude_free (void *rule)
+{
+ struct aspath *aspath = rule;
+ aspath_free (aspath);
+}
+
/* Set ASn exlude rule structure. */
struct route_map_rule_cmd route_set_aspath_exclude_cmd =
{
"as-path exclude",
route_set_aspath_exclude,
- route_aspath_compile,
- route_aspath_free,
+ route_set_aspath_exclude_compile,
+ route_set_aspath_exclude_free,
};
/* `set community COMMUNITY' */
XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
}
-/* Set origin rule structure. */
+/* Set metric rule structure. */
struct route_map_rule_cmd route_set_origin_cmd =
{
"origin",
XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
}
-/* Set originator-id rule structure. */
+/* Set metric rule structure. */
struct route_map_rule_cmd route_set_originator_id_cmd =
{
"originator-id",
/* neighbor next-hop-self. */
DEFUN (neighbor_nexthop_self,
neighbor_nexthop_self_cmd,
- NEIGHBOR_CMD2 "next-hop-self {all}",
+ NEIGHBOR_CMD2 "next-hop-self",
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
- "Disable the next hop calculation for this neighbor\n"
- "Apply also to ibgp-learned routes when acting as a route reflector\n")
+ "Disable the next hop calculation for this neighbor\n")
{
- u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
- int rc;
-
- /* Check if "all" is specified */
- if (argv[1] != NULL)
- flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
- else
- unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
+ return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
+ bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
+}
- rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- if ( rc == CMD_SUCCESS && unset )
- rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), unset);
- return rc;
+/* neighbor next-hop-self. */
+DEFUN (neighbor_nexthop_self_force,
+ neighbor_nexthop_self_force_cmd,
+ NEIGHBOR_CMD2 "next-hop-self force",
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Disable the next hop calculation for this neighbor\n"
+ "Set the next hop to self for reflected routes\n")
+{
+ return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
+ bgp_node_safi (vty),
+ (PEER_FLAG_FORCE_NEXTHOP_SELF |
+ PEER_FLAG_NEXTHOP_SELF));
}
DEFUN (no_neighbor_nexthop_self,
no_neighbor_nexthop_self_cmd,
- NO_NEIGHBOR_CMD2 "next-hop-self {all}",
+ NO_NEIGHBOR_CMD2 "next-hop-self",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
- "Disable the next hop calculation for this neighbor\n"
- "Apply also to ibgp-learned routes when acting as a route reflector\n")
+ "Disable the next hop calculation for this neighbor\n")
{
return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
bgp_node_safi (vty),
- PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
+ (PEER_FLAG_NEXTHOP_SELF |
+ PEER_FLAG_FORCE_NEXTHOP_SELF));
}
+ALIAS (no_neighbor_nexthop_self,
+ no_neighbor_nexthop_self_force_cmd,
+ NO_NEIGHBOR_CMD2 "next-hop-self force",
+ NO_STR
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Disable the next hop calculation for this neighbor\n"
+ "Set the next hop to self for reflected routes\n")
+
/* neighbor as-override */
DEFUN (neighbor_as_override,
neighbor_as_override_cmd,
vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
+
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
- CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF_ALL))
+ CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
+ /* "neighbor next-hop-self force" commands. */
+ install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd);
+
/* "neighbor as-override" commands. */
install_element (BGP_NODE, &neighbor_as_override_cmd);
install_element (BGP_NODE, &no_neighbor_as_override_cmd);
{ PEER_FLAG_ORF_PREFIX_SM, 1, peer_change_reset },
{ PEER_FLAG_ORF_PREFIX_RM, 1, peer_change_reset },
{ PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED, 0, peer_change_reset_out },
- { PEER_FLAG_NEXTHOP_SELF_ALL, 1, peer_change_reset_out },
+ { PEER_FLAG_FORCE_NEXTHOP_SELF, 1, peer_change_reset_out },
{ PEER_FLAG_AS_OVERRIDE, 1, peer_change_reset_out },
{ 0, 0, 0 }
};
VTY_NEWLINE);
/* Nexthop self. */
- if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF)
+ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_FORCE_NEXTHOP_SELF)
&& ! peer->af_group[afi][safi])
- vty_out (vty, " neighbor %s next-hop-self%s%s", addr,
- peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF_ALL) ?
- " all" : "", VTY_NEWLINE);
+ vty_out (vty, " neighbor %s next-hop-self force%s",
+ addr, VTY_NEWLINE);
+ else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF)
+ && ! peer->af_group[afi][safi])
+ vty_out (vty, " neighbor %s next-hop-self%s", addr, VTY_NEWLINE);
/* remove-private-AS */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) && !peer->af_group[afi][safi])