[PATCH 11/18] Protocol change: Initiate key setup on incoming packets, not outgoing ones
ijackson at chiark.greenend.org.uk
Wed Aug 17 23:54:29 BST 2011
If data is exchanged after the "renegotiation time", we need to
refresh the data transfer key - ie, to initiate a key setup.
Previously this was done by the peer which wanted to transmit data
using an existing but in-need-of-refreshing key.
However, mobile peers may often be disconnected. There is no point
trying to do a key renegotiation while they are disconnected. Thus it
is better to have the renegotiation initiated by a peer which receives
a data packet. That means that if there is a network outage,
renegotiation will be deferred until the network is restored.
In particular, it means that a mobile node which has no underlying
network but which has applications trying to send data will not waste
effort attempting key renegotiation until it once more has
This minor functional change should be harmless or even beneficial for
non-mobile sites too. It simply means that the other peer will play
the role of initiator during renegotiation, but since which peer
played this role is arbitrary for non-mobile sites this should make no
Compatibility: In the case of an old version of secnet talking to a
new version, only data packets in one direction will cause
renegotiation. This should not be a problem since all real-world
IP protocols involve data in both directions.
So we make the new behaviour universal rather than making it depend on
the forthcoming "mobile-peer" site config option.
Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
site.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/site.c b/site.c
index 13a6bc3..5a4b64a 100644
@@ -656,6 +656,9 @@ static bool_t process_msg0(struct site *st, struct buffer_if *msg0,
/* Deliver to netlink layer */
+ /* See whether we should start negotiating a new key */
+ if (st->now > st->renegotiate_key_time)
+ initiate_key_setup(st,"incoming packet in renegotiation window");
slog(st,LOG_SEC,"incoming encrypted message of type %08x "
@@ -1009,9 +1012,6 @@ static void site_outgoing(void *sst, struct buffer_if *buf)
- /* See whether we should start negotiating a new key */
- if (st->now > st->renegotiate_key_time)
- initiate_key_setup(st,"outgoing packet in renegotiation window");
More information about the sgo-software-discuss