sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-10-13 03:26:36 +00:00
parent e5a8beb33e
commit 2ec21d9c19
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
205 changed files with 4715 additions and 23023 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pflog.c,v 1.97 2021/01/20 23:25:19 bluhm Exp $ */
/* $OpenBSD: if_pflog.c,v 1.98 2023/10/12 19:15:21 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@ -204,7 +204,9 @@ pflog_packet(struct pf_pdesc *pd, u_int8_t reason, struct pf_rule *rm,
bzero(&hdr, sizeof(hdr));
hdr.length = PFLOG_REAL_HDRLEN;
hdr.action = rm->action;
/* Default rule does not pass packets dropped for other reasons. */
hdr.action = (rm->nr == (u_int32_t)-1 && reason != PFRES_MATCH) ?
PF_DROP : rm->action;
hdr.reason = reason;
memcpy(hdr.ifname, pd->kif->pfik_name, sizeof(hdr.ifname));

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfkeyv2.c,v 1.258 2023/09/29 18:40:08 tobhe Exp $ */
/* $OpenBSD: pfkeyv2.c,v 1.259 2023/10/11 22:13:16 tobhe Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@ -1391,6 +1391,9 @@ pfkeyv2_dosend(struct socket *so, void *message, int len)
/* Delete old version of the SA, insert new one */
tdb_delete(sa2);
tdb_addtimeouts(newsa);
puttdb(newsa);
} else {
/*
@ -1423,6 +1426,8 @@ pfkeyv2_dosend(struct socket *so, void *message, int len)
#endif
import_iface(sa2, headers[SADB_X_EXT_IFACE]);
tdb_addtimeouts(sa2);
if (headers[SADB_EXT_ADDRESS_SRC] ||
headers[SADB_EXT_ADDRESS_PROXY]) {
mtx_enter(&tdb_sadb_mtx);
@ -1565,6 +1570,8 @@ pfkeyv2_dosend(struct socket *so, void *message, int len)
goto ret;
}
tdb_addtimeouts(newsa);
/* Add TDB in table */
puttdb(newsa);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfkeyv2_convert.c,v 1.81 2023/09/16 09:33:27 mpi Exp $ */
/* $OpenBSD: pfkeyv2_convert.c,v 1.82 2023/10/11 22:13:16 tobhe Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@ -302,9 +302,6 @@ import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
if ((tdb->tdb_exp_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_TIMER;
if (timeout_add_sec(&tdb->tdb_timer_tmo,
tdb->tdb_exp_timeout))
tdb_ref(tdb);
} else
tdb->tdb_flags &= ~TDBF_TIMER;
@ -331,9 +328,6 @@ import_lifetime(struct tdb *tdb, struct sadb_lifetime *sadb_lifetime, int type)
if ((tdb->tdb_soft_timeout =
sadb_lifetime->sadb_lifetime_addtime) != 0) {
tdb->tdb_flags |= TDBF_SOFT_TIMER;
if (timeout_add_sec(&tdb->tdb_stimer_tmo,
tdb->tdb_soft_timeout))
tdb_ref(tdb);
} else
tdb->tdb_flags &= ~TDBF_SOFT_TIMER;