AF_DIVERT family restored & compiling: full socket family (PF_DIVERT=32, sock_register), blocking recv/poll, divert_output-compatible sendmsg reinject, mtag type passthrough; pfk_api decls

This commit is contained in:
lgcosta committed 2026-11-11 18:47:04 -03:00
1 parent fe6f767561
commit ac56534c3b
30 files changed
+2273 -62

No files matched your search

+6 -2
View File
@@ -23,10 +23,14 @@ static inline bool refcnt_take_not0(struct refcnt *r)
{
return refcount_inc_not_zero(&r->rc);
}
/*
* OpenBSD semantics (sys/kern/kern_synch.c): refcnt_rele() returns 1 when
* the last reference is dropped and 0 otherwise. PF_REF_RELE() and the
* pf_ruleset anchor release rely on that polarity.
*/
static inline unsigned int refcnt_rele(struct refcnt *r)
{
return (unsigned int)refcount_dec_and_test(&r->rc) ?
refcnt_value(r) : refcnt_value(r) + 1;
return (unsigned int)refcount_dec_and_test(&r->rc) ? 1 : 0;
}
static inline unsigned int refcnt_rele_wake(struct refcnt *r)
{
+6
View File
@@ -9,5 +9,11 @@ int pfk_enable(int on);
void pfk_status(struct pf_status *s);
int pfk_hooks_register(void);
void pfk_hooks_unregister(void);
/* AF_DIVERT family (module-internal socket protocol, PF_DIVERT=32) */
int pfk_divert_sock_register(void);
void pfk_divert_sock_unregister(void);
void divert_packet(struct mbuf *, int, u_int16_t);
void divert6_packet(struct mbuf *, int, u_int16_t);
void pfk_hooks_unregister(void);
#endif