[Swan-dev] Fwd: [Swan-commit] Changes to ref refs/heads/master

Andrew Cagney andrew.cagney at gmail.com
Tue Jan 16 16:13:52 UTC 2018


Yea, this is part of a more general problem.  But first some
background.  We've always kind of sort of always had the stack:

- cur_state | ... | cur_state | cur_connection | cur_from

For instance, and somewhat in theory, when a packet arrives:

  - cur_from is set from the packet source
    log messages are prefixed with source IP
  -- cur_state is set from the state matching the packet
     log messages are prefixed with state
  --- check_msg_errqueue() gets an error for some other
state/connection and pushes that on top
      (but I replaced that with LSWLOG_STATE())
  -- cur_state is popped
    log messages are prefixed with a [garbage, I'm fixing that] source IP
  - cur_from is popped

Unfortunately, reality is a little different.  Pluto is littered with
redundant calls to both set and reset current state.  For instance:

ikev1.c:71613:        set_cur_state(md->st);    /* might have changed */
ikev1.c:71874:    set_cur_state(st); /* might have changed */
ikev1_main.c:19543:    set_cur_state(st); /* (caller will reset cur_state) */
ikev1_quick.c:40941:        set_cur_state(st);      /* (caller will reset) */
ikev2.c:70151:    set_cur_state(st);      /* might have changed */
ikev2.c:72478:    set_cur_state(st); /* might have changed */

The logging in the push/pop code's intent isn't so much to change
existing behaviour as log that behaviour great detail (probably in too
much detail).  Hopefully, this way we can understand what is really
going on and fix some clear sillyness.

For timer_event_cb() I know of two problems (but now you've fixed one, ya :-):
- when there was no state, while it would avoid setting cur_state(),
it didn't avoid resetting it
- when a state gets deleted, there's general confusion over who should
be pushing/poping cur_state

Andrew


---------- Forwarded message ----------
From: Paul Wouters <paul at vault.libreswan.fi>
Date: 15 January 2018 at 22:52
Subject: [Swan-commit] Changes to ref refs/heads/master
To: swan-commit at lists.libreswan.org


New commits:
commit 5e1f56d8639ba95c817a157adc2b75829140a298
Author: Paul Wouters <pwouters at redhat.com>
Date:   Mon Jan 15 22:47:00 2018 -0500

    pluto: don't reset_cur_state() for stateless events in timer_event_cb()


_______________________________________________
Swan-commit mailing list
Swan-commit at lists.libreswan.org
https://lists.libreswan.org/mailman/listinfo/swan-commit


More information about the Swan-dev mailing list