+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Get/set/delete fdb table with netlink
*
static void usage(void)
{
- fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
- " [ self ] [ master ] [ use ] [ router ]\n"
- " [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n"
- " [ port PORT] [ vni VNI ] [ via DEV ]\n");
- fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
+ fprintf(stderr,
+ "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
+ " [ self ] [ master ] [ use ] [ router ]\n"
+ " [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n"
+ " [ port PORT] [ vni VNI ] [ via DEV ]\n"
+ " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
exit(-1);
}
rta_getattr_u32(tb[NDA_VNI]));
}
+ if (tb[NDA_SRC_VNI]) {
+ if (jw_global)
+ jsonw_uint_field(jw_global, "src_vni",
+ rta_getattr_u32(tb[NDA_SRC_VNI]));
+ else
+ fprintf(fp, "src_vni %d ",
+ rta_getattr_u32(tb[NDA_SRC_VNI]));
+ }
+
if (tb[NDA_IFINDEX]) {
unsigned int ifindex = rta_getattr_u32(tb[NDA_IFINDEX]);
if (ifindex) {
- char ifname[IF_NAMESIZE];
+ if (!tb[NDA_LINK_NETNSID]) {
+ const char *ifname = ll_index_to_name(ifindex);
- if (!tb[NDA_LINK_NETNSID] &&
- if_indextoname(ifindex, ifname)) {
if (jw_global)
jsonw_string_field(jw_global, "viaIf",
ifname);
} else if (matches(*argv, "use") == 0) {
req.ndm.ndm_flags |= NTF_USE;
} else {
- if (strcmp(*argv, "to") == 0) {
+ if (strcmp(*argv, "to") == 0)
NEXT_ARG();
- }
+
if (matches(*argv, "help") == 0)
usage();
if (addr)
return -1;
}
- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0)
+ if (rtnl_talk(&rth, &req.n, NULL) < 0)
return -1;
return 0;