Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: clear evpn dup-addr return error-msg when there is no vni #16261

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions zebra/zebra_nb_rpcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "zebra/zebra_router.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_vxlan_if.h"
#include "zebra/zebra_evpn.h"

/*
* XPath: /frr-zebra:clear-evpn-dup-addr
Expand All @@ -21,6 +23,11 @@ int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args)
struct zebra_vrf *zvrf;
int ret = NB_OK;

if (!is_evpn_enabled()) {
snprintf(args->errmsg, args->errmsg_len,
"%% EVPN not enabled\n");
return NB_ERR_VALIDATION;
}
zvrf = zebra_vrf_get_evpn();

if (yang_dnode_exists(args->input, "all-vnis")) {
Expand All @@ -30,6 +37,12 @@ int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args)
struct ipaddr host_ip = {.ipa_type = IPADDR_NONE};
struct ethaddr mac;

if (!zebra_evpn_lookup(vni)) {
snprintf(args->errmsg, args->errmsg_len,
"%% VNI %u does not exist\n", vni);
return NB_ERR_VALIDATION;
}

if (yang_dnode_exists(args->input, "mac-addr")) {
yang_dnode_get_mac(&mac, args->input, "mac-addr");
ret = zebra_vxlan_clear_dup_detect_vni_mac(zvrf, vni,
Expand Down
Loading