MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_ipsec_output

Function tcp_ipsec_output

freebsd/netipsec/xform_tcp.c:297–315  ·  view source on GitHub ↗

* Compute TCP-MD5 hash of an *OUTBOUND* TCP segment. * Parameters: * m pointer to head of mbuf chain * th pointer to TCP header * buf pointer to storage for computed MD5 digest * * Return 0 if successful, otherwise return error code. */

Source from the content-addressed store, hash-verified

295 * Return 0 if successful, otherwise return error code.
296 */
297static int
298tcp_ipsec_output(struct mbuf *m, struct tcphdr *th, u_char *buf)
299{
300 struct secasindex saidx;
301 struct secasvar *sav;
302
303 setsockaddrs(m, &saidx.src, &saidx.dst);
304 saidx.proto = IPPROTO_TCP;
305 saidx.mode = IPSEC_MODE_TCPMD5;
306 saidx.reqid = 0;
307 sav = key_allocsa_tcpmd5(&saidx);
308 if (sav == NULL) {
309 KMOD_TCPSTAT_INC(tcps_sig_err_buildsig);
310 return (EACCES);
311 }
312 tcp_signature_compute(m, th, sav, buf);
313 key_freesav(&sav);
314 return (0);
315}
316
317/*
318 * Initialize a TCP-MD5 SA. Called when the SA is being set up.

Callers

nothing calls this directly

Calls 4

setsockaddrsFunction · 0.85
key_allocsa_tcpmd5Function · 0.85
tcp_signature_computeFunction · 0.85
key_freesavFunction · 0.85

Tested by

no test coverage detected