[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <20181031232635.33750-3-cpaasch@apple.com>
Date: Wed, 31 Oct 2018 16:26:35 -0700
From: Christoph Paasch <cpaasch@...le.com>
To: netdev@...r.kernel.org
Cc: Ian Swett <ianswett@...gle.com>,
Leif Hedstrom <lhedstrom@...le.com>,
Jana Iyengar <jri.ietf@...il.com>
Subject: [RFC 2/2] udp: Support SO_DELAYED_BIND
For UDP, there is only a single socket-hash table, the udptable.
We want to prevent incoming segments to match on this socket when
SO_DELAYED_BIND is set. Thus, when computing the score for unconnected
sockets, we simply prevent the match as long as the flag is set.
Signed-off-by: Christoph Paasch <cpaasch@...le.com>
---
net/ipv4/datagram.c | 1 +
net/ipv4/udp.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index 300921417f89..9bf0e0d2ea33 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -78,6 +78,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
inet->inet_id = jiffies;
sk_dst_set(sk, &rt->dst);
+ sock_reset_flag(sk, SOCK_DELAYED_BIND);
err = 0;
out:
return err;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ca3ed931f2a9..fb55f925342b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -408,6 +408,9 @@ static int compute_score(struct sock *sk, struct net *net,
score += 4;
}
+ if (sock_flag(sk, SOCK_DELAYED_BIND))
+ return -1;
+
if (sk->sk_incoming_cpu == raw_smp_processor_id())
score++;
return score;
--
2.16.2
Powered by blists - more mailing lists