summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/key.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
committerzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
commit95a15f5c8435d206ae030c1ed698f4fca6afdeae (patch)
tree92dfba43d59635c80de0299501512e8472dbe130 /sys/netipsec/key.c
parent7beb3e535d23cc0fe9278167a9c3dc67220250fd (diff)
downloadFreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.zip
FreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.tar.gz
Merge more of currently non-functional (i.e. resolving to
whitespace) macros from p4/vimage branch. Do a better job at enclosing all instantiations of globals scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks. De-virtualize and mark as const saorder_state_alive and saorder_state_any arrays from ipsec code, given that they are never updated at runtime, so virtualizing them would be pointless. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/netipsec/key.c')
-rw-r--r--sys/netipsec/key.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index db79f59..3e2b4e0 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -189,11 +189,11 @@ static const u_int saorder_state_valid_prefer_old[] = {
static const u_int saorder_state_valid_prefer_new[] = {
SADB_SASTATE_MATURE, SADB_SASTATE_DYING,
};
-static u_int saorder_state_alive[] = {
+static const u_int saorder_state_alive[] = {
/* except DEAD */
SADB_SASTATE_MATURE, SADB_SASTATE_DYING, SADB_SASTATE_LARVAL
};
-static u_int saorder_state_any[] = {
+static const u_int saorder_state_any[] = {
SADB_SASTATE_MATURE, SADB_SASTATE_DYING,
SADB_SASTATE_LARVAL, SADB_SASTATE_DEAD
};
@@ -2699,9 +2699,9 @@ key_delsah(sah)
/* searching all SA registerd in the secindex. */
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_any);
+ stateidx < _ARRAYLEN(saorder_state_any);
stateidx++) {
- u_int state = V_saorder_state_any[stateidx];
+ u_int state = saorder_state_any[stateidx];
LIST_FOREACH_SAFE(sav, &sah->savtree[state], chain, nextsav) {
if (sav->refcnt == 0) {
/* sanity check */
@@ -2985,10 +2985,10 @@ key_getsavbyspi(sah, spi)
SAHTREE_LOCK_ASSERT();
/* search all status */
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_alive);
+ stateidx < _ARRAYLEN(saorder_state_alive);
stateidx++) {
- state = V_saorder_state_alive[stateidx];
+ state = saorder_state_alive[stateidx];
LIST_FOREACH(sav, &sah->savtree[state], chain) {
/* sanity check */
@@ -4336,6 +4336,7 @@ key_timehandler(void)
VNET_ITERATOR_DECL(vnet_iter);
time_t now = time_second;
+ VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
key_flush_spd(now);
@@ -4344,6 +4345,7 @@ key_timehandler(void)
key_flush_spacq(now);
CURVNET_RESTORE();
}
+ VNET_LIST_RUNLOCK();
#ifndef IPSEC_DEBUG2
/* do exchange to tick time !! */
@@ -5313,9 +5315,9 @@ key_delete_all(so, m, mhp, proto)
/* Delete all non-LARVAL SAs. */
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_alive);
+ stateidx < _ARRAYLEN(saorder_state_alive);
stateidx++) {
- state = V_saorder_state_alive[stateidx];
+ state = saorder_state_alive[stateidx];
if (state == SADB_SASTATE_LARVAL)
continue;
for (sav = LIST_FIRST(&sah->savtree[state]);
@@ -6518,9 +6520,9 @@ key_flush(so, m, mhp)
continue;
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_alive);
+ stateidx < _ARRAYLEN(saorder_state_alive);
stateidx++) {
- state = V_saorder_state_any[stateidx];
+ state = saorder_state_any[stateidx];
for (sav = LIST_FIRST(&sah->savtree[state]);
sav != NULL;
sav = nextsav) {
@@ -6603,9 +6605,9 @@ key_dump(so, m, mhp)
continue;
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_any);
+ stateidx < _ARRAYLEN(saorder_state_any);
stateidx++) {
- state = V_saorder_state_any[stateidx];
+ state = saorder_state_any[stateidx];
LIST_FOREACH(sav, &sah->savtree[state], chain) {
cnt++;
}
@@ -6633,9 +6635,9 @@ key_dump(so, m, mhp)
}
for (stateidx = 0;
- stateidx < _ARRAYLEN(V_saorder_state_any);
+ stateidx < _ARRAYLEN(saorder_state_any);
stateidx++) {
- state = V_saorder_state_any[stateidx];
+ state = saorder_state_any[stateidx];
LIST_FOREACH(sav, &sah->savtree[state], chain) {
n = key_setdumpsa(sav, SADB_DUMP, satype,
--cnt, mhp->msg->sadb_msg_pid);
OpenPOWER on IntegriCloud