From: Martin KaFai Lau <kafai@fb.com>
To: netdev <netdev@vger.kernel.org>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
Eric Dumazet <edumazet@google.com>, Wei Wang <weiwan@google.com>,
Kernel Team <kernel-team@fb.com>
Subject: [RFC PATCH net 4/4] ipv6: udp: Do a route lookup and update during release_cb
Date: Fri, 1 Apr 2016 15:56:31 -0700 [thread overview]
Message-ID: <1459551391-69969-5-git-send-email-kafai@fb.com> (raw)
In-Reply-To: <1459551391-69969-1-git-send-email-kafai@fb.com>
This patch adds a release_cb for UDPv6. It does a route lookup
and updates sk->sk_dst_cache if it is needed. It picks up the
left-over job from ip6_sk_update_pmtu() if the sk is owned
by user during the pmtu update.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reported-by: Wei Wang <weiwan@google.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Wei Wang <weiwan@google.com>
---
include/net/ipv6.h | 1 +
net/ipv6/datagram.c | 12 ++++++++++++
net/ipv6/udp.c | 1 +
3 files changed, 14 insertions(+)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index fd02e90..1be050a 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -960,6 +960,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr,
int addr_len);
int ip6_datagram_dst_update(struct sock *sk, bool fix_sk_saddr);
+void ip6_datagram_release_cb(struct sock *sk);
int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
int *addr_len);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 0b60f1e..a4f06bd 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -119,6 +119,18 @@ out:
return err;
}
+void ip6_datagram_release_cb(struct sock *sk)
+{
+ struct dst_entry *dst;
+
+ dst = __sk_dst_get(sk);
+ if (!dst || dst->ops->check(dst, inet6_sk(sk)->dst_cookie))
+ return;
+
+ ip6_datagram_dst_update(sk, false);
+}
+EXPORT_SYMBOL_GPL(ip6_datagram_release_cb);
+
static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{
struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8125931..6bc5c66 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1539,6 +1539,7 @@ struct proto udpv6_prot = {
.sendmsg = udpv6_sendmsg,
.recvmsg = udpv6_recvmsg,
.backlog_rcv = __udpv6_queue_rcv_skb,
+ .release_cb = ip6_datagram_release_cb,
.hash = udp_lib_hash,
.unhash = udp_lib_unhash,
.rehash = udp_v6_rehash,
--
2.5.1
prev parent reply other threads:[~2016-04-01 22:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 22:56 [RFC PATCH net 0/4] ip6: datagram: Update dst cache of a connected datagram sk during pmtu update Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 1/4] ipv6: datagram: Refactor flowi6 init codes to a new function Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 2/4] ipv6: datagram: Refactor dst lookup and update " Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 3/4] ipv6: datagram: Update dst cache of a connected datagram sk during pmtu update Martin KaFai Lau
2016-04-01 23:13 ` Cong Wang
2016-04-01 23:15 ` Cong Wang
2016-04-03 2:33 ` Martin KaFai Lau
2016-04-04 20:45 ` Cong Wang
2016-04-05 23:56 ` David Miller
2016-04-11 17:56 ` Martin KaFai Lau
2016-04-06 0:11 ` Martin KaFai Lau
2016-04-06 17:58 ` Cong Wang
2016-04-06 18:49 ` Martin KaFai Lau
2016-04-07 18:37 ` Cong Wang
2016-04-07 19:09 ` Martin KaFai Lau
2016-04-01 22:56 ` Martin KaFai Lau [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459551391-69969-5-git-send-email-kafai@fb.com \
--to=kafai@fb.com \
--cc=edumazet@google.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=weiwan@google.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).