Commit bd0b68a8 authored by David S. Miller's avatar David S. Miller

Merge branch 'vxlan-clean-up'

Fabian Frederick says:

====================
vxlan: clean-up

This small patchet does some clean-up on vxlan.
Second version removes VXLAN_NL2FLAG macro relevant patches as suggested by Michal and David

I hope to have some feedback/ACK from vxlan developers.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 74705582 78ec710e
...@@ -190,8 +190,9 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb) ...@@ -190,8 +190,9 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb)
return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); return list_first_entry(&fdb->remotes, struct vxlan_rdst, list);
} }
/* Find VXLAN socket based on network namespace, address family and UDP port /* Find VXLAN socket based on network namespace, address family, UDP port,
* and enabled unshareable flags. * enabled unshareable flags and socket device binding (see l3mdev with
* non-default VRF).
*/ */
static struct vxlan_sock *vxlan_find_sock(struct net *net, sa_family_t family, static struct vxlan_sock *vxlan_find_sock(struct net *net, sa_family_t family,
__be16 port, u32 flags, int ifindex) __be16 port, u32 flags, int ifindex)
...@@ -1875,6 +1876,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -1875,6 +1876,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
!net_eq(vxlan->net, dev_net(vxlan->dev)))) !net_eq(vxlan->net, dev_net(vxlan->dev))))
goto drop; goto drop;
if (vs->flags & VXLAN_F_REMCSUM_RX)
if (unlikely(!vxlan_remcsum(&unparsed, skb, vs->flags)))
goto drop;
if (vxlan_collect_metadata(vs)) { if (vxlan_collect_metadata(vs)) {
struct metadata_dst *tun_dst; struct metadata_dst *tun_dst;
...@@ -1891,9 +1896,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -1891,9 +1896,6 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
memset(md, 0, sizeof(*md)); memset(md, 0, sizeof(*md));
} }
if (vs->flags & VXLAN_F_REMCSUM_RX)
if (!vxlan_remcsum(&unparsed, skb, vs->flags))
goto drop;
if (vs->flags & VXLAN_F_GBP) if (vs->flags & VXLAN_F_GBP)
vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md); vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md);
/* Note that GBP and GPE can never be active together. This is /* 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,11 +2651,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
label = vxlan->cfg.label; label = vxlan->cfg.label;
} else { } else {
if (!info) {
WARN_ONCE(1, "%s: Missing encapsulation instructions\n",
dev->name);
goto drop;
}
remote_ip.sa.sa_family = ip_tunnel_info_af(info); remote_ip.sa.sa_family = ip_tunnel_info_af(info);
if (remote_ip.sa.sa_family == AF_INET) { if (remote_ip.sa.sa_family == AF_INET) {
remote_ip.sin.sin_addr.s_addr = info->key.u.ipv4.dst; 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,6 +2885,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
info->mode & IP_TUNNEL_INFO_TX) { info->mode & IP_TUNNEL_INFO_TX) {
vni = tunnel_id_to_key32(info->key.tun_id); vni = tunnel_id_to_key32(info->key.tun_id);
} else { } else {
if (!info)
WARN_ONCE(1, "%s: Missing encapsulation instructions\n",
dev->name);
if (info && info->mode & IP_TUNNEL_INFO_TX) if (info && info->mode & IP_TUNNEL_INFO_TX)
vxlan_xmit_one(skb, dev, vni, NULL, false); vxlan_xmit_one(skb, dev, vni, NULL, false);
else else
...@@ -3890,7 +3891,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, ...@@ -3890,7 +3891,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
} }
err = rtnl_configure_link(dev, NULL); err = rtnl_configure_link(dev, NULL);
if (err) if (err < 0)
goto unlink; goto unlink;
if (f) { if (f) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment