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: Cl to frr upstream zebra json #17532

Open
wants to merge 106 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f159940
zebra:add df flag into evpn esi json output
Apr 28, 2023
2899964
zebra: add vni bridge vlan info in json output
chiragshah6 Sep 13, 2022
a389731
zebra: add json support for svd vxlan type
chiragshah6 Feb 17, 2022
b57ad60
zebra: show nexthop-group rib brief json
Dec 19, 2023
aa12b80
zebra: Define a local MAC cache for EVPN
vivek-cumulus Jan 11, 2022
c5488c9
zebra: Display local MAC cache
vivek-cumulus Jan 11, 2022
5f458b3
zebra: json support
ashred-lnx Feb 23, 2022
7b1ac8b
zebra: static analyzer reported issue fixes
sougata-github-nvidia Dec 4, 2024
5dde8e1
topotests: Allow runing under both docker and podman
famfo Nov 26, 2024
e7eb1a1
topotests: bmp, create shared library for bmp
pguibert6WIND Oct 25, 2024
293833d
topotests: fix bmp_collector handling of empty as-path
pguibert6WIND Oct 28, 2024
5238553
topotests: bgp_bmp, use unified configuration
pguibert6WIND Nov 18, 2024
45f7229
tests: add py extension to bmpserver
louis-6wind Nov 20, 2024
26a7352
tests: fix bmp test parallelization
louis-6wind Nov 20, 2024
b90814a
tests: save bmp pcap in logdir instead of /tmp
louis-6wind Nov 21, 2024
9712936
topotests: save bgp_bmp json temp files to bmp log folder instead of …
pguibert6WIND Dec 2, 2024
4cdbdc8
bgpd: bgp_clist.c does not need jhash.h
donaldsharp Dec 2, 2024
f0a5e78
tests: bgp_lu_topo[1|2] should not use log files in /tmp
donaldsharp Dec 2, 2024
3d4e007
tests: bgp_nexthop_ipv6 remove unused reference to /tmp
donaldsharp Dec 2, 2024
92756e2
tests: zebra_rib should not use /tmp for log files
donaldsharp Dec 2, 2024
fa317c3
tests: pim_cand_rp_bsr uses /tmp directory and it should not
donaldsharp Dec 2, 2024
a6fe1ff
tests: simple_snmp_test should not use /tmp for logging
donaldsharp Dec 2, 2024
b1ba753
tests: pim_basic should not use /tmp for outputing of files
donaldsharp Dec 2, 2024
f51c537
tests: pim_autorp should not use /tmp
donaldsharp Dec 2, 2024
e5e59a1
tests: ospf_prefix_suppression should not use /tmp
donaldsharp Dec 2, 2024
2479d74
tests: ospf_p2mp should not use /tmp
donaldsharp Dec 2, 2024
5547663
tests: ospf_netns_vrf should not use /tmp
donaldsharp Dec 2, 2024
1cacc25
tests: ospf_multi_vrf_bgp_route_leak should not use /tmp
donaldsharp Dec 2, 2024
65187ff
tests: ospf_multi_instance should not use /tmp
donaldsharp Dec 2, 2024
35056d0
tests: ospf_metric_propagation do not use /tmp
donaldsharp Dec 2, 2024
a7aacf6
tests: bgp_snmp_mplsl3vpn should not use /tmp directory
donaldsharp Dec 2, 2024
01d289f
tests: bgp_route_server_client should not use /tmp
donaldsharp Dec 2, 2024
b519572
bgpd: Use peer group's member for BGP notify instead of the peer-group
ton31337 Nov 27, 2024
c2079f2
bgpd: Initialize as_type for peer-group as AS_UNSPECIFIED
ton31337 Dec 1, 2024
e0d6005
tests: Check if remote-as is not flushed once peer-group applied
ton31337 Dec 1, 2024
719f6e2
zebra: separate zebra ZAPI server open and accept
Oct 30, 2024
9bce8f0
pimd: Fix access-list memory leak in pimd
Nov 26, 2024
4e253c6
lib: Fix session re-establishment
donaldsharp Dec 3, 2024
b2440cd
lib: Allow setsockopt functions to return size set
donaldsharp Dec 3, 2024
93ea727
lib,vtysh: Use backoff setsockopt option for freebsd
donaldsharp Dec 3, 2024
fe5e066
lib: Print the reason why the route-map and/or the index parsing is done
ton31337 Dec 4, 2024
1b5ce05
pimd: igmp proxy joins should not be written as part of config
Dec 3, 2024
1b64d76
pimd: Prevent crash of pim when auto-rp's socket is not initialized
donaldsharp Dec 4, 2024
85b502e
pimd: implement MSDP shutdown command
rzalamena May 10, 2022
33dc89a
topotests: test MSDP shutdown command
rzalamena Nov 25, 2024
fdab494
doc: document shutdown command
rzalamena Nov 25, 2024
bd14767
lib: Speed up reconnection attempts for zapi
donaldsharp Dec 4, 2024
1276e8f
bgpd: fix unconfigure asdot neighbor
pguibert6WIND Dec 4, 2024
430d7cb
pimd: free igmp proxy joins on interface deletion
Dec 3, 2024
5779690
tests: bfd_profiles_topo1 is taking a long time to reconnect
donaldsharp Dec 5, 2024
31572eb
bgpd: shared_network is a bool, convert it to such
donaldsharp Dec 5, 2024
3d70b9e
bgpd: When bgp notices a change to shared_network inform bfd of it
donaldsharp Dec 5, 2024
b8979fb
tests: Convert to using `neighbor X timers connect 1` for exabgp usin…
donaldsharp Dec 4, 2024
e6028d0
tests: Fix invalid escape seq seen in bgp_nexthop_ipv6
donaldsharp Dec 4, 2024
f61dde2
bgpd: fix peer up message for loc-rib not sent
pguibert6WIND Dec 2, 2024
35f77c5
topotests: bmp, test that loc-rib peer up message is sent
pguibert6WIND Dec 3, 2024
b43750e
bgpd: Check if as_type is not specified when peer is a peer-group member
ton31337 Dec 6, 2024
805aaec
doc: remove no-op "netns NAMESPACE" command from the docs
idryzhov Nov 30, 2024
4be15e5
zebra: add deprecation notice for no-op netns command
idryzhov Dec 7, 2024
69ea3eb
zebra: use macro for one check
anlancs Dec 5, 2024
0589950
pimd: Move ACL handling to pim_util.c
Nov 25, 2024
3db9117
pimd,yang: Extend multicast boundary functionality
Nov 25, 2024
7fc110a
tests: Add basic multicast boundary test
Nov 14, 2024
6288ffd
doc: Expand ACL and multicast boundary documentation
Nov 14, 2024
d11bded
pimd: Convert boundary_oil_plist to struct prefix_list
Nov 26, 2024
7d19912
tests: Check if vpn routes can be imported if allowas-in is set
ton31337 Dec 8, 2024
b868757
bgpd: Import allowed routes with self AS if desired
ton31337 Dec 8, 2024
336fb43
bgpd: Print the actual prefix when we try to import in vpn_leak_to_vr…
ton31337 Dec 8, 2024
c5087cb
bgpd: Show which route-map is used when the prefix is filtered by rou…
ton31337 Dec 4, 2024
c55bc29
yang,pimd: support shutdown and SA limit
rzalamena May 10, 2022
02939de
pimd: implement MSDP peer SA limiting
rzalamena May 10, 2022
613956a
topotests: test new MSDP SA limit feature
rzalamena Nov 26, 2024
f28c740
doc: document new SA limit command
rzalamena Nov 26, 2024
c8b7a5f
bgpd: Fix bgp core with a possible Intf delete
raja-rajasekar Dec 10, 2024
8df3572
bgpd, topotests: fix wrong peer type for loc-rib peer events
pguibert6WIND Oct 30, 2024
9dcf9d8
topotests: bgp_bmp, expose peer_distinguisher in loc-rib
pguibert6WIND Oct 30, 2024
34d8770
bgpd: modify bmp_get_peer_distinguisher to support AFI_UNSPEC
pguibert6WIND Oct 30, 2024
f7b0f6f
bgpd: bmp, add peer distinguisher support for peer up/down
pguibert6WIND Oct 30, 2024
0a20ef9
bgpd, topotests: bmp, fix wrong peer type for vrf route messages
pguibert6WIND Oct 31, 2024
6a3e1e3
bgpd, topotests: bmp, fix wrong peer distinguisher for vrf route events
pguibert6WIND Oct 31, 2024
ff0e1f2
bgpd, topotests: bmp, fix wrong peer type for peer up/down events
pguibert6WIND Oct 31, 2024
e5596dd
bgpd, topotests: bmp, fix wrong peer distinguisher value for peer vrf…
pguibert6WIND Oct 31, 2024
b1f199d
bgpd: bmp, add peer type and distinguisher support for stat messages
pguibert6WIND Sep 23, 2024
07fbbb8
zebra: Reset MAC's remote sequence number appropriately
vivek-cumulus Jun 10, 2020
29a0680
bgpd: Check L3VNI status before announcing default
vivek-cumulus Jun 9, 2021
880d019
zebra: Reduce memory usage of streams for encoding packets
donaldsharp Jun 10, 2021
1dac801
pimd: skip init of mlag roles based on the zebra capabilities message
AnuradhaKaruppiah Jun 18, 2021
c90c58f
pbrd: fix vrf_unchanged which may depend on other seqs
Jul 29, 2021
396bc3e
watchfrr: increase restart timer 20s -> 90s
qlyoung Aug 11, 2021
1b8b747
zebra: Fix another ships in the night issue with WFI
donaldsharp Oct 18, 2021
a2ee9db
bgpd: only import specific route-types into EVIs
Nov 5, 2021
bb5632b
bgpd: copy asn of src vrf to evpn type5 route
chiragshah6 Jan 26, 2022
3e2a0f3
bgpd: Show which prefix is suppressed if debug out is enabled
ton31337 Dec 11, 2024
8f2f7f6
zebra: Remove tests for allocation failure
donaldsharp Dec 11, 2024
f8ba744
pim6d: ignore more MSDP callbacks
rzalamena Dec 11, 2024
dcf33d0
pimd: move MSDP configuration and initialization
rzalamena Dec 11, 2024
c9d6ea7
pimd: move all MSDP code to its own place
rzalamena Dec 11, 2024
78c5bb9
pimd: support originator id configuration
rzalamena May 10, 2022
c7d3e19
topotests: topology to test MSDP originator ID
rzalamena Dec 10, 2024
f0f2940
doc: document new command MSDP originator ID
rzalamena Dec 10, 2024
f4af5fe
bgpd: When calling bgp_process, prevent infinite loop
donaldsharp Dec 12, 2024
31cbe16
doc: Update the next release dates
ton31337 Dec 12, 2024
02d336d
pim6d: fix crash on clear ipv6 mroute
rzalamena Dec 11, 2024
3049a63
pimd,pim6d: optimize multicast prefix generation
rzalamena Dec 13, 2024
b131abf
zebra: Give a bit more data about zclient connection on errors
donaldsharp Dec 13, 2024
b43c276
tools: Add rip support bundle commands
donaldsharp Dec 13, 2024
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
60 changes: 35 additions & 25 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ bool nexthop_is_blackhole(const struct nexthop *nh)
*/
void nexthop_json_helper(json_object *json_nexthop,
const struct nexthop *nexthop, bool display_vrfid,
uint8_t rn_family)
uint8_t rn_family, bool brief)
{
json_object *json_labels = NULL;
json_object *json_backups = NULL;
Expand All @@ -1220,20 +1220,23 @@ void nexthop_json_helper(json_object *json_nexthop,
json_object *json_segs = NULL;
int i;

json_object_int_add(json_nexthop, "flags", nexthop->flags);
if (!brief) {
json_object_int_add(json_nexthop, "flags", nexthop->flags);

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
json_object_boolean_true_add(json_nexthop, "duplicate");
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
json_object_boolean_true_add(json_nexthop, "duplicate");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB))
json_object_boolean_true_add(json_nexthop, "fib");
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB))
json_object_boolean_true_add(json_nexthop, "fib");
}

switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
json_object_string_addf(json_nexthop, "ip", "%pI4",
&nexthop->gate.ipv4);
json_object_string_add(json_nexthop, "afi", "ipv4");
if (!brief)
json_object_string_add(json_nexthop, "afi", "ipv4");

if (nexthop->ifindex) {
json_object_int_add(json_nexthop, "interfaceIndex",
Expand All @@ -1247,7 +1250,8 @@ void nexthop_json_helper(json_object *json_nexthop,
case NEXTHOP_TYPE_IPV6_IFINDEX:
json_object_string_addf(json_nexthop, "ip", "%pI6",
&nexthop->gate.ipv6);
json_object_string_add(json_nexthop, "afi", "ipv6");
if (!brief)
json_object_string_add(json_nexthop, "afi", "ipv6");

if (nexthop->ifindex) {
json_object_int_add(json_nexthop, "interfaceIndex",
Expand All @@ -1259,42 +1263,48 @@ void nexthop_json_helper(json_object *json_nexthop,
break;

case NEXTHOP_TYPE_IFINDEX:
json_object_boolean_true_add(json_nexthop, "directlyConnected");
if (!brief)
json_object_boolean_true_add(json_nexthop, "directlyConnected");
json_object_int_add(json_nexthop, "interfaceIndex",
nexthop->ifindex);
json_object_string_add(json_nexthop, "interfaceName",
ifindex2ifname(nexthop->ifindex,
nexthop->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
json_object_boolean_true_add(json_nexthop, "unreachable");
switch (nexthop->bh_type) {
case BLACKHOLE_REJECT:
json_object_boolean_true_add(json_nexthop, "reject");
break;
case BLACKHOLE_ADMINPROHIB:
json_object_boolean_true_add(json_nexthop,
if (!brief) {
json_object_boolean_true_add(json_nexthop, "unreachable");
switch (nexthop->bh_type) {
case BLACKHOLE_REJECT:
json_object_boolean_true_add(json_nexthop, "reject");
break;
case BLACKHOLE_ADMINPROHIB:
json_object_boolean_true_add(json_nexthop,
"adminProhibited");
break;
case BLACKHOLE_NULL:
json_object_boolean_true_add(json_nexthop, "blackhole");
break;
case BLACKHOLE_UNSPEC:
break;
break;
case BLACKHOLE_NULL:
json_object_boolean_true_add(json_nexthop, "blackhole");
break;
case BLACKHOLE_UNSPEC:
break;
}
}
break;
}

if (display_vrfid)
json_object_string_add(json_nexthop, "vrf",
vrf_id_to_name(nexthop->vrf_id));
if (brief)
return;

/* This nexthop is a resolver for the parent nexthop.
* Set resolver flag for better clarity and delimiter
* in flat list of nexthops in json.
*/
if (nexthop->rparent)
json_object_boolean_true_add(json_nexthop, "resolver");

if (display_vrfid)
json_object_string_add(json_nexthop, "vrf",
vrf_id_to_name(nexthop->vrf_id));
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
json_object_boolean_true_add(json_nexthop, "duplicate");

Expand Down
2 changes: 1 addition & 1 deletion lib/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int nexthop_str2backups(const char *str, int *num_backups,

void nexthop_json_helper(json_object *json_nexthop,
const struct nexthop *nexthop, bool display_vrfid,
uint8_t rn_family);
uint8_t rn_family, bool brief);
void nexthop_vty_helper(struct vty *vty, const struct nexthop *nexthop,
bool display_vrfid, uint8_t rn_family);

Expand Down
87 changes: 54 additions & 33 deletions zebra/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,42 +2530,58 @@ static inline bool if_is_protodown_applicable(struct interface *ifp)
return true;
}

static void zebra_vxlan_if_vni_dump_vty(struct vty *vty,
static void zebra_vxlan_if_vni_dump_vty(struct vty *vty, json_object *json_if,
struct zebra_vxlan_vni *vni)
{
char str[INET6_ADDRSTRLEN];
json_object *json_vni;
char vni_str[VNI_STR_LEN];
char buf[PREFIX_STRLEN];

vty_out(vty, " VxLAN Id %u", vni->vni);
if (vni->access_vlan)
vty_out(vty, " Access VLAN Id %u\n", vni->access_vlan);
if (vty) {
vty_out(vty, "\n VxLAN Id %u", vni->vni);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you changing the newlines?

if (vni->access_vlan)
vty_out(vty, " Access VLAN Id %u", vni->access_vlan);

if (vni->mcast_grp.s_addr != INADDR_ANY)
vty_out(vty, " Mcast Group %s",
inet_ntop(AF_INET, &vni->mcast_grp, str, sizeof(str)));
if (vni->mcast_grp.s_addr != INADDR_ANY &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're going to change this, please use %pI4

newline change - again?

inet_ntop(AF_INET, &vni->mcast_grp, buf, sizeof(buf)) != NULL)
vty_out(vty, "\n Mcast Group %s", buf);
} else if (json_if) {
json_vni = json_object_new_object();
snprintf(vni_str, sizeof(vni_str), "%u", vni->vni);
json_object_int_add(json_vni, "accessVlan", vni->access_vlan);
json_object_string_addf(json_vni, "mcastGroup", "%pI4",
&vni->mcast_grp);
json_object_object_add(json_if, vni_str, json_vni);
}
}

static void zebra_vxlan_if_vni_hash_dump_vty(struct hash_bucket *bucket,
void *ctxt)
void **args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, don't change the signature of this callback - you can do the interpretation of the void* inside the function. if you need to pass more context, then you may need to ... pass a context struct, as is done in many places

{
struct vty *vty;
struct zebra_vxlan_vni *vni;
struct vty *vty;
json_object *json_if;

vni = (struct zebra_vxlan_vni *)bucket->data;
vty = (struct vty *)ctxt;
vty = (struct vty *)args[0];
json_if = (json_object *)args[1];

zebra_vxlan_if_vni_dump_vty(vty, vni);
zebra_vxlan_if_vni_dump_vty(vty, json_if, vni);
}

static void zebra_vxlan_if_dump_vty(struct vty *vty, struct zebra_if *zebra_if)
{
struct zebra_l2info_vxlan *vxlan_info;
struct zebra_vxlan_vni_info *vni_info;
void *args[2];
char buf[PREFIX_STRLEN];

vxlan_info = &zebra_if->l2info.vxl;
vni_info = &vxlan_info->vni_info;

if (vxlan_info->vtep_ip.s_addr != INADDR_ANY)
vty_out(vty, " VTEP IP: %pI4", &vxlan_info->vtep_ip);
if (vxlan_info->vtep_ip.s_addr != INADDR_ANY &&
inet_ntop(AF_INET, &vxlan_info->vtep_ip, buf, sizeof(buf)) != NULL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the existing code is correct

vty_out(vty, " VTEP IP: %s", buf);

if (vxlan_info->ifindex_link && (vxlan_info->link_nsid != NS_UNKNOWN)) {
struct interface *ifp;
Expand All @@ -2578,10 +2594,14 @@ static void zebra_vxlan_if_dump_vty(struct vty *vty, struct zebra_if *zebra_if)
}

if (IS_ZEBRA_VXLAN_IF_VNI(zebra_if)) {
zebra_vxlan_if_vni_dump_vty(vty, &vni_info->vni);
zebra_vxlan_if_vni_dump_vty(vty, NULL, &vni_info->vni);
} else {
args[0] = vty;
args[1] = NULL;
hash_iterate(vni_info->vni_table,
zebra_vxlan_if_vni_hash_dump_vty, vty);
(void (*)(struct hash_bucket *,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, don't need to do this

void *))zebra_vxlan_if_vni_hash_dump_vty,
args);
}

vty_out(vty, "\n");
Expand Down Expand Up @@ -2910,23 +2930,14 @@ static void zebra_vxlan_if_vni_dump_vty_json(json_object *json_if,
&vni->mcast_grp);
}

static void zebra_vxlan_if_vni_hash_dump_vty_json(struct hash_bucket *bucket,
void *ctxt)
{
json_object *json_if;
struct zebra_vxlan_vni *vni;

vni = (struct zebra_vxlan_vni *)bucket->data;
json_if = (json_object *)ctxt;

zebra_vxlan_if_vni_dump_vty_json(json_if, vni);
}

static void zebra_vxlan_if_dump_vty_json(json_object *json_if,
struct zebra_if *zebra_if)
{
struct zebra_l2info_vxlan *vxlan_info;
struct zebra_vxlan_vni_info *vni_info;
json_object *json_vnis = NULL;
uint32_t num_vnis;
void *args[2];

vxlan_info = &zebra_if->l2info.vxl;
vni_info = &vxlan_info->vni_info;
Expand All @@ -2944,12 +2955,23 @@ static void zebra_vxlan_if_dump_vty_json(json_object *json_if,
json_object_string_add(json_if, "linkInterface",
ifp == NULL ? "Unknown" : ifp->name);
}

json_vnis = json_object_new_object();
if (IS_ZEBRA_VXLAN_IF_VNI(zebra_if)) {
zebra_vxlan_if_vni_dump_vty_json(json_if, &vni_info->vni);
} else {
hash_iterate(vni_info->vni_table,
zebra_vxlan_if_vni_hash_dump_vty_json, json_if);
num_vnis = hashcount(vni_info->vni_table);
if (num_vnis) {
args[0] = NULL;
args[1] = json_vnis;
hash_iterate(vni_info->vni_table,
(void (*)(struct hash_bucket *, void *))
zebra_vxlan_if_vni_hash_dump_vty,
args);
}
}

json_object_object_add(json_if, "vxlanId", json_vnis);
}

static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
Expand Down Expand Up @@ -3091,7 +3113,6 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
json_object_int_add(json_if, "vlanId", vlan_info->vid);
} else if (IS_ZEBRA_IF_VXLAN(ifp)) {
zebra_vxlan_if_dump_vty_json(json_if, zebra_if);

} else if (IS_ZEBRA_IF_GRE(ifp)) {
struct zebra_l2info_gre *gre_info;

Expand All @@ -3104,8 +3125,8 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
json_if, "vtepRemoteIp", "%pI4",
&gre_info->vtep_ip_remote);
}
if (gre_info->ifindex_link
&& (gre_info->link_nsid != NS_UNKNOWN)) {
if (gre_info->ifindex_link &&
(gre_info->link_nsid != NS_UNKNOWN)) {
struct interface *ifp;

ifp = if_lookup_by_index_per_ns(
Expand Down
3 changes: 3 additions & 0 deletions zebra/zebra_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void zebra_evpn_print(struct zebra_evpn *zevpn, void **ctxt)
} else {
json_object_int_add(json, "vni", zevpn->vni);
json_object_string_add(json, "type", "L2");
json_object_int_add(json, "vlan", zevpn->vid);
json_object_string_add(json, "bridge",
zevpn->bridge_if ? zevpn->bridge_if->name: "");
json_object_string_add(json, "tenantVrf", vrf_id_to_name(zevpn->vrf_id));
}

Expand Down
3 changes: 3 additions & 0 deletions zebra/zebra_evpn_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,9 @@ static void zebra_evpn_es_show_entry(struct vty *vty, struct zebra_evpn_es *es,
json_array_string_add(json_flags, "local");
if (es->flags & ZEBRA_EVPNES_REMOTE)
json_array_string_add(json_flags, "remote");
if (es->flags & ZEBRA_EVPNES_LOCAL &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned about this: the two flags involved are already represented - do we need to capture this semantic in this way, explicitly? can't the operator decide what the presence or absence of the two flags means?

!(es->flags & ZEBRA_EVPNES_NON_DF))
json_array_string_add(json_flags, "df");
if (es->flags & ZEBRA_EVPNES_NON_DF)
json_array_string_add(json_flags, "nonDF");
if (es->flags & ZEBRA_EVPNES_BYPASS)
Expand Down
20 changes: 20 additions & 0 deletions zebra/zebra_l2.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ struct zebra_l2_bridge_vlan {
struct zebra_evpn_access_bd *access_bd;
};

struct zebra_l2_brvlan_mac {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm - this commit adds data structures, but ... where's the code that updates them?
frankly, I think you should separate new feature proposals like this out into a separate PR, and offer just the json-specific changes in this PR

struct interface *br_if;
vlanid_t vid;
struct ethaddr macaddr;
ifindex_t ifindex;
};

struct zebra_l2_bridge_if_ctx {
/* input */
struct zebra_if *zif;
Expand All @@ -48,10 +55,23 @@ struct zebra_l2_bridge_if_ctx {
void *arg;
};

struct zebra_l2_brvlan_mac_ctx {
/* input */
struct interface *br_if;
vlanid_t vid;
int (*func)(struct interface *br_if, vlanid_t vid,
struct ethaddr *macaddr, ifindex_t ifidx, void *arg);

/* input-output */
void *arg;
struct json_object *json; /* Used for JSON Output */
};

struct zebra_l2_bridge_if {
uint8_t vlan_aware;
struct zebra_if *br_zif;
struct hash *vlan_table;
struct hash *mac_table[VLANID_MAX];
};

/* zebra L2 interface information - bridge interface */
Expand Down
Loading
Loading