|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Layer 3 (Network) - the interface forwarding plane (PROTOCORE_ENABLE_FORWARD). More...
Go to the source code of this file.
Layer 3 (Network) - the interface forwarding plane (PROTOCORE_ENABLE_FORWARD).
RFC 1812 sec 5 "INTERNET LAYER - FORWARDING". A frame that arrives on one interface runs the forwarding walk-through (sec 5.2) and leaves on every interface it is permitted to leave on. The steps this plane runs over opaque bytes are the access list (sec 5.3.9 "Packet Filtering and Access Lists"), the next hop (sec 5.2.4.3 "Next Hop Address"), the controls on forwarding (sec 5.3.11 "Controls on Forwarding"), and the drop under load (sec 5.3.6 "Congestion Control").
The interfaces are layer 1's, over PROTOCORE_PHY_MAX_IFACES rows; this plane reads that registry and calls its send. A (src, dst) pair forwards when an ALLOW control matches and no DENY does; a frame never leaves on the interface it arrived on. An exceeded rate cap, or an interface that refuses the bytes, drops the frame for that next hop and counts it. Storage is static: PROTOCORE_FWD_MAX_RULES controls, PROTOCORE_FWD_MAX_ACL access-list entries, PROTOCORE_FWD_MAX_ROUTES policy routes.
A policy route matches a frame by the same byte pattern the access list uses - any field at a known offset, an EtherType, an IP protocol, a port, an address prefix - and binds it to one egress interface ahead of the (src, dst) fan-out; the first matching route wins. The access list runs first, and the rate cap, the never-reflect step and the counted drop apply to the chosen next hop.
The inspection hook (PROTOCORE_FWD_INSPECT) runs an application callback on every frame after the access list and before the route lookup; the callback returns a verdict that passes or drops it.
The rate cap reads Clock.millis (server/clock/clock.h), the library's one time source; Clock.set_ms moves the window for every module at once.
Definition in file forward.h.