M1 progress: engine port compiles except pf.c; AF_DIVERT socket family; ifq framework

- compat layer extended through the full BSD API surface pf_ioctl/pf_lb/
  pf_if/pf_norm/pf_table/pf_ruleset/radix/md5/sha2 need (all compile):
  cpumem/counters model, ifaddr/ifg groups, cred view, endian+in6 names,
  NAT46/64, SipHash24, mbuf_list, frag6 helpers, ip6 forward/checksum,
  tcp options/FSM names, taskqueue & sysctl shims (documented in
  docs/porting-notes.md)
- pfsrc/divert_sock.c: real BSD divert(4) as runtime-registered PF_DIVERT=32
  socket family inside the module (sock_register; NPROTO=AF_MAX=45 -> zero
  core patches); divert_packet/divert6_packet wired for pf.c
- compat/pfk_ifq.c: OpenBSD 8.0 ifq framework with priq back end; hfsc and
  fq_codel aliases pending M5 (recorded in feature matrix as pending)
- design + plan updated for the divert decision (user-requested)
- stage-port.sh: single deterministic rename program for headers and .c
This commit is contained in:
lgcosta committed 2026-11-11 13:35:53 -03:00
1 parent a84b2c91f3
commit 1fcd7b3046
77 files changed
+28002 -1114

No files matched your search

+16 -2
View File
@@ -92,8 +92,10 @@ SipHash24_Update(SIPHASH_CTX *ctx, const void *in, __u64 inlen)
}
void
SipHash24_Final(SIPHASH_CTX *ctx, unsigned char *out)
SipHash24_Final(void *out, SIPHASH_CTX *ctx)
{
unsigned char *o = out;
u64 b = ((u64)ctx->total_len) << 56;
u64 v0 = ctx->v[0], v1 = ctx->v[1], v2 = ctx->v[2], v3 = ctx->v[3];
unsigned char t[8];
@@ -108,7 +110,7 @@ SipHash24_Final(SIPHASH_CTX *ctx, unsigned char *out)
v0 ^= b;
v2 ^= 0xff;
SIPROUND; SIPROUND; SIPROUND; SIPROUND;
U64TO8_LE(out, v0 ^ v1 ^ v2 ^ v3);
U64TO8_LE(o, v0 ^ v1 ^ v2 ^ v3);
/* wipe */
ctx->v[0] = ctx->v[1] = ctx->v[2] = ctx->v[3] = 0;
}
@@ -155,3 +157,15 @@ SipHash24_Generate(const SIPHASH_KEY *key, const void *in, __u64 inlen,
U64TO8_LE(out, v0 ^ v1 ^ v2 ^ v3);
}
}
/* OpenBSD: SipHash24() returns the hash value directly. */
__u64
SipHash24(const SIPHASH_KEY *key, const void *in, __u64 inlen)
{
unsigned char out[8];
__u64 v;
SipHash24_Generate(key, in, inlen, out);
memcpy(&v, out, sizeof(v));
return v;
}