Network Rule Authoring

Rule paths live beneath Machine\System\Network\Rules. Interface belongs to netd; RawPacket, Packet, and Flow belong to NTFE. Each executor can accept or refuse its own generation independently. A successful registry write is not an acknowledgment from either executor.

A rule's name identifies it in diagnostics and cannot contain path separators. Its conditions are ANDed. A matching child specializes its parent's matched region. Priority inherits from the parent, or defaults to zero at a root. An empty action list abstains; Enabled = 0 disables the subtree.

Conditions #

Condition names have the form <Fact>.<Operator>. Missing facts do not match, except through an explicit presence test. Integer operands accept documented numeric types or decimal text; integer lists accept ranges. Unsupported operator/type combinations reject the generation.

OperatorFamiliesValue
EqualallMembership: a scalar, or a list (REG_MULTI_SZ) meaning any of. Integers accept a-b ranges; addresses accept CIDR prefixes and (IPv4) a-b ranges.
GreaterThanintegerA single integer; strictly greater.
LessThanintegerA single integer; strictly less.
HasflagsA flag name or list; all listed bits set.
HasntflagsA flag name or list; all listed bits clear.
Presentall, and Tag.<name> / Counter.<name>1: the fact exists for this packet or flow; 0: it does not. The one operator that looks through the absent-fact law. On a fact its layer never has, it refuses the generation rather than becoming an always-true condition.

Fact vocabulary #

Availability depends on the layer and the actual subject. A condition using an unavailable fact cannot make a connection pass. A Present test for a fact that the layer never supplies is rejected. Native endpoint identity comes from the socket's effective-identity stamp, not a name supplied by the application.

FactFamilyValuesPresent when
Directionstringin, outalways. Flow: the originator's side, for the flow's whole life
Interfacestringinterface name, for example, eth0always. Flow, outbound: the route's device
EtherTypeintegernumber, or ipv4, ipv6, arpalways. Not a Flow fact (a flow's family is its addresses')
SrcMacMACaa:bb:cc:dd:ee:ffframe has an Ethernet header; at the IP seats outbound, the machine's own device address
DstMacMACaa:bb:cc:dd:ee:ffframe has an Ethernet header. Not a Flow fact
VlanintegerVLAN idthe frame is VLAN-tagged (device seats) or the interface is a VLAN device (IP seats)
SrcAddr, DstAddraddressexact (10.0.0.5, fd00::1), CIDR (10.0.0.0/8, fd00::/64), IPv4 range (10.0.0.1-10.0.0.99)IP packet
Protocolintegernumber, or tcp, udp, icmp, icmpv6, sctpIP packet
TtlintegerTTL / hop limitIP packet. Not a Flow fact
Dscpinteger0..63IP packet. Not a Flow fact
Fragmentinteger0 or 1IP packet (only ever 1 before defragmentation, that is, at the RawPacket seat). Not a Flow fact
SrcPort, DstPortinteger0..65535TCP, UDP, or SCTP
TcpFlagsflagsFIN, SYN, RST, PSH, ACK, URG, ECE, CWRTCP. Not a Flow fact
IcmpType, IcmpCodeintegerICMP / ICMPv6 type and codeICMP or ICMPv6
Lengthintegerpacket length in bytes at the seat (stack view)always. Not a Flow fact
FlowStatestringnew, established, related, invalid, untrackedPacket layer at its proper seat; never at the RawPacket or Flow layers
Relatedinteger0 or 1: the flow was expected by another (an ICMP error for a live flow, FTP data)Flow layer only
Time.Year, Time.Month, Time.DayOfMonth, Time.DayOfWeek, Time.Hour, Time.Minute, Time.Secondintegerwall clock, UTC; DayOfWeek is ISO (1 = Monday .. 7 = Sunday)always. In Flow, a consulted condition expires the sentence at its next flip
Start.Year, Start.Month, Start.DayOfMonth, Start.DayOfWeek, Start.Hour, Start.Minute, Start.Secondintegerthe wall clock when the flow began, UTCFlow layer only; fixed for the flow's life, never expires a sentence
Localstringprogram, kernel, shared, none: what stands at this machine's end of the flowFlow layer only; always present there
Local.UserSIDS-1-5-19, or a well-known name (SYSTEM, LocalService, NetworkService, Everyone, Administrators, Users, …)Flow, Local is program
Local.GroupSID setSIDs or well-known names; any of the token's enabled groups (deny-only groups are invisible; the logon SID is among them)Flow, Local is program
Local.Integrityintegera level, or untrusted, low, medium, high, systemFlow, Local is program
Local.ConfinementSIDthe confinement SIDFlow, the program is confined
Local.CapabilitySID setany of the confinement's capability SIDsFlow, the program is confined
Local.ServiceSIDa service name (resolvd), or its S-1-5-80-… SIDFlow, the program is a service
Local.Processstringthe process GUID, 8-4-4-4-12 hex (case-insensitive)Flow, Local is program
Remote, Remote.*as Localthe other end of the flow, when it is on this machine tooFlow, loopback flows only
Interface.Kindstringwired, wireless, loopback, tunnel, bridge, otherInterface layer only; always
Interface.Idstringthe stable interface id (the inventory key name)Interface layer only; always
Interface.MacMACaa:bb:cc:dd:ee:ffInterface layer only; the interface has a hardware address
Interface.Pathstringbus position, for example, pci-0000:00:03.0Interface layer only; it is hardware
Interface.Driverstringkernel driverInterface layer only; it is hardware
Network.Idstringthe network record's key name under Networks\every layer: a network has been identified on the interface the packet crossed (see the network context)
Network.Namestringthe operator's Name on the recordevery layer; the record has one
Network.Truststringthe operator's Trust on the recordevery layer; the record has one
Network.Kindstringthe Interface.Kind the network was seen onInterface layer; a network has been identified
Tag.<name>integerthe flow tag's valuethe flow carries the tag (Packet and Flow layers; never RawPacket)
Counter.<name>[(...)]integera counter view, see belowthe packet has the view's key facts and a cell exists

