diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2017-07-21 12:49:30 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-24 13:52:59 -0700 |
commit | 296d8ee37c50f139d934bdefbab85509b2e4a525 (patch) | |
tree | 822eb88015619a2dffb833cd9f1e3f23469e2ac7 /net/ipv4/udp_tunnel.c | |
parent | 7a27fc6d536b36a29c0ed4bfff7035420f4df216 (diff) | |
download | op-kernel-dev-296d8ee37c50f139d934bdefbab85509b2e4a525.zip op-kernel-dev-296d8ee37c50f139d934bdefbab85509b2e4a525.tar.gz |
net: add infrastructure to un-offload UDP tunnel port
This adds a new NETDEV_UDP_TUNNEL_DROP_INFO event, similar to
NETDEV_UDP_TUNNEL_PUSH_INFO, to signal to un-offload ports.
This also adds udp_tunnel_drop_rx_port(), which calls
ndo_udp_tunnel_del.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp_tunnel.c')
-rw-r--r-- | net/ipv4/udp_tunnel.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/ipv4/udp_tunnel.c b/net/ipv4/udp_tunnel.c index 0d3f14c..6539ff1 100644 --- a/net/ipv4/udp_tunnel.c +++ b/net/ipv4/udp_tunnel.c @@ -94,6 +94,24 @@ void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock, } EXPORT_SYMBOL_GPL(udp_tunnel_push_rx_port); +void udp_tunnel_drop_rx_port(struct net_device *dev, struct socket *sock, + unsigned short type) +{ + struct sock *sk = sock->sk; + struct udp_tunnel_info ti; + + if (!dev->netdev_ops->ndo_udp_tunnel_del || + !(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) + return; + + ti.type = type; + ti.sa_family = sk->sk_family; + ti.port = inet_sk(sk)->inet_sport; + + dev->netdev_ops->ndo_udp_tunnel_del(dev, &ti); +} +EXPORT_SYMBOL_GPL(udp_tunnel_drop_rx_port); + /* Notify netdevs that UDP port started listening */ void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type) { |