mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-26 23:23:35 +00:00
Merge pull request #3413 from chiragshah6/evpn_dev1
zebra: dup addr detect clear cmd non-zero return
This commit is contained in:
commit
b59d17baf3
@ -2313,6 +2313,7 @@ DEFPY (clear_evpn_dup_addr,
|
|||||||
vni_t vni = 0;
|
vni_t vni = 0;
|
||||||
struct ipaddr host_ip = {.ipa_type = IPADDR_NONE };
|
struct ipaddr host_ip = {.ipa_type = IPADDR_NONE };
|
||||||
struct ethaddr mac_addr;
|
struct ethaddr mac_addr;
|
||||||
|
int ret = CMD_SUCCESS;
|
||||||
|
|
||||||
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
if (vni_val) {
|
if (vni_val) {
|
||||||
@ -2320,9 +2321,10 @@ DEFPY (clear_evpn_dup_addr,
|
|||||||
|
|
||||||
if (mac_val) {
|
if (mac_val) {
|
||||||
prefix_str2mac(mac_val, &mac_addr);
|
prefix_str2mac(mac_val, &mac_addr);
|
||||||
zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf, vni,
|
ret = zebra_vxlan_clear_dup_detect_vni_mac(vty, zvrf,
|
||||||
&mac_addr);
|
vni,
|
||||||
} else if (ip) {
|
&mac_addr);
|
||||||
|
} else if (ip) {
|
||||||
if (sockunion_family(ip) == AF_INET) {
|
if (sockunion_family(ip) == AF_INET) {
|
||||||
host_ip.ipa_type = IPADDR_V4;
|
host_ip.ipa_type = IPADDR_V4;
|
||||||
host_ip.ipaddr_v4.s_addr = sockunion2ip(ip);
|
host_ip.ipaddr_v4.s_addr = sockunion2ip(ip);
|
||||||
@ -2331,16 +2333,17 @@ DEFPY (clear_evpn_dup_addr,
|
|||||||
memcpy(&host_ip.ipaddr_v6, &ip->sin6.sin6_addr,
|
memcpy(&host_ip.ipaddr_v6, &ip->sin6.sin6_addr,
|
||||||
sizeof(struct in6_addr));
|
sizeof(struct in6_addr));
|
||||||
}
|
}
|
||||||
zebra_vxlan_clear_dup_detect_vni_ip(vty, zvrf, vni,
|
ret = zebra_vxlan_clear_dup_detect_vni_ip(vty, zvrf,
|
||||||
&host_ip);
|
vni,
|
||||||
|
&host_ip);
|
||||||
} else
|
} else
|
||||||
zebra_vxlan_clear_dup_detect_vni(vty, zvrf, vni);
|
ret = zebra_vxlan_clear_dup_detect_vni(vty, zvrf, vni);
|
||||||
|
|
||||||
} else {
|
} 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. */
|
/* Static ip route configuration write function. */
|
||||||
|
@ -6159,9 +6159,9 @@ void zebra_vxlan_print_macs_vni_dad(struct vty *vty,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
||||||
struct zebra_vrf *zvrf,
|
struct zebra_vrf *zvrf,
|
||||||
vni_t vni, struct ethaddr *macaddr)
|
vni_t vni, struct ethaddr *macaddr)
|
||||||
{
|
{
|
||||||
zebra_vni_t *zvni;
|
zebra_vni_t *zvni;
|
||||||
zebra_mac_t *mac;
|
zebra_mac_t *mac;
|
||||||
@ -6169,23 +6169,24 @@ void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
|||||||
zebra_neigh_t *nbr = NULL;
|
zebra_neigh_t *nbr = NULL;
|
||||||
|
|
||||||
if (!is_evpn_enabled())
|
if (!is_evpn_enabled())
|
||||||
return;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
zvni = zvni_lookup(vni);
|
zvni = zvni_lookup(vni);
|
||||||
if (!zvni) {
|
if (!zvni) {
|
||||||
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
mac = zvni_mac_lookup(zvni, macaddr);
|
mac = zvni_mac_lookup(zvni, macaddr);
|
||||||
if (!mac) {
|
if (!mac) {
|
||||||
vty_out(vty, "%% Requested MAC does not exist in VNI %u\n",
|
vty_out(vty, "%% Requested MAC does not exist in VNI %u\n",
|
||||||
vni);
|
vni);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
|
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
|
||||||
vty_out(vty, "%% Requested MAC is not duplicate detected\n");
|
vty_out(vty, "%% Requested MAC is not duplicate detected\n");
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all IPs as duplicate associcated with this MAC */
|
/* Remove all IPs as duplicate associcated with this MAC */
|
||||||
@ -6224,7 +6225,7 @@ void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
|||||||
&mac->macaddr,
|
&mac->macaddr,
|
||||||
mac->flags,
|
mac->flags,
|
||||||
mac->loc_seq))
|
mac->loc_seq))
|
||||||
return;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
/* Process all neighbors associated with this MAC. */
|
/* Process all neighbors associated with this MAC. */
|
||||||
zvni_process_neigh_on_local_mac_change(zvni, mac, 0);
|
zvni_process_neigh_on_local_mac_change(zvni, mac, 0);
|
||||||
@ -6236,11 +6237,12 @@ void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
|||||||
zvni_mac_install(zvni, mac);
|
zvni_mac_install(zvni, mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
||||||
struct zebra_vrf *zvrf,
|
struct zebra_vrf *zvrf,
|
||||||
vni_t vni, struct ipaddr *ip)
|
vni_t vni, struct ipaddr *ip)
|
||||||
{
|
{
|
||||||
zebra_vni_t *zvni;
|
zebra_vni_t *zvni;
|
||||||
zebra_neigh_t *nbr;
|
zebra_neigh_t *nbr;
|
||||||
@ -6249,12 +6251,12 @@ void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
|||||||
char buf2[ETHER_ADDR_STRLEN];
|
char buf2[ETHER_ADDR_STRLEN];
|
||||||
|
|
||||||
if (!is_evpn_enabled())
|
if (!is_evpn_enabled())
|
||||||
return;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
zvni = zvni_lookup(vni);
|
zvni = zvni_lookup(vni);
|
||||||
if (!zvni) {
|
if (!zvni) {
|
||||||
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
nbr = zvni_neigh_lookup(zvni, ip);
|
nbr = zvni_neigh_lookup(zvni, ip);
|
||||||
@ -6262,7 +6264,7 @@ void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%% Requested host IP does not exist in VNI %u\n",
|
"%% Requested host IP does not exist in VNI %u\n",
|
||||||
vni);
|
vni);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipaddr2str(&nbr->ip, buf, sizeof(buf));
|
ipaddr2str(&nbr->ip, buf, sizeof(buf));
|
||||||
@ -6271,7 +6273,7 @@ void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%% Requsted host IP %s is not duplicate detected\n",
|
"%% Requsted host IP %s is not duplicate detected\n",
|
||||||
buf);
|
buf);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
mac = zvni_mac_lookup(zvni, &nbr->emac);
|
mac = zvni_mac_lookup(zvni, &nbr->emac);
|
||||||
@ -6280,7 +6282,7 @@ void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%% Requested IP's associated MAC %s is still in duplicate state\n",
|
"%% Requested IP's associated MAC %s is still in duplicate state\n",
|
||||||
prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)));
|
prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)));
|
||||||
return;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_VXLAN)
|
if (IS_ZEBRA_DEBUG_VXLAN)
|
||||||
@ -6303,6 +6305,7 @@ void zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
|||||||
zvni_neigh_install(zvni, nbr);
|
zvni_neigh_install(zvni, nbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zvni_clear_dup_mac_hash(struct hash_backet *backet, void *ctxt)
|
static void zvni_clear_dup_mac_hash(struct hash_backet *backet, void *ctxt)
|
||||||
@ -6435,13 +6438,13 @@ static void zvni_clear_dup_detect_hash_vni_all(struct hash_backet *backet,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
struct zebra_vrf *zvrf)
|
||||||
{
|
{
|
||||||
void *args[2];
|
void *args[2];
|
||||||
|
|
||||||
if (!is_evpn_enabled())
|
if (!is_evpn_enabled())
|
||||||
return;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
args[0] = vty;
|
args[0] = vty;
|
||||||
args[1] = zvrf;
|
args[1] = zvrf;
|
||||||
@ -6450,9 +6453,10 @@ void zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
|
|||||||
(void (*)(struct hash_backet *, void *))
|
(void (*)(struct hash_backet *, void *))
|
||||||
zvni_clear_dup_detect_hash_vni_all, args);
|
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,
|
struct zebra_vrf *zvrf,
|
||||||
vni_t vni)
|
vni_t vni)
|
||||||
{
|
{
|
||||||
@ -6461,12 +6465,12 @@ void zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
|
|||||||
struct neigh_walk_ctx n_wctx;
|
struct neigh_walk_ctx n_wctx;
|
||||||
|
|
||||||
if (!is_evpn_enabled())
|
if (!is_evpn_enabled())
|
||||||
return;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
zvni = zvni_lookup(vni);
|
zvni = zvni_lookup(vni);
|
||||||
if (!zvni) {
|
if (!zvni) {
|
||||||
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
vty_out(vty, "%% VNI %u does not exist\n", vni);
|
||||||
return;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hashcount(zvni->neigh_table)) {
|
if (hashcount(zvni->neigh_table)) {
|
||||||
@ -6486,6 +6490,7 @@ void zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
|
|||||||
hash_iterate(zvni->mac_table, zvni_clear_dup_mac_hash, &m_wctx);
|
hash_iterate(zvni->mac_table, zvni_clear_dup_mac_hash, &m_wctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -185,17 +185,17 @@ extern void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
|
|||||||
extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
|
extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
|
||||||
struct ipaddr *vtep_ip,
|
struct ipaddr *vtep_ip,
|
||||||
struct prefix *host_prefix);
|
struct prefix *host_prefix);
|
||||||
extern void zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty,
|
extern int 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,
|
|
||||||
struct zebra_vrf *zvrf,
|
struct zebra_vrf *zvrf,
|
||||||
vni_t vni, struct ipaddr *ip);
|
vni_t vni,
|
||||||
extern void zebra_vxlan_clear_dup_detect_vni_all(struct vty *vty,
|
struct ethaddr *macaddr);
|
||||||
struct zebra_vrf *zvrf);
|
extern int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
|
||||||
extern void zebra_vxlan_clear_dup_detect_vni(struct vty *vty,
|
struct zebra_vrf *zvrf,
|
||||||
struct zebra_vrf *zvrf,
|
vni_t vni, struct ipaddr *ip);
|
||||||
vni_t vni);
|
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 */
|
#endif /* _ZEBRA_VXLAN_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user