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

Function ipcomp_encapcheck

freebsd/netipsec/xform_ipcomp.c:107–121  ·  view source on GitHub ↗

* RFC 3173 p 2.2. Non-Expansion Policy: * If the total size of a compressed payload and the IPComp header, as * defined in section 3, is not smaller than the size of the original * payload, the IP datagram MUST be sent in the original non-compressed * form. * * When we use IPComp in tunnel mode, for small packets we will receive * encapsulated IP-IP datagrams without any compression and wit

Source from the content-addressed store, hash-verified

105 * header.
106 */
107static int
108ipcomp_encapcheck(union sockaddr_union *src, union sockaddr_union *dst)
109{
110 struct secasvar *sav;
111
112 sav = key_allocsa_tunnel(src, dst, IPPROTO_IPCOMP);
113 if (sav == NULL)
114 return (0);
115 key_freesav(&sav);
116
117 if (src->sa.sa_family == AF_INET)
118 return (sizeof(struct in_addr) << 4);
119 else
120 return (sizeof(struct in6_addr) << 4);
121}
122
123static int
124ipcomp_nonexp_input(struct mbuf *m, int off, int proto, void *arg __unused)

Callers 2

Calls 2

key_allocsa_tunnelFunction · 0.85
key_freesavFunction · 0.85

Tested by

no test coverage detected