diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2022-09-15 02:30:15 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-10-04 13:01:21 +0200 |
commit | 9d456d5366593c7b0ebfde003be0517adb554541 (patch) | |
tree | 7141ebfa5c6091dae6cc8aebfaa51fe0f7c8febc /proto/bgp/attrs.c | |
parent | 15c86ed061d3dbc7e4ef863e396cda5ec3ed0d4c (diff) |
BGP: Add MPLS support
When MPLS is active, received routes on MPLS-aware SAFIs (ipvX-mpls,
vpnX-mpls) are automatically labeled according to active label policy and
corresponding MPLS routes are automatically generated. Also routes sent
on MPLS-aware SAFIs announce local labels when it should be done.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r-- | proto/bgp/attrs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index de45cae0..9387ddba 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -17,6 +17,7 @@ #include "nest/protocol.h" #include "nest/route.h" #include "nest/attrs.h" +#include "nest/mpls.h" #include "conf/conf.h" #include "lib/resource.h" #include "lib/string.h" @@ -1501,6 +1502,13 @@ bgp_finish_attrs(struct bgp_parse_state *s, rta *a) p->cf->local_role == BGP_ROLE_RS_CLIENT)) bgp_set_attr_u32(&a->eattrs, s->pool, BA_ONLY_TO_CUSTOMER, 0, p->cf->remote_as); } + + /* Apply MPLS policy for labeled SAFIs */ + if (s->mpls && s->proto->p.mpls_channel) + { + struct mpls_channel *mc = (void *) s->proto->p.mpls_channel; + ea_set_attr_u32(&a->eattrs, s->pool, EA_MPLS_POLICY, 0, EAF_TYPE_INT, mc->label_policy); + } } |