Skip to content

Commit 474c3c8

Browse files
roopa-prabhudavem330
authored andcommitted
vxlan: support for ndo_fdb_get
This patch implements ndo_fdb_get for a vxlan device. Signed-off-by: Roopa Prabhu <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4767456 commit 474c3c8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

drivers/net/vxlan.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,39 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
11521152
return err;
11531153
}
11541154

1155+
static int vxlan_fdb_get(struct sk_buff *skb,
1156+
struct nlattr *tb[],
1157+
struct net_device *dev,
1158+
const unsigned char *addr,
1159+
u16 vid, u32 portid, u32 seq,
1160+
struct netlink_ext_ack *extack)
1161+
{
1162+
struct vxlan_dev *vxlan = netdev_priv(dev);
1163+
struct vxlan_fdb *f;
1164+
__be32 vni;
1165+
int err;
1166+
1167+
if (tb[NDA_VNI])
1168+
vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));
1169+
else
1170+
vni = vxlan->default_dst.remote_vni;
1171+
1172+
rcu_read_lock();
1173+
1174+
f = __vxlan_find_mac(vxlan, addr, vni);
1175+
if (!f) {
1176+
NL_SET_ERR_MSG(extack, "Fdb entry not found");
1177+
err = -ENOENT;
1178+
goto errout;
1179+
}
1180+
1181+
err = vxlan_fdb_info(skb, vxlan, f, portid, seq,
1182+
RTM_NEWNEIGH, 0, first_remote_rcu(f));
1183+
errout:
1184+
rcu_read_unlock();
1185+
return err;
1186+
}
1187+
11551188
/* Watch incoming packets to learn mapping between Ethernet address
11561189
* and Tunnel endpoint.
11571190
* Return true if packet is bogus and should be dropped.
@@ -2805,6 +2838,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
28052838
.ndo_fdb_add = vxlan_fdb_add,
28062839
.ndo_fdb_del = vxlan_fdb_delete,
28072840
.ndo_fdb_dump = vxlan_fdb_dump,
2841+
.ndo_fdb_get = vxlan_fdb_get,
28082842
.ndo_fill_metadata_dst = vxlan_fill_metadata_dst,
28092843
};
28102844

0 commit comments

Comments
 (0)