vni_t vni = 0;
struct ipaddr host_ip = {.ipa_type = IPADDR_NONE };
struct ethaddr mac_addr;
+ int ret = CMD_SUCCESS;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (vni_val) {
if (mac_val) {
prefix_str2mac(mac_val, &mac_addr);
- zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf, vni,
- &mac_addr);
- } else if (ip) {
+ ret = zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf,
+ vni,
+ &mac_addr);
+ } else if (ip) {
if (sockunion_family(ip) == AF_INET) {
host_ip.ipa_type = IPADDR_V4;
host_ip.ipaddr_v4.s_addr = sockunion2ip(ip);
memcpy(&host_ip.ipaddr_v6, &ip->sin6.sin6_addr,
sizeof(struct in6_addr));
}
- zebra_vxlan_clear_dup_detect_vni_ip(vty, zvrf, vni,
- &host_ip);
+ ret = zebra_vxlan_clear_dup_detect_vni_ip(vty, zvrf,
+ vni,
+ &host_ip);
} else
- zebra_vxlan_clear_dup_detect_vni(vty, zvrf, vni);
+ ret = zebra_vxlan_clear_dup_detect_vni(vty, zvrf, vni);
} else {
- zebra_vxlan_clear_dup_detect_vni_all(vty, zvrf);
+ ret = zebra_vxlan_clear_dup_detect_vni_all(vty, zvrf);
}
- return CMD_SUCCESS;
+ return ret;
}
/* Static ip route configuration write function. */
}
-void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
- struct zebra_vrf *zvrf,
- vni_t vni, struct ethaddr *macaddr)
+int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
+ struct zebra_vrf *zvrf,
+ vni_t vni, struct ethaddr *macaddr)
{
zebra_vni_t *zvni;
zebra_mac_t *mac;
zebra_neigh_t *nbr = NULL;
if (!is_evpn_enabled())
- return;
+ return CMD_SUCCESS;
+
zvni = zvni_lookup(vni);
if (!zvni) {
vty_out(vty, "%% VNI %u does not exist\n", vni);
- return;
+ return CMD_WARNING;
}
mac = zvni_mac_lookup(zvni, macaddr);
if (!mac) {
vty_out(vty, "%% Requested MAC does not exist in VNI %u\n",
vni);
- return;
+ return CMD_WARNING;
}
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
vty_out(vty, "%% Requested MAC is not duplicate detected\n");
- return;
+ return CMD_WARNING;
}
/* Remove all IPs as duplicate associcated with this MAC */
&mac->macaddr,
mac->flags,
mac->loc_seq))
- return;
+ return CMD_SUCCESS;
/* Process all neighbors associated with this MAC. */
zvni_process_neigh_on_local_mac_change(zvni, mac, 0);
zvni_mac_install(zvni, mac);
}
+ return CMD_SUCCESS;
}
-void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
- struct zebra_vrf *zvrf,
- vni_t vni, struct ipaddr *ip)
+int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
+ struct zebra_vrf *zvrf,
+ vni_t vni, struct ipaddr *ip)
{
zebra_vni_t *zvni;
zebra_neigh_t *nbr;
char buf2[ETHER_ADDR_STRLEN];
if (!is_evpn_enabled())
- return;
+ return CMD_SUCCESS;
zvni = zvni_lookup(vni);
if (!zvni) {
vty_out(vty, "%% VNI %u does not exist\n", vni);
- return;
+ return CMD_WARNING;
}
nbr = zvni_neigh_lookup(zvni, ip);
vty_out(vty,
"%% Requested host IP does not exist in VNI %u\n",
vni);
- return;
+ return CMD_WARNING;
}
ipaddr2str(&nbr->ip, buf, sizeof(buf));
vty_out(vty,
"%% Requsted host IP %s is not duplicate detected\n",
buf);
- return;
+ return CMD_WARNING;
}
mac = zvni_mac_lookup(zvni, &nbr->emac);
vty_out(vty,
"%% Requested IP's associated MAC %s is still in duplicate state\n",
prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)));
- return;
+ return CMD_WARNING_CONFIG_FAILED;
}
if (IS_ZEBRA_DEBUG_VXLAN)
zvni_neigh_install(zvni, nbr);
}
+ return CMD_SUCCESS;
}
static void zvni_clear_dup_mac_hash(struct hash_backet *backet, void *ctxt)
}
-void zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
+int zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
struct zebra_vrf *zvrf)
{
void *args[2];
if (!is_evpn_enabled())
- return;
+ return CMD_SUCCESS;
args[0] = vty;
args[1] = zvrf;
(void (*)(struct hash_backet *, void *))
zvni_clear_dup_detect_hash_vni_all, args);
+ return CMD_SUCCESS;
}
-void zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
+int zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
struct zebra_vrf *zvrf,
vni_t vni)
{
struct neigh_walk_ctx n_wctx;
if (!is_evpn_enabled())
- return;
+ return CMD_SUCCESS;
zvni = zvni_lookup(vni);
if (!zvni) {
vty_out(vty, "%% VNI %u does not exist\n", vni);
- return;
+ return CMD_WARNING;
}
if (hashcount(zvni->neigh_table)) {
hash_iterate(zvni->mac_table, zvni_clear_dup_mac_hash, &m_wctx);
}
+ return CMD_SUCCESS;
}
/*
extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
struct ipaddr *vtep_ip,
struct prefix *host_prefix);
-extern void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
- struct zebra_vrf *zvrf,
- vni_t vni,
- struct ethaddr *macaddr);
-extern void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
+extern int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
struct zebra_vrf *zvrf,
- vni_t vni, struct ipaddr *ip);
-extern void zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
- struct zebra_vrf *zvrf);
-extern void zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
- struct zebra_vrf *zvrf,
- vni_t vni);
+ vni_t vni,
+ struct ethaddr *macaddr);
+extern int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
+ struct zebra_vrf *zvrf,
+ vni_t vni, struct ipaddr *ip);
+extern int zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
+ struct zebra_vrf *zvrf);
+extern int zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
+ struct zebra_vrf *zvrf,
+ vni_t vni);
#endif /* _ZEBRA_VXLAN_H */