@@ -190,8 +190,9 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb)
190
190
return list_first_entry (& fdb -> remotes , struct vxlan_rdst , list );
191
191
}
192
192
193
- /* Find VXLAN socket based on network namespace, address family and UDP port
194
- * and enabled unshareable flags.
193
+ /* Find VXLAN socket based on network namespace, address family, UDP port,
194
+ * enabled unshareable flags and socket device binding (see l3mdev with
195
+ * non-default VRF).
195
196
*/
196
197
static struct vxlan_sock * vxlan_find_sock (struct net * net , sa_family_t family ,
197
198
__be16 port , u32 flags , int ifindex )
@@ -1875,6 +1876,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
1875
1876
!net_eq (vxlan -> net , dev_net (vxlan -> dev ))))
1876
1877
goto drop ;
1877
1878
1879
+ if (vs -> flags & VXLAN_F_REMCSUM_RX )
1880
+ if (unlikely (!vxlan_remcsum (& unparsed , skb , vs -> flags )))
1881
+ goto drop ;
1882
+
1878
1883
if (vxlan_collect_metadata (vs )) {
1879
1884
struct metadata_dst * tun_dst ;
1880
1885
@@ -1891,9 +1896,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
1891
1896
memset (md , 0 , sizeof (* md ));
1892
1897
}
1893
1898
1894
- if (vs -> flags & VXLAN_F_REMCSUM_RX )
1895
- if (!vxlan_remcsum (& unparsed , skb , vs -> flags ))
1896
- goto drop ;
1897
1899
if (vs -> flags & VXLAN_F_GBP )
1898
1900
vxlan_parse_gbp_hdr (& unparsed , skb , vs -> flags , md );
1899
1901
/* Note that GBP and GPE can never be active together. This is
@@ -2649,11 +2651,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
2649
2651
udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX );
2650
2652
label = vxlan -> cfg .label ;
2651
2653
} else {
2652
- if (!info ) {
2653
- WARN_ONCE (1 , "%s: Missing encapsulation instructions\n" ,
2654
- dev -> name );
2655
- goto drop ;
2656
- }
2657
2654
remote_ip .sa .sa_family = ip_tunnel_info_af (info );
2658
2655
if (remote_ip .sa .sa_family == AF_INET ) {
2659
2656
remote_ip .sin .sin_addr .s_addr = info -> key .u .ipv4 .dst ;
@@ -2888,6 +2885,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
2888
2885
info -> mode & IP_TUNNEL_INFO_TX ) {
2889
2886
vni = tunnel_id_to_key32 (info -> key .tun_id );
2890
2887
} else {
2888
+ if (!info )
2889
+ WARN_ONCE (1 , "%s: Missing encapsulation instructions\n" ,
2890
+ dev -> name );
2891
+
2891
2892
if (info && info -> mode & IP_TUNNEL_INFO_TX )
2892
2893
vxlan_xmit_one (skb , dev , vni , NULL , false);
2893
2894
else
@@ -3890,7 +3891,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
3890
3891
}
3891
3892
3892
3893
err = rtnl_configure_link (dev , NULL );
3893
- if (err )
3894
+ if (err < 0 )
3894
3895
goto unlink ;
3895
3896
3896
3897
if (f ) {
0 commit comments