zvrf = zebra_vrf_get_evpn();
if (vni_str) {
if (!is_zero_mac(&mac->eth_addr)) {
- ret = zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf,
- vni,
- &mac->eth_addr);
- } else if (ip) {
+ ret = zebra_vxlan_clear_dup_detect_vni_mac(
+ zvrf, vni, &mac->eth_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));
}
- ret = zebra_vxlan_clear_dup_detect_vni_ip(vty, zvrf,
- vni,
+ ret = zebra_vxlan_clear_dup_detect_vni_ip(zvrf, vni,
&host_ip);
} else
- ret = zebra_vxlan_clear_dup_detect_vni(vty, zvrf, vni);
+ ret = zebra_vxlan_clear_dup_detect_vni(zvrf, vni);
} else {
- ret = zebra_vxlan_clear_dup_detect_vni_all(vty, zvrf);
+ ret = zebra_vxlan_clear_dup_detect_vni_all(zvrf);
}
return ret;
}
-int 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 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 CMD_SUCCESS;
+ return 0;
zvni = zvni_lookup(vni);
if (!zvni) {
- vty_out(vty, "%% VNI %u does not exist\n", vni);
- return CMD_WARNING;
+ zlog_warn("VNI %u does not exist\n", vni);
+ return -1;
}
mac = zvni_mac_lookup(zvni, macaddr);
if (!mac) {
- vty_out(vty, "%% Requested MAC does not exist in VNI %u\n",
- vni);
- return CMD_WARNING;
+ zlog_warn("Requested MAC does not exist in VNI %u\n", vni);
+ return -1;
}
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
- vty_out(vty, "%% Requested MAC is not duplicate detected\n");
- return CMD_WARNING;
+ zlog_warn("Requested MAC is not duplicate detected\n");
+ return -1;
}
/* Remove all IPs as duplicate associcated with this MAC */
/* warn-only action return */
if (!zvrf->dad_freeze)
- return CMD_SUCCESS;
+ return 0;
/* Local: Notify Peer VTEPs, Remote: Install the entry */
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)) {
&mac->macaddr,
mac->flags,
mac->loc_seq))
- return CMD_SUCCESS;
+ return 0;
/* 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;
+ return 0;
}
-int 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 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 CMD_SUCCESS;
+ return 0;
zvni = zvni_lookup(vni);
if (!zvni) {
- vty_out(vty, "%% VNI %u does not exist\n", vni);
- return CMD_WARNING;
+ zlog_debug("VNI %u does not exist\n", vni);
+ return -1;
}
nbr = zvni_neigh_lookup(zvni, ip);
if (!nbr) {
- vty_out(vty,
- "%% Requested host IP does not exist in VNI %u\n",
- vni);
- return CMD_WARNING;
+ zlog_warn("Requested host IP does not exist in VNI %u\n", vni);
+ return -1;
}
ipaddr2str(&nbr->ip, buf, sizeof(buf));
if (!CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) {
- vty_out(vty,
- "%% Requested host IP %s is not duplicate detected\n",
- buf);
- return CMD_WARNING;
+ zlog_warn("Requested host IP %s is not duplicate detected\n",
+ buf);
+ return -1;
}
mac = zvni_mac_lookup(zvni, &nbr->emac);
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
- vty_out(vty,
- "%% Requested IP's associated MAC %s is still in duplicate state\n",
+ zlog_warn(
+ "Requested IP's associated MAC %s is still in duplicate state\n",
prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)));
- return CMD_WARNING_CONFIG_FAILED;
+ return -1;
}
if (IS_ZEBRA_DEBUG_VXLAN)
zvni_neigh_install(zvni, nbr);
}
- return CMD_SUCCESS;
+ return 0;
}
static void zvni_clear_dup_mac_hash(struct hash_bucket *bucket, void *ctxt)
static void zvni_clear_dup_detect_hash_vni_all(struct hash_bucket *bucket,
void **args)
{
- struct vty *vty;
zebra_vni_t *zvni;
struct zebra_vrf *zvrf;
struct mac_walk_ctx m_wctx;
if (!zvni)
return;
- vty = (struct vty *)args[0];
- zvrf = (struct zebra_vrf *)args[1];
+ zvrf = (struct zebra_vrf *)args[0];
if (hashcount(zvni->neigh_table)) {
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
- n_wctx.vty = vty;
n_wctx.zvni = zvni;
n_wctx.zvrf = zvrf;
hash_iterate(zvni->neigh_table, zvni_clear_dup_neigh_hash,
if (num_valid_macs(zvni)) {
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
m_wctx.zvni = zvni;
- m_wctx.vty = vty;
m_wctx.zvrf = zvrf;
hash_iterate(zvni->mac_table, zvni_clear_dup_mac_hash, &m_wctx);
}
}
-int zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
- struct zebra_vrf *zvrf)
+int zebra_vxlan_clear_dup_detect_vni_all(struct zebra_vrf *zvrf)
{
- void *args[2];
+ void *args[1];
if (!is_evpn_enabled())
- return CMD_SUCCESS;
+ return 0;
- args[0] = vty;
- args[1] = zvrf;
+ args[0] = zvrf;
hash_iterate(zvrf->vni_table,
(void (*)(struct hash_bucket *, void *))
zvni_clear_dup_detect_hash_vni_all, args);
- return CMD_SUCCESS;
+ return 0;
}
-int zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
- struct zebra_vrf *zvrf,
- vni_t vni)
+int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni)
{
zebra_vni_t *zvni;
struct mac_walk_ctx m_wctx;
struct neigh_walk_ctx n_wctx;
if (!is_evpn_enabled())
- return CMD_SUCCESS;
+ return 0;
zvni = zvni_lookup(vni);
if (!zvni) {
- vty_out(vty, "%% VNI %u does not exist\n", vni);
- return CMD_WARNING;
+ zlog_warn("VNI %u does not exist\n", vni);
+ return -1;
}
if (hashcount(zvni->neigh_table)) {
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
- n_wctx.vty = vty;
n_wctx.zvni = zvni;
n_wctx.zvrf = zvrf;
hash_iterate(zvni->neigh_table, zvni_clear_dup_neigh_hash,
if (num_valid_macs(zvni)) {
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
m_wctx.zvni = zvni;
- m_wctx.vty = vty;
m_wctx.zvrf = zvrf;
hash_iterate(zvni->mac_table, zvni_clear_dup_mac_hash, &m_wctx);
}
- return CMD_SUCCESS;
+ return 0;
}
/*
* clear all duplicate detected addresses.
*/
if (zvrf->dup_addr_detect && !dup_addr_detect)
- zebra_vxlan_clear_dup_detect_vni_all(NULL, zvrf);
+ zebra_vxlan_clear_dup_detect_vni_all(zvrf);
zvrf->dup_addr_detect = dup_addr_detect;
zvrf->dad_time = time;
extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
struct ipaddr *vtep_ip,
struct prefix *host_prefix);
-extern int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
- struct zebra_vrf *zvrf,
+extern int zebra_vxlan_clear_dup_detect_vni_mac(struct zebra_vrf *zvrf,
vni_t vni,
struct ethaddr *macaddr);
-extern int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
- struct zebra_vrf *zvrf,
+extern int zebra_vxlan_clear_dup_detect_vni_ip(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);
+extern int zebra_vxlan_clear_dup_detect_vni_all(struct zebra_vrf *zvrf);
+extern int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni);
extern void zebra_vxlan_handle_result(struct zebra_dplane_ctx *ctx);
extern void zebra_evpn_init(void);