net: check UDP tunnel RX port offload feature before calling tunnel ndo ndo
If NETIF_F_RX_UDP_TUNNEL_PORT was disabled on a given netdevice, skip the tunnel offload ndo call during tunnel port creation and deletion. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d764a122cc
commit
7a27fc6d53
@@ -82,7 +82,8 @@ void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock,
|
|||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct udp_tunnel_info ti;
|
struct udp_tunnel_info ti;
|
||||||
|
|
||||||
if (!dev->netdev_ops->ndo_udp_tunnel_add)
|
if (!dev->netdev_ops->ndo_udp_tunnel_add ||
|
||||||
|
!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ti.type = type;
|
ti.type = type;
|
||||||
@@ -109,6 +110,8 @@ void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type)
|
|||||||
for_each_netdev_rcu(net, dev) {
|
for_each_netdev_rcu(net, dev) {
|
||||||
if (!dev->netdev_ops->ndo_udp_tunnel_add)
|
if (!dev->netdev_ops->ndo_udp_tunnel_add)
|
||||||
continue;
|
continue;
|
||||||
|
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
|
||||||
|
continue;
|
||||||
dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti);
|
dev->netdev_ops->ndo_udp_tunnel_add(dev, &ti);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
@@ -131,6 +134,8 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type)
|
|||||||
for_each_netdev_rcu(net, dev) {
|
for_each_netdev_rcu(net, dev) {
|
||||||
if (!dev->netdev_ops->ndo_udp_tunnel_del)
|
if (!dev->netdev_ops->ndo_udp_tunnel_del)
|
||||||
continue;
|
continue;
|
||||||
|
if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
|
||||||
|
continue;
|
||||||
dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti);
|
dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user