Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Rewrite ¶
Rewrite turns the packet in buf into the one to send: the TTL goes down by one with the checksum adjusted to match, and the Ethernet header is replaced by the adjacency's. The packet's IPv4 header starts at l3, and buf is the whole frame, so there is room for the header to grow. It returns the length to send, which is the Ethernet header plus the IPv4 total length: what was padding on the way in is not forwarded, and what is too short on the way out is padded again.
Types ¶
type Adjacency ¶
Adjacency is what a route resolves to: the Ethernet header, with an optional 802.1Q tag, that goes on every packet sent through it. Adjacency 0 is reserved to mean no route.
func NewAdjacency ¶
NewAdjacency pre-forms the egress header: destination, source, an 802.1Q tag if vlan is not 0, and the IPv4 ethertype.
type ErrorCode ¶
type ErrorCode uint8
ErrorCode is why a packet was not forwarded.
type V4Fib ¶
type V4Fib struct {
// contains filtered or unexported fields
}
V4Fib is one IPv4 forwarding table.