Created attachment 156875 [details] Always send a soft expire The FreeBSD kernel currently only sends an SADB_EXPIRE message when the soft lifetime expires if the IPsec SA has been used. Some keying daemons might want to rekey the SA even if it has not been used, which is not possible if no SADB_EXPIRE message is sent (or only if they set their own timers to trigger a rekeying). Also not nice is that currently no soft expire is triggered if the SA is used after the soft lifetime has already expired. The attached patch is based on the one I submitted with bug #200282 and removes the check for the current use time before sending a soft expire. By the way, wouldn't it make sense to check the hard lifetime also for SAs in state SADB_SASTATE_MATURE? Otherwise, SAs that only have a hard lifetime set won't ever expire as they will never enter the state SADB_SASTATE_DYING.
A commit references this bug: Author: ae Date: Tue May 19 08:30:05 UTC 2015 New revision: 283101 URL: https://svnweb.freebsd.org/changeset/base/283101 Log: Teach key_expire() send SADB_EXPIRE message with the SADB_EXT_LIFETIME_HARD extension header type. The key_flush_sad() now will send SADB_EXPIRE message when HARD lifetime expires. This is required by RFC 2367 and some keying daemons rely on these messages. HARD lifetime messages have precedence over SOFT lifetime messages, so now they will be checked first. Also now SADB_EXPIRE messages will be send even the SA has not been used, because keying daemons might want to rekey such SA. PR: 200282, 200283 Submitted by: Tobias Brunner <tobias at strongswan dot org> MFC after: 2 weeks Changes: head/sys/netipsec/key.c
Fixed in head/ and stable/10. Thanks!
A commit references this bug: Author: ae Date: Tue Jun 2 03:51:34 UTC 2015 New revision: 283903 URL: https://svnweb.freebsd.org/changeset/base/283903 Log: MFC r283101: Teach key_expire() send SADB_EXPIRE message with the SADB_EXT_LIFETIME_HARD extension header type. The key_flush_sad() now will send SADB_EXPIRE message when HARD lifetime expires. This is required by RFC 2367 and some keying daemons rely on these messages. HARD lifetime messages have precedence over SOFT lifetime messages, so now they will be checked first. Also now SADB_EXPIRE messages will be send even the SA has not been used, because keying daemons might want to rekey such SA. PR: 200282, 200283 MFC r283102: Change SA's state before sending SADB_EXPIRE message. This state will be reported to keying daemon. Changes: _U stable/10/ stable/10/sys/netipsec/key.c