summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/xform_ah.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-10-22 22:42:28 +0000
committerglebius <glebius@FreeBSD.org>2012-10-22 22:42:28 +0000
commit95d300ced408856dfb95ce69da3674c21dbbb9c8 (patch)
tree34f134503bff83e6fb79dca9c49022ca937be833 /sys/netipsec/xform_ah.c
parent6fd43f620dd73915f4d09cb380be7ed4b2db49a0 (diff)
downloadFreeBSD-src-95d300ced408856dfb95ce69da3674c21dbbb9c8.zip
FreeBSD-src-95d300ced408856dfb95ce69da3674c21dbbb9c8.tar.gz
Couple of changes missed from r241913, which converted
IPv4 stack to network byte order.
Diffstat (limited to 'sys/netipsec/xform_ah.c')
-rw-r--r--sys/netipsec/xform_ah.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c
index 8ec838d..91fcad6 100644
--- a/sys/netipsec/xform_ah.c
+++ b/sys/netipsec/xform_ah.c
@@ -305,23 +305,13 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
ip->ip_ttl = 0;
ip->ip_sum = 0;
- /*
- * On input, fix ip_len which has been byte-swapped
- * at ip_input().
- */
- if (!out) {
- ip->ip_len = htons(ip->ip_len + skip);
-
- if (alg == CRYPTO_MD5_KPDK || alg == CRYPTO_SHA1_KPDK)
- ip->ip_off = htons(ip->ip_off & IP_DF);
- else
- ip->ip_off = 0;
- } else {
- if (alg == CRYPTO_MD5_KPDK || alg == CRYPTO_SHA1_KPDK)
- ip->ip_off = htons(ntohs(ip->ip_off) & IP_DF);
- else
- ip->ip_off = 0;
- }
+ if (!out)
+ ip->ip_len = htons(ntohs(ip->ip_len) + skip);
+
+ if (alg == CRYPTO_MD5_KPDK || alg == CRYPTO_SHA1_KPDK)
+ ip->ip_off &= htons(IP_DF);
+ else
+ ip->ip_off = htons(0);
ptr = mtod(m, unsigned char *) + sizeof(struct ip);
OpenPOWER on IntegriCloud