summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-05-25 17:23:47 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-05-25 17:23:47 +0000
commit4cf9d17149a4f8b3c3f8d3df5ab706e872b53678 (patch)
treed367df8d4b2273b1e922d7e99d878b05c10f7c69 /sbin
parent240e2cbc1aa192202f2ab54585dfac659dee6a2c (diff)
rearrange order of messages sent to the kernel
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipsecctl/pfkey.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/sbin/ipsecctl/pfkey.c b/sbin/ipsecctl/pfkey.c
index a835e07d8a5..bb968d0e6a3 100644
--- a/sbin/ipsecctl/pfkey.c
+++ b/sbin/ipsecctl/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.4 2005/05/25 17:21:27 hshoexer Exp $ */
+/* $OpenBSD: pfkey.c,v 1.5 2005/05/25 17:23:46 hshoexer Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org>
@@ -195,6 +195,12 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction,
iov[iov_cnt].iov_len = sizeof(smsg);
iov_cnt++;
+ /* add flow type */
+ iov[iov_cnt].iov_base = &sa_flowtype;
+ iov[iov_cnt].iov_len = sizeof(sa_flowtype);
+ smsg.sadb_msg_len += sa_flowtype.sadb_protocol_len;
+ iov_cnt++;
+
/* remote peer */
iov[iov_cnt].iov_base = &sa_peer;
iov[iov_cnt].iov_len = sizeof(sa_peer);
@@ -204,19 +210,16 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction,
smsg.sadb_msg_len += sa_peer.sadb_address_len;
iov_cnt++;
- /* add flow type */
- iov[iov_cnt].iov_base = &sa_flowtype;
- iov[iov_cnt].iov_len = sizeof(sa_flowtype);
- smsg.sadb_msg_len += sa_flowtype.sadb_protocol_len;
+ /* src addr */
+ iov[iov_cnt].iov_base = &sa_src;
+ iov[iov_cnt].iov_len = sizeof(sa_src);
iov_cnt++;
-
- /* add protocol */
- iov[iov_cnt].iov_base = &sa_protocol;
- iov[iov_cnt].iov_len = sizeof(sa_protocol);
- smsg.sadb_msg_len += sa_protocol.sadb_protocol_len;
+ iov[iov_cnt].iov_base = &ssrc;
+ iov[iov_cnt].iov_len = ROUNDUP(ssrc.ss_len);
+ smsg.sadb_msg_len += sa_src.sadb_address_len;
iov_cnt++;
- /* add flow masks */
+ /* src mask */
iov[iov_cnt].iov_base = &sa_smask;
iov[iov_cnt].iov_len = sizeof(sa_smask);
iov_cnt++;
@@ -225,14 +228,6 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction,
smsg.sadb_msg_len += sa_smask.sadb_address_len;
iov_cnt++;
- iov[iov_cnt].iov_base = &sa_dmask;
- iov[iov_cnt].iov_len = sizeof(sa_dmask);
- iov_cnt++;
- iov[iov_cnt].iov_base = &dmask;
- iov[iov_cnt].iov_len = ROUNDUP(dmask.ss_len);
- smsg.sadb_msg_len += sa_dmask.sadb_address_len;
- iov_cnt++;
-
/* dest addr */
iov[iov_cnt].iov_base = &sa_dst;
iov[iov_cnt].iov_len = sizeof(sa_dst);
@@ -242,13 +237,19 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction,
smsg.sadb_msg_len += sa_dst.sadb_address_len;
iov_cnt++;
- /* src addr */
- iov[iov_cnt].iov_base = &sa_src;
- iov[iov_cnt].iov_len = sizeof(sa_src);
+ /* dst mask */
+ iov[iov_cnt].iov_base = &sa_dmask;
+ iov[iov_cnt].iov_len = sizeof(sa_dmask);
iov_cnt++;
- iov[iov_cnt].iov_base = &ssrc;
- iov[iov_cnt].iov_len = ROUNDUP(ssrc.ss_len);
- smsg.sadb_msg_len += sa_src.sadb_address_len;
+ iov[iov_cnt].iov_base = &dmask;
+ iov[iov_cnt].iov_len = ROUNDUP(dmask.ss_len);
+ smsg.sadb_msg_len += sa_dmask.sadb_address_len;
+ iov_cnt++;
+
+ /* add protocol */
+ iov[iov_cnt].iov_base = &sa_protocol;
+ iov[iov_cnt].iov_len = sizeof(sa_protocol);
+ smsg.sadb_msg_len += sa_protocol.sadb_protocol_len;
iov_cnt++;
if (sa_srcid) {