The MPLS behavior is controlled by the
net.mpls sysctl(8) tree:
net.mpls.accept
If zero, MPLS frames are dropped on sight on ingress interfaces.
net.mpls.forwarding
If zero, MPLS frames are not forwarded to next-hop.
net.mpls.ttl
The default ttl for self generated MPLS frames.
net.mpls.inet_mapttl
If set, TTL field from IP header will be mapped into the MPLS shim on encapsulation, and the TTL field from MPLS shim will be copied into IP header on decapsulation.
net.mpls.inet6_mapttl
The IPv6 version of the above.
net.mpls.inet_map_prec
If set, precedence field from IP header will be mapped into MPLS shim EXP bits on encapsulation, and the MPLS EXP field will be copied into IP Precedence field on decapsulation.
net.mpls.inet6_map_prec
The IPv6 version of the above.
net.mpls.icmp_respond
Returns ICMP TTL exceeded in transit when an MPLS frame is dropped because of TTL = 0 on egress interface.
In order to encapsulate and decapsulate to and from MPLS, an mpls pseudo-interface must be created and packets that should be encapsulated must be routed to that interface.
“Pure” MPLS routes can be created using
AF_MPLS sa_family sockaddrs for destination and tag fields. Other protocols can be encapsulated using routes pointing to mpls pseudo-interfaces, and
AF_MPLS sockaddrs for tags. Decapsulation can be made using values of reserved labels set in the tag field (see below). For more information about doing this using userland utilities see the
EXAMPLES section of this manual page.
The
netstat(1) and
route(8) utilities should be used to manage routes from userland.
ldpd(8) should be used in order to automatically import, manage and distribute labels among LSRs in the same MPLS domain.
RESERVED LABELS
MPLS labels 0 through 15 are reserved. Out of those, only four are currently defined:
0
IPv4 Explicit NULL label. This label value is only legal at the bottom of the label stack. It indicates that the label stack must be popped, and the forwarding of the packet must then be based on the IPv4 header.
1
Router Alert Label. Currently not implemented in NetBSD.
2
IPv6 Explicit NULL label. It indicates that the label stack must be popped, and the forwarding of the packet must then be based on the IPv6 header.
3
Implicit NULL label. This is a label that an LSR may assign and distribute, but which never actually appears in the encapsulation. When an LSR would otherwise replace the label at the top of the stack with a new label, but the new label is “Implicit NULL”, the LSR will pop the stack instead of doing the replacement.