Actions #

Names are case-insensitive. An action list can combine effects and a verdict; effects do not themselves authorize traffic. Unknown expressions or invalid operands reject the generation. PROMPT has no handler transport in the implemented engine and applies its fallback immediately.

ExpressionSpeciesMeaning
NULLabstentionNothing. A rule whose actions yield no verdict abstains.
PASSverdictThis layer approves.
DROPverdictRefuse silently.
REJECT / REJECT(Refused)verdictRefuse; look like nothing is listening — TCP RST, else ICMP port-unreachable.
REJECT(Prohibited)verdictRefuse; say policy did it — ICMP admin-prohibited for every protocol.
PROMPT(Handler[, Fallback])deferralAsk a userspace handler; on no answer apply Fallback (an action expression, nesting up to 4 deep). No handler transport exists in this release: the fallback applies immediately and the prompt is recorded.
TAG(Name, Set[, n])effectSet flow tag Name to n (default 1).
TAG(Name, Add[, n])effectAdd n (default 1) to the tag; an absent tag counts as 0 first.
TAG(Name, Clear)effectRemove the tag; it reads as absent afterward.
COUNT(Name[, n])effectEmit n (default 1) into stream Name.
COUNT(Name, Length)effectEmit the packet's byte length — the bandwidth primitive.
REPORT(level)effectEmit an ntfe.verdict.reported audit event, level 1..5, if the level clears CurrentReportingLevel. One report per rule per evaluation, at the highest level listed.
JOIN(profile)verdict, Interface layerBring the interface up and stand in the named profile: a path under Profiles\, using either path separator.
IGNOREverdict, Interface layerNever touch the interface; something else owns it.
DOWNverdict, Interface layerKeep the interface administratively down.

Interface actions are limited to its verdicts, NULL, and REPORT. JOIN requires an existing profile; a disabled profile causes abstention. Conflicting equal-priority profile choices have special startup/reload handling in netd's judgment reference.

Counter and tag references #

Counter.<name>(window, key) reads a stream written by COUNT. A window is seconds, minutes, hours, or days, at most one day; omission selects a cumulative total. A key selects SrcAddr, DstAddr, Interface, or a +-joined combination; omission selects a global cell. For example, Counter.dns(10s, SrcAddr) reads a per-source ten-second view.

A view requires some rule to write its stream. Sliding windows use eight buckets and can be stale by an eighth of a window. Matching reads the state before the current evaluation's effects, so a count does not affect its own threshold check. Missing cells and tags remain absent, rather than reading as zero in every condition.

Tag dependencies can only flow upward through RawPacket, Packet, and Flow; downward dependencies reject the generation. Tags survive policy generation changes. The kernel's store reference owns capacity, lifetime, and refusal accounting.

Executor references #

QuestionOwning reference
Profile values, inheritance, and accepted offersConfiguring Profiles and netd's registry manual
Interface fact and action rulesInterface judgment
Packet seat order and available factsSeats and dispatch and snapshot
Validation, rule limits, and reporting levelPolicy ingestion
Priority, abstention, and effectsEvaluation
Cached verdicts, time changes, and refusalsFlow layer
Native endpoint identityIdentity facts

Image seeds add ordinary, deletable rules; this reference does not promise which services an image exposes. DHCP and router discovery need policy too. Inspect installed rules and their accepted generation before changing them. For worked packet-policy patterns, see Authoring Packet Rules.

Edit this page