diff options
author | lstewart <lstewart@FreeBSD.org> | 2010-12-28 12:13:30 +0000 |
---|---|---|
committer | lstewart <lstewart@FreeBSD.org> | 2010-12-28 12:13:30 +0000 |
commit | 446c1bbb1050c94f909d1e50d11fb077474dc734 (patch) | |
tree | 869629e383bc3e8573a40751fec17a42def4dc61 /sys/netinet/tcp_output.c | |
parent | 1f1cd9cdf4ed51b95c8b0990c8ebc10bb9973845 (diff) | |
download | FreeBSD-src-446c1bbb1050c94f909d1e50d11fb077474dc734.zip FreeBSD-src-446c1bbb1050c94f909d1e50d11fb077474dc734.tar.gz |
- Add some helper hook points to the TCP stack. The hooks allow Khelp modules to
access inbound/outbound events and associated data for established TCP
connections. The hooks only run if at least one hook function is registered
for the hook point, ensuring the impact on the stack is effectively nil when
no TCP Khelp modules are loaded. struct tcp_hhook_data is passed as contextual
data to any registered Khelp module hook functions.
- Add an OSD (Object Specific Data) pointer to struct tcpcb to allow Khelp
modules to associate per-connection data with the TCP control block.
- Bump __FreeBSD_version and add a note to UPDATING regarding to ABI changes
introduced by this commit and r216753.
In collaboration with: David Hayes <dahayes at swin edu au> and
Grenville Armitage <garmitage at swin edu au>
Sponsored by: FreeBSD Foundation
Reviewed by: bz, others along the way
MFC after: 3 months
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r-- | sys/netinet/tcp_output.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index b7ec6f7..55d3c8e 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/domain.h> +#include <sys/hhook.h> #include <sys/kernel.h> #include <sys/lock.h> #include <sys/mbuf.h> @@ -126,9 +127,33 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_max), 0, "Max size of automatic send buffer"); +static void inline hhook_run_tcp_est_out(struct tcpcb *tp, + struct tcphdr *th, struct tcpopt *to, + long len, int tso); static void inline cc_after_idle(struct tcpcb *tp); /* + * Wrapper for the TCP established ouput helper hook. + */ +static void inline +hhook_run_tcp_est_out(struct tcpcb *tp, struct tcphdr *th, + struct tcpopt *to, long len, int tso) +{ + struct tcp_hhook_data hhook_data; + + if (V_tcp_hhh[HHOOK_TCP_EST_OUT]->hhh_nhooks > 0) { + hhook_data.tp = tp; + hhook_data.th = th; + hhook_data.to = to; + hhook_data.len = len; + hhook_data.tso = tso; + + hhook_run_hooks(V_tcp_hhh[HHOOK_TCP_EST_OUT], &hhook_data, + tp->osd); + } +} + +/* * CC wrapper hook functions */ static void inline @@ -1134,6 +1159,9 @@ timer: tp->snd_max = tp->snd_nxt + len; } + /* Run HHOOK_TCP_ESTABLISHED_OUT helper hooks. */ + hhook_run_tcp_est_out(tp, th, &to, len, tso); + #ifdef TCPDEBUG /* * Trace. |