summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-09 16:51:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-09 16:51:31 +0000
commit2176b0436effe7c3206600a2226146c9a0189832 (patch)
treeb513a23a3332e8b6fa8a2c864a4ce7f237f12d18
parente9a5184684449934419ba5d14af88bd1ed9bb6bc (diff)
re-arrange the pre-accounting of the objects in the buffer so it
is clearer; ok sthen
-rw-r--r--sys/net/pfkeyv2.c24
-rw-r--r--sys/net/pfkeyv2_convert.c6
2 files changed, 15 insertions, 15 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index baa685c08b0..45dadc17b96 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.129 2013/02/26 00:28:29 sthen Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.130 2013/03/09 16:51:30 deraadt Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -539,28 +539,28 @@ pfkeyv2_get(struct tdb *sa, void **headers, void **buffer, int *lenp)
i += sizeof(struct sadb_address) + PADUP(SA_LEN(&sa->tdb_proxy.sa));
if (sa->tdb_srcid)
- i += PADUP(sa->tdb_srcid->ref_len) + sizeof(struct sadb_ident);
+ i += sizeof(struct sadb_ident) + PADUP(sa->tdb_srcid->ref_len);
if (sa->tdb_dstid)
- i += PADUP(sa->tdb_dstid->ref_len) + sizeof(struct sadb_ident);
+ i += sizeof(struct sadb_ident) + PADUP(sa->tdb_dstid->ref_len);
if (sa->tdb_local_cred)
- i += PADUP(sa->tdb_local_cred->ref_len) + sizeof(struct sadb_x_cred);
+ i += sizeof(struct sadb_x_cred) + PADUP(sa->tdb_local_cred->ref_len);
if (sa->tdb_remote_cred)
- i += PADUP(sa->tdb_remote_cred->ref_len) + sizeof(struct sadb_x_cred);
+ i += sizeof(struct sadb_x_cred) + PADUP(sa->tdb_remote_cred->ref_len);
if (sa->tdb_local_auth)
- i += PADUP(sa->tdb_local_auth->ref_len) + sizeof(struct sadb_x_cred);
+ i += sizeof(struct sadb_x_cred) + PADUP(sa->tdb_local_auth->ref_len);
if (sa->tdb_remote_auth)
- i += PADUP(sa->tdb_remote_auth->ref_len) + sizeof(struct sadb_x_cred);
+ i += sizeof(struct sadb_x_cred) + PADUP(sa->tdb_remote_auth->ref_len);
if (sa->tdb_amxkey)
- i+= PADUP(sa->tdb_amxkeylen) + sizeof(struct sadb_key);
+ i += sizeof(struct sadb_key) + PADUP(sa->tdb_amxkeylen);
if (sa->tdb_emxkey)
- i+= PADUP(sa->tdb_emxkeylen) + sizeof(struct sadb_key);
+ i += sizeof(struct sadb_key) + PADUP(sa->tdb_emxkeylen);
if (sa->tdb_filter.sen_type) {
i += 2 * sizeof(struct sadb_protocol);
@@ -586,13 +586,13 @@ pfkeyv2_get(struct tdb *sa, void **headers, void **buffer, int *lenp)
}
if (sa->tdb_udpencap_port)
- i+= sizeof(struct sadb_x_udpencap);
+ i += sizeof(struct sadb_x_udpencap);
#if NPF > 0
if (sa->tdb_tag)
- i+= PADUP(PF_TAG_NAME_SIZE) + sizeof(struct sadb_x_tag);
+ i += sizeof(struct sadb_x_tag) + PADUP(PF_TAG_NAME_SIZE);
if (sa->tdb_tap)
- i+= sizeof(struct sadb_x_tap);
+ i += sizeof(struct sadb_x_tap);
#endif
if (lenp)
diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c
index 2f3dc890e6a..392a5c150b8 100644
--- a/sys/net/pfkeyv2_convert.c
+++ b/sys/net/pfkeyv2_convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2_convert.c,v 1.37 2012/09/18 09:24:45 markus Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.38 2013/03/09 16:51:30 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@@ -1004,11 +1004,11 @@ export_tag(void **p, struct tdb *tdb)
struct sadb_x_tag *stag = (struct sadb_x_tag *)*p;
char *s = (char *)(stag + 1);
- pf_tag2tagname(tdb->tdb_tag, s);
stag->sadb_x_tag_taglen = strlen(s) + 1;
stag->sadb_x_tag_len = (sizeof(struct sadb_x_tag) +
PADUP(stag->sadb_x_tag_taglen)) / sizeof(uint64_t);
- *p += PADUP(stag->sadb_x_tag_taglen) + sizeof(struct sadb_x_tag);
+ pf_tag2tagname(tdb->tdb_tag, s);
+ *p += sizeof(struct sadb_x_tag) + PADUP(stag->sadb_x_tag_taglen);
}
/* Import enc(4) tap device information for SA */