@@ -190,8 +190,9 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb)
190190 return list_first_entry (& fdb -> remotes , struct vxlan_rdst , list );
191191}
192192
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).
195196 */
196197static struct vxlan_sock * vxlan_find_sock (struct net * net , sa_family_t family ,
197198 __be16 port , u32 flags , int ifindex )
@@ -1875,6 +1876,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
18751876 !net_eq (vxlan -> net , dev_net (vxlan -> dev ))))
18761877 goto drop ;
18771878
1879+ if (vs -> flags & VXLAN_F_REMCSUM_RX )
1880+ if (unlikely (!vxlan_remcsum (& unparsed , skb , vs -> flags )))
1881+ goto drop ;
1882+
18781883 if (vxlan_collect_metadata (vs )) {
18791884 struct metadata_dst * tun_dst ;
18801885
@@ -1891,9 +1896,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
18911896 memset (md , 0 , sizeof (* md ));
18921897 }
18931898
1894- if (vs -> flags & VXLAN_F_REMCSUM_RX )
1895- if (!vxlan_remcsum (& unparsed , skb , vs -> flags ))
1896- goto drop ;
18971899 if (vs -> flags & VXLAN_F_GBP )
18981900 vxlan_parse_gbp_hdr (& unparsed , skb , vs -> flags , md );
18991901 /* 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,
26492651 udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX );
26502652 label = vxlan -> cfg .label ;
26512653 } else {
2652- if (!info ) {
2653- WARN_ONCE (1 , "%s: Missing encapsulation instructions\n" ,
2654- dev -> name );
2655- goto drop ;
2656- }
26572654 remote_ip .sa .sa_family = ip_tunnel_info_af (info );
26582655 if (remote_ip .sa .sa_family == AF_INET ) {
26592656 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)
28882885 info -> mode & IP_TUNNEL_INFO_TX ) {
28892886 vni = tunnel_id_to_key32 (info -> key .tun_id );
28902887 } else {
2888+ if (!info )
2889+ WARN_ONCE (1 , "%s: Missing encapsulation instructions\n" ,
2890+ dev -> name );
2891+
28912892 if (info && info -> mode & IP_TUNNEL_INFO_TX )
28922893 vxlan_xmit_one (skb , dev , vni , NULL , false);
28932894 else
@@ -3890,7 +3891,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
38903891 }
38913892
38923893 err = rtnl_configure_link (dev , NULL );
3893- if (err )
3894+ if (err < 0 )
38943895 goto unlink ;
38953896
38963897 if (f ) {
0 commit comments