Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144430816
D45253.id138740.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D45253.id138740.diff
View Options
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -516,8 +516,7 @@
tfb = NULL;
}
/* Does the stack accept this connection? */
- if (tfb != NULL && tfb->tfb_tcp_handoff_ok != NULL &&
- (*tfb->tfb_tcp_handoff_ok)(tp)) {
+ if (tfb != NULL && (*tfb->tfb_tcp_handoff_ok)(tp)) {
refcount_release(&tfb->tfb_refcnt);
tfb = NULL;
}
@@ -551,11 +550,9 @@
/* there always should be a default */
panic("Can't refer to tcp_def_funcblk");
}
- if (tfb->tfb_tcp_handoff_ok != NULL) {
- if ((*tfb->tfb_tcp_handoff_ok) (tp)) {
- /* The default stack cannot say no */
- panic("Default stack rejects a new session?");
- }
+ if ((*tfb->tfb_tcp_handoff_ok)(tp)) {
+ /* The default stack cannot say no */
+ panic("Default stack rejects a new session?");
}
if (tfb->tfb_tcp_fb_init != NULL &&
(*tfb->tfb_tcp_fb_init)(tp, &ptr)) {
@@ -1186,6 +1183,7 @@
if ((blk->tfb_tcp_output == NULL) ||
(blk->tfb_tcp_do_segment == NULL) ||
(blk->tfb_tcp_ctloutput == NULL) ||
+ (blk->tfb_tcp_handoff_ok == NULL) ||
(strlen(blk->tfb_tcp_block_name) == 0)) {
/*
* These functions are required and you
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1742,26 +1742,11 @@
INP_WUNLOCK(inp);
return (0);
}
- if (tp->t_state != TCPS_CLOSED) {
- /*
- * The user has advanced the state
- * past the initial point, we may not
- * be able to switch.
- */
- if (blk->tfb_tcp_handoff_ok != NULL) {
- /*
- * Does the stack provide a
- * query mechanism, if so it may
- * still be possible?
- */
- error = (*blk->tfb_tcp_handoff_ok)(tp);
- } else
- error = EINVAL;
- if (error) {
- refcount_release(&blk->tfb_refcnt);
- INP_WUNLOCK(inp);
- return(error);
- }
+ error = (*blk->tfb_tcp_handoff_ok)(tp);
+ if (error) {
+ refcount_release(&blk->tfb_refcnt);
+ INP_WUNLOCK(inp);
+ return (error);
}
if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) {
refcount_release(&blk->tfb_refcnt);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -542,13 +542,10 @@
#define TCP_FUNC_OUTPUT_CANDROP 0x02 /* tfb_tcp_output may ask tcp_drop */
/**
- * Adding a tfb_tcp_handoff_ok function allows the socket
- * option to change stacks to query you even if the
- * connection is in a later stage. You return 0 to
- * say you can take over and run your stack, you return
- * non-zero (an error number) to say no you can't.
- * If the function is undefined you can only change
- * in the early states (before connect or listen).
+ * tfb_tcp_handoff_ok is a mandatory function allowing
+ * to query a stack, if it can take over a tcpcb.
+ * You return 0 to say you can take over and run your stack,
+ * you return non-zero (an error number) to say no you can't.
*
* tfb_tcp_fb_init is used to allow the new stack to
* setup its control block. Among the things it must
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 10:04 AM (15 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28565863
Default Alt Text
D45253.id138740.diff (3 KB)
Attached To
Mode
D45253: tcp: simplify stack switching protocol
Attached
Detach File
Event Timeline
Log In to Comment