are merged to one ECMP route during export to the Kernel protocol
(with active <ref id="krt-merge-paths" name="marge paths"> option).
+ <tag><label id="rta-gw-mpls"><m/int/ gw_mpls</tag>
+ Outgoing MPLS label attached to route (i.e., incoming MPLS label on the
+ next hop router for this label-switched path). Reading returns the label
+ value and setting it sets it to the start of the label stack. Setting
+ implicit-NULL label (3) disables the MPLS label stack. Only the first
+ next hop and only one label in the label stack supported right now. This
+ is experimental option, will be likely changed in the future to handle
+ full MPLS label stack.
+
<tag><label id="rta-igp-metric"><m/int/ igp_metric</tag>
The optional attribute that can be used to specify a distance to the
network for routes that do not have a native protocol metric attribute
SET, STRING, BGPMASK, BGPPATH, CLIST, ECLIST, LCLIST,
IF, THEN, ELSE, CASE,
TRUE, FALSE, RT, RO, UNKNOWN, GENERIC,
- FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX, WEIGHT,
+ FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX, WEIGHT, GW_MPLS,
PREFERENCE,
ROA_CHECK, ASN, SRC, DST,
IS_V4, IS_V6,
| IFNAME { $$ = f_new_static_attr(T_STRING, SA_IFNAME, 0); }
| IFINDEX { $$ = f_new_static_attr(T_INT, SA_IFINDEX, 1); }
| WEIGHT { $$ = f_new_static_attr(T_INT, SA_WEIGHT, 0); }
+ | GW_MPLS { $$ = f_new_static_attr(T_INT, SA_GW_MPLS, 0); }
;
term:
SA_IFNAME,
SA_IFINDEX,
SA_WEIGHT,
+ SA_GW_MPLS,
} PACKED;
/* Static attribute definition (members of struct rta) */
case SA_IFNAME: RESULT(sa.f_type, s, rta->nh.iface ? rta->nh.iface->name : ""); break;
case SA_IFINDEX: RESULT(sa.f_type, i, rta->nh.iface ? rta->nh.iface->index : 0); break;
case SA_WEIGHT: RESULT(sa.f_type, i, rta->nh.weight + 1); break;
+ case SA_GW_MPLS: RESULT(sa.f_type, i, rta->nh.labels ? rta->nh.label[0] : MPLS_NULL); break;
default:
bug("Invalid static attribute access (%u/%u)", sa.f_type, sa.sa_code);
rta->nh.iface = n->iface;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
}
break;
rta->nh.iface = NULL;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
}
break;
rta->nh.iface = ifa;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
+ }
+ break;
+
+ case SA_GW_MPLS:
+ {
+ if (v1.val.i >= 0x100000)
+ runtime( "Invalid MPLS label" );
+
+ if (v1.val.i != MPLS_NULL)
+ {
+ rta->nh.label[0] = v1.val.i;
+ rta->nh.labels = 1;
+ }
+ else
+ rta->nh.labels = 0;
}
break;
#define IP6_HEADER_LENGTH 40
#define UDP_HEADER_LENGTH 8
+#define MPLS_NULL 3
+
/* IANA Address Family Numbers */
/* https://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml */