struct bgp_path_info *path;
struct peer *peer;
- if (type == RMAP_BGP) {
- path = object;
- peer = path->peer;
+ if (type != RMAP_BGP)
+ return RMAP_OKAY;
- if (rins->unchanged) {
- SET_FLAG(path->attr->rmap_change_flags,
- BATTR_RMAP_NEXTHOP_UNCHANGED);
- } else if (rins->peer_address) {
- if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN)
- || CHECK_FLAG(peer->rmap_type,
- PEER_RMAP_TYPE_IMPORT))
- && peer->su_remote
- && sockunion_family(peer->su_remote) == AF_INET) {
- path->attr->nexthop.s_addr =
- sockunion2ip(peer->su_remote);
- path->attr->flag |=
- ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
- } 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.
- */
- SET_FLAG(path->attr->rmap_change_flags,
- BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
- path->attr->nexthop.s_addr = 0;
- }
- } else {
- /* Set next hop value. */
+ if (prefix->family == AF_INET6)
+ return RMAP_OKAY;
+
+ path = object;
+ peer = path->peer;
+
+ if (rins->unchanged) {
+ SET_FLAG(path->attr->rmap_change_flags,
+ BATTR_RMAP_NEXTHOP_UNCHANGED);
+ } else if (rins->peer_address) {
+ if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN)
+ || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT))
+ && peer->su_remote
+ && sockunion_family(peer->su_remote) == AF_INET) {
+ path->attr->nexthop.s_addr =
+ sockunion2ip(peer->su_remote);
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
- path->attr->nexthop = *rins->address;
+ } 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.
+ */
SET_FLAG(path->attr->rmap_change_flags,
- BATTR_RMAP_IPV4_NHOP_CHANGED);
- /* case for MP-BGP : MPLS VPN */
- path->attr->mp_nexthop_global_in = *rins->address;
- path->attr->mp_nexthop_len = sizeof(*rins->address);
+ BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
+ path->attr->nexthop.s_addr = 0;
}
+ } else {
+ /* Set next hop value. */
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
+ path->attr->nexthop = *rins->address;
+ SET_FLAG(path->attr->rmap_change_flags,
+ BATTR_RMAP_IPV4_NHOP_CHANGED);
+ /* case for MP-BGP : MPLS VPN */
+ path->attr->mp_nexthop_global_in = *rins->address;
+ path->attr->mp_nexthop_len = sizeof(*rins->address);
}
return RMAP_OKAY;
attr->community = NULL;
/* See the longer comment down below. */
if (old && old->refcnt == 0)
- community_free(old);
+ community_free(&old);
return RMAP_OKAY;
}
merge = community_merge(community_dup(old), rcs->com);
new = community_uniq_sort(merge);
- community_free(merge);
+ community_free(&merge);
} else
new = community_dup(rcs->com);
* Really need to cleanup attribute caching sometime.
*/
if (old && old->refcnt == 0)
- community_free(old);
+ community_free(&old);
/* will be interned by caller if required */
attr->community = new;
struct rmap_com_set *rcs = rule;
if (rcs->com)
- community_free(rcs->com);
+ community_free(&rcs->com);
XFREE(MTYPE_ROUTE_MAP_COMPILED, rcs);
}
merge = community_list_match_delete(community_dup(old),
list);
new = community_uniq_sort(merge);
- community_free(merge);
+ community_free(&merge);
/* HACK: if the old community is not intern'd,
* we should free it here, or all reference to it may be
* Really need to cleanup attribute caching sometime.
*/
if (old->refcnt == 0)
- community_free(old);
+ community_free(&old);
if (new->size == 0) {
path->attr->community = NULL;
path->attr->flag &=
~ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES);
- community_free(new);
+ community_free(&new);
} else {
path->attr->community = new;
path->attr->flag |=
DEFUN (match_evpn_vni,
match_evpn_vni_cmd,
- "match evpn vni (1-16777215)",
+ "match evpn vni " CMD_VNI_RANGE,
MATCH_STR
EVPN_HELP_STR
"Match VNI\n"
DEFUN (no_match_evpn_vni,
no_match_evpn_vni_cmd,
- "no match evpn vni (1-16777215)",
+ "no match evpn vni " CMD_VNI_RANGE,
NO_STR
MATCH_STR
EVPN_HELP_STR
return ret;
}
+ALIAS(no_set_aspath_exclude, no_set_aspath_exclude_all_cmd,
+ "no set as-path exclude",
+ NO_STR SET_STR
+ "Transform BGP AS_PATH attribute\n"
+ "Exclude from the as-path\n")
DEFUN (set_community,
set_community_cmd,
ret = generic_set_add(vty, VTY_GET_CONTEXT(route_map_index),
"community", str);
- community_free(com);
+ community_free(&com);
return ret;
}
install_element(RMAP_NODE, &set_aspath_exclude_cmd);
install_element(RMAP_NODE, &no_set_aspath_prepend_cmd);
install_element(RMAP_NODE, &no_set_aspath_exclude_cmd);
+ install_element(RMAP_NODE, &no_set_aspath_exclude_all_cmd);
install_element(RMAP_NODE, &set_origin_cmd);
install_element(RMAP_NODE, &no_set_origin_cmd);
install_element(RMAP_NODE, &set_atomic_aggregate_cmd);