aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2014-12-16 21:25:31 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-18 12:38:13 -0500
commit7ed767f73192d6daf673c6d885cd02d5f280ac1f (patch)
tree9a696eea294b8a81e50068490de6a97412c68b33
parenta18e6a186f53af06937a2c268c72443336f4ab56 (diff)
geneve: Remove socket and offload handlers at destruction.
Sockets aren't currently removed from the the global list when they are destroyed. In addition, offload handlers need to be cleaned up as well. Fixes: 0b5e8b8e ("net: Add Geneve tunneling protocol driver") CC: Andy Zhou <azhou@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/geneve.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c
index a457232f0131..5a47188b01e9 100644
--- a/net/ipv4/geneve.c
+++ b/net/ipv4/geneve.c
@@ -159,6 +159,15 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs)
159 } 159 }
160} 160}
161 161
162static void geneve_notify_del_rx_port(struct geneve_sock *gs)
163{
164 struct sock *sk = gs->sock->sk;
165 sa_family_t sa_family = sk->sk_family;
166
167 if (sa_family == AF_INET)
168 udp_del_offload(&gs->udp_offloads);
169}
170
162/* Callback from net/ipv4/udp.c to receive packets */ 171/* Callback from net/ipv4/udp.c to receive packets */
163static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) 172static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
164{ 173{
@@ -312,9 +321,17 @@ EXPORT_SYMBOL_GPL(geneve_sock_add);
312 321
313void geneve_sock_release(struct geneve_sock *gs) 322void geneve_sock_release(struct geneve_sock *gs)
314{ 323{
324 struct net *net = sock_net(gs->sock->sk);
325 struct geneve_net *gn = net_generic(net, geneve_net_id);
326
315 if (!atomic_dec_and_test(&gs->refcnt)) 327 if (!atomic_dec_and_test(&gs->refcnt))
316 return; 328 return;
317 329
330 spin_lock(&gn->sock_lock);
331 hlist_del_rcu(&gs->hlist);
332 geneve_notify_del_rx_port(gs);
333 spin_unlock(&gn->sock_lock);
334
318 queue_work(geneve_wq, &gs->del_work); 335 queue_work(geneve_wq, &gs->del_work);
319} 336}
320EXPORT_SYMBOL_GPL(geneve_sock_release); 337EXPORT_SYMBOL_GPL(geneve_sock_release);