@@ -186,7 +186,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
186186 } else if (nh ) {
187187 ndm -> ndm_family = nh_family ;
188188 }
189- send_eth = !is_zero_ether_addr (fdb -> eth_addr );
189+ send_eth = !is_zero_ether_addr (fdb -> key . eth_addr );
190190 } else
191191 ndm -> ndm_family = AF_BRIDGE ;
192192 ndm -> ndm_state = fdb -> state ;
@@ -201,7 +201,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
201201 peernet2id (dev_net (vxlan -> dev ), vxlan -> net )))
202202 goto nla_put_failure ;
203203
204- if (send_eth && nla_put (skb , NDA_LLADDR , ETH_ALEN , & fdb -> eth_addr ))
204+ if (send_eth && nla_put (skb , NDA_LLADDR , ETH_ALEN , & fdb -> key . eth_addr ))
205205 goto nla_put_failure ;
206206 if (nh ) {
207207 if (nla_put_u32 (skb , NDA_NH_ID , nh_id ))
@@ -223,9 +223,9 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
223223 goto nla_put_failure ;
224224 }
225225
226- if ((vxlan -> cfg .flags & VXLAN_F_COLLECT_METADATA ) && fdb -> vni &&
226+ if ((vxlan -> cfg .flags & VXLAN_F_COLLECT_METADATA ) && fdb -> key . vni &&
227227 nla_put_u32 (skb , NDA_SRC_VNI ,
228- be32_to_cpu (fdb -> vni )))
228+ be32_to_cpu (fdb -> key . vni )))
229229 goto nla_put_failure ;
230230
231231 ci .ndm_used = jiffies_to_clock_t (now - READ_ONCE (fdb -> used ));
@@ -293,8 +293,8 @@ static void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan,
293293 fdb_info -> remote_port = rd -> remote_port ;
294294 fdb_info -> remote_vni = rd -> remote_vni ;
295295 fdb_info -> remote_ifindex = rd -> remote_ifindex ;
296- memcpy (fdb_info -> eth_addr , fdb -> eth_addr , ETH_ALEN );
297- fdb_info -> vni = fdb -> vni ;
296+ memcpy (fdb_info -> eth_addr , fdb -> key . eth_addr , ETH_ALEN );
297+ fdb_info -> vni = fdb -> key . vni ;
298298 fdb_info -> offloaded = rd -> offloaded ;
299299 fdb_info -> added_by_user = fdb -> flags & NTF_VXLAN_ADDED_BY_USER ;
300300}
@@ -366,7 +366,7 @@ static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])
366366 };
367367 struct vxlan_rdst remote = { };
368368
369- memcpy (f .eth_addr , eth_addr , ETH_ALEN );
369+ memcpy (f .key . eth_addr , eth_addr , ETH_ALEN );
370370
371371 vxlan_fdb_notify (vxlan , & f , & remote , RTM_GETNEIGH , true, NULL );
372372}
@@ -416,9 +416,9 @@ static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,
416416 struct vxlan_fdb * f ;
417417
418418 hlist_for_each_entry_rcu (f , head , hlist ) {
419- if (ether_addr_equal (mac , f -> eth_addr )) {
419+ if (ether_addr_equal (mac , f -> key . eth_addr )) {
420420 if (vxlan -> cfg .flags & VXLAN_F_COLLECT_METADATA ) {
421- if (vni == f -> vni )
421+ if (vni == f -> key . vni )
422422 return f ;
423423 } else {
424424 return f ;
@@ -539,7 +539,7 @@ int vxlan_fdb_replay(const struct net_device *dev, __be32 vni,
539539
540540 spin_lock_bh (& vxlan -> hash_lock );
541541 hlist_for_each_entry (f , & vxlan -> fdb_list , fdb_node ) {
542- if (f -> vni == vni ) {
542+ if (f -> key . vni == vni ) {
543543 list_for_each_entry (rdst , & f -> remotes , list ) {
544544 rc = vxlan_fdb_notify_one (nb , vxlan , f , rdst ,
545545 extack );
@@ -569,7 +569,7 @@ void vxlan_fdb_clear_offload(const struct net_device *dev, __be32 vni)
569569
570570 spin_lock_bh (& vxlan -> hash_lock );
571571 hlist_for_each_entry (f , & vxlan -> fdb_list , fdb_node ) {
572- if (f -> vni == vni ) {
572+ if (f -> key . vni == vni ) {
573573 list_for_each_entry (rdst , & f -> remotes , list )
574574 rdst -> offloaded = false;
575575 }
@@ -812,15 +812,16 @@ static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan, const u8 *mac,
812812 f = kmalloc (sizeof (* f ), GFP_ATOMIC );
813813 if (!f )
814814 return NULL ;
815+ memset (& f -> key , 0 , sizeof (f -> key ));
815816 f -> state = state ;
816817 f -> flags = ndm_flags ;
817818 f -> updated = f -> used = jiffies ;
818- f -> vni = src_vni ;
819+ f -> key . vni = src_vni ;
819820 f -> nh = NULL ;
820821 RCU_INIT_POINTER (f -> vdev , vxlan );
821822 INIT_LIST_HEAD (& f -> nh_list );
822823 INIT_LIST_HEAD (& f -> remotes );
823- memcpy (f -> eth_addr , mac , ETH_ALEN );
824+ memcpy (f -> key . eth_addr , mac , ETH_ALEN );
824825
825826 return f ;
826827}
@@ -959,7 +960,7 @@ static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
959960{
960961 struct vxlan_rdst * rd ;
961962
962- netdev_dbg (vxlan -> dev , "delete %pM\n" , f -> eth_addr );
963+ netdev_dbg (vxlan -> dev , "delete %pM\n" , f -> key . eth_addr );
963964
964965 -- vxlan -> addrcnt ;
965966 if (do_notify ) {
@@ -1031,8 +1032,8 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan,
10311032
10321033 if ((flags & NLM_F_REPLACE )) {
10331034 /* Only change unicasts */
1034- if (!(is_multicast_ether_addr (f -> eth_addr ) ||
1035- is_zero_ether_addr (f -> eth_addr ))) {
1035+ if (!(is_multicast_ether_addr (f -> key . eth_addr ) ||
1036+ is_zero_ether_addr (f -> key . eth_addr ))) {
10361037 if (nhid ) {
10371038 rc = vxlan_fdb_nh_update (vxlan , f , nhid , extack );
10381039 if (rc < 0 )
@@ -1048,8 +1049,8 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan,
10481049 }
10491050 }
10501051 if ((flags & NLM_F_APPEND ) &&
1051- (is_multicast_ether_addr (f -> eth_addr ) ||
1052- is_zero_ether_addr (f -> eth_addr ))) {
1052+ (is_multicast_ether_addr (f -> key . eth_addr ) ||
1053+ is_zero_ether_addr (f -> key . eth_addr ))) {
10531054 rc = vxlan_fdb_append (f , ip , port , vni , ifindex , & rd );
10541055
10551056 if (rc < 0 )
@@ -2853,7 +2854,7 @@ static void vxlan_cleanup(struct timer_list *t)
28532854 spin_lock (& vxlan -> hash_lock );
28542855 if (!hlist_unhashed (& f -> fdb_node )) {
28552856 netdev_dbg (vxlan -> dev , "garbage collect %pM\n" ,
2856- f -> eth_addr );
2857+ f -> key . eth_addr );
28572858 f -> state = NUD_STALE ;
28582859 vxlan_fdb_destroy (vxlan , f , true, true);
28592860 }
@@ -2972,7 +2973,8 @@ struct vxlan_fdb_flush_desc {
29722973static bool vxlan_fdb_is_default_entry (const struct vxlan_fdb * f ,
29732974 const struct vxlan_dev * vxlan )
29742975{
2975- return is_zero_ether_addr (f -> eth_addr ) && f -> vni == vxlan -> cfg .vni ;
2976+ return is_zero_ether_addr (f -> key .eth_addr ) &&
2977+ f -> key .vni == vxlan -> cfg .vni ;
29762978}
29772979
29782980static bool vxlan_fdb_nhid_matches (const struct vxlan_fdb * f , u32 nhid )
@@ -2995,7 +2997,7 @@ static bool vxlan_fdb_flush_matches(const struct vxlan_fdb *f,
29952997 if (desc -> ignore_default_entry && vxlan_fdb_is_default_entry (f , vxlan ))
29962998 return false;
29972999
2998- if (desc -> src_vni && f -> vni != desc -> src_vni )
3000+ if (desc -> src_vni && f -> key . vni != desc -> src_vni )
29993001 return false;
30003002
30013003 if (desc -> nhid && !vxlan_fdb_nhid_matches (f , desc -> nhid ))
0 commit comments