summaryrefslogtreecommitdiff
path: root/src/pluto/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pluto/state.c')
-rw-r--r--src/pluto/state.c56
1 files changed, 2 insertions, 54 deletions
diff --git a/src/pluto/state.c b/src/pluto/state.c
index 29d78fb3d..3639f944d 100644
--- a/src/pluto/state.c
+++ b/src/pluto/state.c
@@ -734,7 +734,7 @@ void fmt_state(bool all, struct state *st, time_t n, char *state_buf,
, st->st_serialno
, c->name, inst
, enum_name(&state_names, st->st_state)
- , state_story[st->st_state - STATE_MAIN_R0]
+ , state_story[st->st_state]
, timer_event_names, st->st_event->ev_type
, delta
, np1, np2, eo, dpd);
@@ -782,7 +782,7 @@ void fmt_state(bool all, struct state *st, time_t n, char *state_buf,
}
if (st->st_esp.present)
{
- time_t now = time(NULL);
+ time_t now = time_monotonic(NULL);
add_said(&c->spd.that.host_addr, st->st_esp.attrs.spi, SA_ESP);
add_sa_info(st, FALSE);
@@ -794,12 +794,10 @@ void fmt_state(bool all, struct state *st, time_t n, char *state_buf,
add_said(&c->spd.that.host_addr, st->st_ipcomp.attrs.spi, SA_COMP);
add_said(&c->spd.this.host_addr, st->st_ipcomp.our_spi, SA_COMP);
}
-#ifdef KLIPS
tunnel = st->st_ah.attrs.encapsulation == ENCAPSULATION_MODE_TUNNEL
|| st->st_esp.attrs.encapsulation == ENCAPSULATION_MODE_TUNNEL
|| st->st_ipcomp.attrs.encapsulation == ENCAPSULATION_MODE_TUNNEL;
p += snprintf(p, p_end - p, "; %s", tunnel? "tunnel":"transport");
-#endif
snprintf(state_buf2, state_buf2_len
, "#%lu: \"%s\"%s%s"
@@ -897,56 +895,6 @@ void show_states_status(bool all, const char *name)
free(array);
}
-/* Given that we've used up a range of unused CPI's,
- * search for a new range of currently unused ones.
- * Note: this is very expensive when not trivial!
- * If we can't find one easily, choose 0 (a bad SPI,
- * no matter what order) indicating failure.
- */
-void find_my_cpi_gap(cpi_t *latest_cpi, cpi_t *first_busy_cpi)
-{
- int tries = 0;
- cpi_t base = *latest_cpi;
- cpi_t closest;
- int i;
-
-startover:
- closest = ~0; /* not close at all */
- for (i = 0; i < STATE_TABLE_SIZE; i++)
- {
- struct state *st;
-
- for (st = statetable[i]; st != NULL; st = st->st_hashchain_next)
- {
- if (st->st_ipcomp.present)
- {
- cpi_t c = ntohl(st->st_ipcomp.our_spi) - base;
-
- if (c < closest)
- {
- if (c == 0)
- {
- /* oops: next spot is occupied; start over */
- if (++tries == 20)
- {
- /* FAILURE */
- *latest_cpi = *first_busy_cpi = 0;
- return;
- }
- base++;
- if (base > IPCOMP_LAST_NEGOTIATED)
- base = IPCOMP_FIRST_NEGOTIATED;
- goto startover; /* really a tail call */
- }
- closest = c;
- }
- }
- }
- }
- *latest_cpi = base; /* base is first in next free range */
- *first_busy_cpi = closest + base; /* and this is the roof */
-}
-
/* Muck with high-order 16 bits of this SPI in order to make
* the corresponding SAID unique.
* Its low-order 16 bits hold a well-known IPCOMP CPI.