@@ -1152,6 +1152,39 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
1152
1152
return err ;
1153
1153
}
1154
1154
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
+
1155
1188
/* Watch incoming packets to learn mapping between Ethernet address
1156
1189
* and Tunnel endpoint.
1157
1190
* Return true if packet is bogus and should be dropped.
@@ -2805,6 +2838,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
2805
2838
.ndo_fdb_add = vxlan_fdb_add ,
2806
2839
.ndo_fdb_del = vxlan_fdb_delete ,
2807
2840
.ndo_fdb_dump = vxlan_fdb_dump ,
2841
+ .ndo_fdb_get = vxlan_fdb_get ,
2808
2842
.ndo_fill_metadata_dst = vxlan_fill_metadata_dst ,
2809
2843
};
2810
2844
0 commit comments