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

Function ipsec_prepend

freebsd/netipsec/ipsec_output.c:863–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861 max(sizeof(struct newesp) + EALG_MAX_BLOCK_LEN, /* ESP + IV */ \
862 sizeof(struct newah) + HASH_MAX_LEN /* AH + ICV */))
863static struct mbuf *
864ipsec_prepend(struct mbuf *m, int len, int how)
865{
866 struct mbuf *n;
867
868 M_ASSERTPKTHDR(m);
869 IPSEC_ASSERT(len < MHLEN, ("wrong length"));
870 if (M_LEADINGSPACE(m) >= len) {
871 /* No need to allocate new mbuf. */
872 m->m_data -= len;
873 m->m_len += len;
874 m->m_pkthdr.len += len;
875 return (m);
876 }
877 n = m_gethdr(how, m->m_type);
878 if (n == NULL) {
879 m_freem(m);
880 return (NULL);
881 }
882 m_move_pkthdr(n, m);
883 n->m_next = m;
884 if (len + IPSEC_TRAILINGSPACE < M_SIZE(n))
885 m_align(n, len + IPSEC_TRAILINGSPACE);
886 n->m_len = len;
887 n->m_pkthdr.len += len;
888 return (n);
889}
890
891static int
892ipsec_encap(struct mbuf **mp, struct secasindex *saidx)

Callers 1

ipsec_encapFunction · 0.85

Calls 4

m_move_pkthdrFunction · 0.85
m_gethdrFunction · 0.50
m_freemFunction · 0.50
m_alignFunction · 0.50

Tested by

no test coverage detected