diff options
author | bz <bz@FreeBSD.org> | 2009-02-08 09:27:07 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2009-02-08 09:27:07 +0000 |
commit | 8d30abae87cd5c2bd5618798ba40d8ce75dc3804 (patch) | |
tree | c3f4f5918e20a04942f107b193a1f461e54b06cb /sys/netinet6 | |
parent | 128fcdf861ec5a57a865a9821336441d8d211111 (diff) | |
download | FreeBSD-src-8d30abae87cd5c2bd5618798ba40d8ce75dc3804.zip FreeBSD-src-8d30abae87cd5c2bd5618798ba40d8ce75dc3804.tar.gz |
Try to remove/assimilate as much of formerly IPv4/6 specific
(duplicate) code in sys/netipsec/ipsec.c and fold it into
common, INET/6 independent functions.
The file local functions ipsec4_setspidx_inpcb() and
ipsec6_setspidx_inpcb() were 1:1 identical after the change
in r186528. Rename to ipsec_setspidx_inpcb() and remove the
duplicate.
Public functions ipsec[46]_get_policy() were 1:1 identical.
Remove one copy and merge in the factored out code from
ipsec_get_policy() into the other. The public function left
is now called ipsec_get_policy() and callers were adapted.
Public functions ipsec[46]_set_policy() were 1:1 identical.
Rename file local ipsec_set_policy() function to
ipsec_set_policy_internal().
Remove one copy of the public functions, rename the other
to ipsec_set_policy() and adapt callers.
Public functions ipsec[46]_hdrsiz() were logically identical
(ignoring one questionable assert in the v6 version).
Rename the file local ipsec_hdrsiz() to ipsec_hdrsiz_internal(),
the public function to ipsec_hdrsiz(), remove the duplicate
copy and adapt the callers.
The v6 version had been unused anyway. Cleanup comments.
Public functions ipsec[46]_in_reject() were logically identical
apart from statistics. Move the common code into a file local
ipsec46_in_reject() leaving vimage+statistics in small AF specific
wrapper functions. Note: unfortunately we already have a public
ipsec_in_reject().
Reviewed by: sam
Discussed with: rwatson (renaming to *_internal)
MFC after: 26 days
X-MFC: keep wrapper functions for public symbols?
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_forward.c | 2 | ||||
-rw-r--r-- | sys/netinet6/ip6_ipsec.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index ca5101f..10a6c45 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -457,7 +457,7 @@ skip_routing: sp = ipsec_getpolicybyaddr(mcopy, IPSEC_DIR_OUTBOUND, IP_FORWARDING, &ipsecerror); if (sp) { - ipsechdrsiz = ipsec6_hdrsiz(mcopy, + ipsechdrsiz = ipsec_hdrsiz(mcopy, IPSEC_DIR_OUTBOUND, NULL); if (ipsechdrsiz < mtu) mtu -= ipsechdrsiz; diff --git a/sys/netinet6/ip6_ipsec.c b/sys/netinet6/ip6_ipsec.c index a6ac5c9..a0c1abc 100644 --- a/sys/netinet6/ip6_ipsec.c +++ b/sys/netinet6/ip6_ipsec.c @@ -341,9 +341,7 @@ ip6_ipsec_mtu(struct mbuf *m) &ipsecerror); if (sp != NULL) { /* count IPsec header size */ - ipsechdr = ipsec4_hdrsiz(m, - IPSEC_DIR_OUTBOUND, - NULL); + ipsechdr = ipsec_hdrsiz(m, IPSEC_DIR_OUTBOUND, NULL); /* * find the correct route for outer IPv4 diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index ba40b68..2e2dc24 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1799,7 +1799,7 @@ do { \ if ((error = soopt_mcopyin(sopt, m)) != 0) /* XXX */ break; req = mtod(m, caddr_t); - error = ipsec6_set_policy(in6p, optname, req, + error = ipsec_set_policy(in6p, optname, req, m->m_len, (sopt->sopt_td != NULL) ? sopt->sopt_td->td_ucred : NULL); m_freem(m); @@ -2024,7 +2024,7 @@ do { \ req = mtod(m, caddr_t); len = m->m_len; } - error = ipsec6_get_policy(in6p, req, len, mp); + error = ipsec_get_policy(in6p, req, len, mp); if (error == 0) error = soopt_mcopyout(sopt, m); /* XXX */ if (error == 0 && m) |