Thread (7 messages) flat view 7 messages, 2 authors, 2018-01-26

Re: [bpf PATCH 1/3] net: add a UID to use for ULP socket assignment

From: John Fastabend <john.fastabend@gmail.com>
Date: 2018-01-26 16:22:11

On 01/26/2018 07:52 AM, Dave Watson wrote:
On 01/25/18 04:27 PM, John Fastabend wrote:
quoted
I did not however retest TLS with the small change to ULP layer.
Mostly because I don't have a TLS setup. I plan/hope to get around
to writing either a sample or preferably a selftest for this case
as well (assuming I didn't miss one).
quoted
@Dave Watson can you take a quick look to verify the changes are
good on TLS ULP side.
Looks reasonable, and passes my test suite.  One comment below

Tested-by: Dave Watson <redacted>
quoted
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 include/net/tcp.h  |    6 ++++++
 net/ipv4/tcp_ulp.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++-----
 net/tls/tls_main.c |    2 ++
 3 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
index 6bb9e14..8ef437d 100644
--- a/net/ipv4/tcp_ulp.c
+++ b/net/ipv4/tcp_ulp.c
@@ -133,3 +157,22 @@ int tcp_set_ulp(struct sock *sk, const char *name)
 	icsk->icsk_ulp_ops = ulp_ops;
 	return 0;
 }
+
+int tcp_set_ulp_id(struct sock *sk, int ulp)
+{
+	struct inet_connection_sock *icsk = inet_csk(sk);
+	const struct tcp_ulp_ops *ulp_ops;
+	int err;
+
+	if (icsk->icsk_ulp_ops)
+		return -EEXIST;
+
+	ulp_ops = __tcp_ulp_lookup(ulp);
+	if (!ulp_ops)
+		return -ENOENT;
+
+	err = ulp_ops->init(sk);
+	if (!err)
+		icsk->icsk_ulp_ops = ulp_ops;
Does this need module_put on error, similar to tcp_set_ulp?
Not needed in current use because its only being used with an in-kernel
ULP. However, best to fix it so that we don't have a (hard to detect)
bug first time someone uses this with a module ULP.

Thanks I'll spin a v2 this morning.
quoted
+	return err;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help