@@ -192,7 +192,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
192
192
if (send_ip && nla_put_be32 (skb , NDA_DST , rdst -> remote_ip ))
193
193
goto nla_put_failure ;
194
194
195
- if (rdst -> remote_port && rdst -> remote_port != vxlan_port &&
195
+ if (rdst -> remote_port && rdst -> remote_port != htons ( vxlan_port ) &&
196
196
nla_put_be16 (skb , NDA_PORT , rdst -> remote_port ))
197
197
goto nla_put_failure ;
198
198
if (rdst -> remote_vni != vxlan -> default_dst .remote_vni &&
@@ -222,7 +222,7 @@ static inline size_t vxlan_nlmsg_size(void)
222
222
return NLMSG_ALIGN (sizeof (struct ndmsg ))
223
223
+ nla_total_size (ETH_ALEN ) /* NDA_LLADDR */
224
224
+ nla_total_size (sizeof (__be32 )) /* NDA_DST */
225
- + nla_total_size (sizeof (__be32 )) /* NDA_PORT */
225
+ + nla_total_size (sizeof (__be16 )) /* NDA_PORT */
226
226
+ nla_total_size (sizeof (__be32 )) /* NDA_VNI */
227
227
+ nla_total_size (sizeof (__u32 )) /* NDA_IFINDEX */
228
228
+ nla_total_size (sizeof (struct nda_cacheinfo ));
@@ -317,7 +317,7 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
317
317
318
318
/* Add/update destinations for multicast */
319
319
static int vxlan_fdb_append (struct vxlan_fdb * f ,
320
- __be32 ip , __u32 port , __u32 vni , __u32 ifindex )
320
+ __be32 ip , __be16 port , __u32 vni , __u32 ifindex )
321
321
{
322
322
struct vxlan_rdst * rd_prev , * rd ;
323
323
@@ -346,7 +346,7 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,
346
346
static int vxlan_fdb_create (struct vxlan_dev * vxlan ,
347
347
const u8 * mac , __be32 ip ,
348
348
__u16 state , __u16 flags ,
349
- __u32 port , __u32 vni , __u32 ifindex ,
349
+ __be16 port , __u32 vni , __u32 ifindex ,
350
350
__u8 ndm_flags )
351
351
{
352
352
struct vxlan_fdb * f ;
@@ -444,7 +444,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
444
444
struct vxlan_dev * vxlan = netdev_priv (dev );
445
445
struct net * net = dev_net (vxlan -> dev );
446
446
__be32 ip ;
447
- u32 port , vni , ifindex ;
447
+ __be16 port ;
448
+ u32 vni , ifindex ;
448
449
int err ;
449
450
450
451
if (!(ndm -> ndm_state & (NUD_PERMANENT |NUD_REACHABLE ))) {
@@ -462,11 +463,11 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
462
463
ip = nla_get_be32 (tb [NDA_DST ]);
463
464
464
465
if (tb [NDA_PORT ]) {
465
- if (nla_len (tb [NDA_PORT ]) != sizeof (u32 ))
466
+ if (nla_len (tb [NDA_PORT ]) != sizeof (__be16 ))
466
467
return - EINVAL ;
467
- port = nla_get_u32 (tb [NDA_PORT ]);
468
+ port = nla_get_be16 (tb [NDA_PORT ]);
468
469
} else
469
- port = vxlan_port ;
470
+ port = htons ( vxlan_port ) ;
470
471
471
472
if (tb [NDA_VNI ]) {
472
473
if (nla_len (tb [NDA_VNI ]) != sizeof (u32 ))
@@ -489,8 +490,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
489
490
ifindex = 0 ;
490
491
491
492
spin_lock_bh (& vxlan -> hash_lock );
492
- err = vxlan_fdb_create (vxlan , addr , ip , ndm -> ndm_state , flags , port ,
493
- vni , ifindex , ndm -> ndm_flags );
493
+ err = vxlan_fdb_create (vxlan , addr , ip , ndm -> ndm_state , flags ,
494
+ port , vni , ifindex , ndm -> ndm_flags );
494
495
spin_unlock_bh (& vxlan -> hash_lock );
495
496
496
497
return err ;
@@ -964,12 +965,13 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
964
965
struct udphdr * uh ;
965
966
struct flowi4 fl4 ;
966
967
__be32 dst ;
967
- __u16 src_port , dst_port ;
968
+ __u16 src_port ;
969
+ __be16 dst_port ;
968
970
u32 vni ;
969
971
__be16 df = 0 ;
970
972
__u8 tos , ttl ;
971
973
972
- dst_port = rdst -> remote_port ? rdst -> remote_port : vxlan_port ;
974
+ dst_port = rdst -> remote_port ? rdst -> remote_port : htons ( vxlan_port ) ;
973
975
vni = rdst -> remote_vni ;
974
976
dst = rdst -> remote_ip ;
975
977
@@ -1050,7 +1052,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
1050
1052
skb_reset_transport_header (skb );
1051
1053
uh = udp_hdr (skb );
1052
1054
1053
- uh -> dest = htons ( dst_port ) ;
1055
+ uh -> dest = dst_port ;
1054
1056
uh -> source = htons (src_port );
1055
1057
1056
1058
uh -> len = htons (skb -> len );
0 commit comments