For TCP, check_uidgid() finds a socket only for packets of a
connection. It looks up incoming packets without INPLOOKUP_WILDCARD,
so a listening socket is never found, and the SYN-ACK leaves the
syncache before the connection has a socket. The three packets of
the handshake of an incoming connection therefore never match uid,
gid, jail or lookup uid/jail, and "deny tcp from any to me uid N in"
does not stop clients from connecting to that user's server.
This has been so since ipfw2 (9758b77ff1a). PR 63961 ran into it in
2004 with a "setup uid" rule and was closed after the fix for "not
uid" only. Document it under uid and point to it from gid and jail.
PR: 63961
MFC after: 2 weeks
Assisted-by: Claude Opus 5.5