|
@@ -602,42 +602,6 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)
|
|
|
return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr));
|
|
|
}
|
|
|
|
|
|
-/* Notify netdevs that UDP port started listening */
|
|
|
-static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
|
|
|
-{
|
|
|
- struct net_device *dev;
|
|
|
- struct sock *sk = vs->sock->sk;
|
|
|
- struct net *net = sock_net(sk);
|
|
|
- sa_family_t sa_family = vxlan_get_sk_family(vs);
|
|
|
- __be16 port = inet_sk(sk)->inet_sport;
|
|
|
-
|
|
|
- rcu_read_lock();
|
|
|
- for_each_netdev_rcu(net, dev) {
|
|
|
- if (dev->netdev_ops->ndo_add_vxlan_port)
|
|
|
- dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
|
|
|
- port);
|
|
|
- }
|
|
|
- rcu_read_unlock();
|
|
|
-}
|
|
|
-
|
|
|
-/* Notify netdevs that UDP port is no more listening */
|
|
|
-static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
|
|
|
-{
|
|
|
- struct net_device *dev;
|
|
|
- struct sock *sk = vs->sock->sk;
|
|
|
- struct net *net = sock_net(sk);
|
|
|
- sa_family_t sa_family = vxlan_get_sk_family(vs);
|
|
|
- __be16 port = inet_sk(sk)->inet_sport;
|
|
|
-
|
|
|
- rcu_read_lock();
|
|
|
- for_each_netdev_rcu(net, dev) {
|
|
|
- if (dev->netdev_ops->ndo_del_vxlan_port)
|
|
|
- dev->netdev_ops->ndo_del_vxlan_port(dev, sa_family,
|
|
|
- port);
|
|
|
- }
|
|
|
- rcu_read_unlock();
|
|
|
-}
|
|
|
-
|
|
|
/* Add new entry to forwarding table -- assumes lock held */
|
|
|
static int vxlan_fdb_create(struct vxlan_dev *vxlan,
|
|
|
const u8 *mac, union vxlan_addr *ip,
|
|
@@ -1033,7 +997,8 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs)
|
|
|
vn = net_generic(sock_net(vs->sock->sk), vxlan_net_id);
|
|
|
spin_lock(&vn->sock_lock);
|
|
|
hlist_del_rcu(&vs->hlist);
|
|
|
- vxlan_notify_del_rx_port(vs);
|
|
|
+ udp_tunnel_notify_del_rx_port(vs->sock,
|
|
|
+ UDP_TUNNEL_TYPE_VXLAN);
|
|
|
spin_unlock(&vn->sock_lock);
|
|
|
|
|
|
return true;
|
|
@@ -2508,30 +2473,22 @@ static struct device_type vxlan_type = {
|
|
|
.name = "vxlan",
|
|
|
};
|
|
|
|
|
|
-/* Calls the ndo_add_vxlan_port of the caller in order to
|
|
|
+/* Calls the ndo_add_udp_enc_port of the caller in order to
|
|
|
* supply the listening VXLAN udp ports. Callers are expected
|
|
|
- * to implement the ndo_add_vxlan_port.
|
|
|
+ * to implement the ndo_add_udp_enc_port.
|
|
|
*/
|
|
|
static void vxlan_push_rx_ports(struct net_device *dev)
|
|
|
{
|
|
|
struct vxlan_sock *vs;
|
|
|
struct net *net = dev_net(dev);
|
|
|
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
|
|
|
- sa_family_t sa_family;
|
|
|
- __be16 port;
|
|
|
unsigned int i;
|
|
|
|
|
|
- if (!dev->netdev_ops->ndo_add_vxlan_port)
|
|
|
- return;
|
|
|
-
|
|
|
spin_lock(&vn->sock_lock);
|
|
|
for (i = 0; i < PORT_HASH_SIZE; ++i) {
|
|
|
- hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {
|
|
|
- port = inet_sk(vs->sock->sk)->inet_sport;
|
|
|
- sa_family = vxlan_get_sk_family(vs);
|
|
|
- dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
|
|
|
- port);
|
|
|
- }
|
|
|
+ hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist)
|
|
|
+ udp_tunnel_push_rx_port(dev, vs->sock,
|
|
|
+ UDP_TUNNEL_TYPE_VXLAN);
|
|
|
}
|
|
|
spin_unlock(&vn->sock_lock);
|
|
|
}
|
|
@@ -2733,7 +2690,8 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
|
|
|
|
|
|
spin_lock(&vn->sock_lock);
|
|
|
hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
|
|
|
- vxlan_notify_add_rx_port(vs);
|
|
|
+ udp_tunnel_notify_add_rx_port(sock,
|
|
|
+ UDP_TUNNEL_TYPE_VXLAN);
|
|
|
spin_unlock(&vn->sock_lock);
|
|
|
|
|
|
/* Mark socket as an encapsulation socket. */
|