diff options
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r-- | proto/bgp/bgp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index f668b371..4651b76a 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -522,6 +522,8 @@ bgp_spawn(struct bgp_proto *pp, ip_addr remote_ip) void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len) { + proto_shutdown_mpls_map(&p->p, 1); + proto_notify_state(&p->p, PS_STOP); bgp_graceful_close_conn(&p->outgoing_conn, subcode, data, len); bgp_graceful_close_conn(&p->incoming_conn, subcode, data, len); @@ -1573,6 +1575,8 @@ bgp_start(struct proto *P) p->remote_id = 0; p->link_addr = IPA_NONE; + proto_setup_mpls_map(P, RTS_BGP, 1); + /* Lock all channels when in GR recovery mode */ if (p->p.gr_recovery && p->cf->gr_mode) { @@ -1729,11 +1733,14 @@ bgp_init(struct proto_config *CF) if (cf->c.parent) cf->remote_ip = IPA_NONE; - /* Add all channels */ + /* Add all BGP channels */ struct bgp_channel_config *cc; BGP_CF_WALK_CHANNELS(cf, cc) proto_add_channel(P, &cc->c); + /* Add MPLS channel */ + proto_configure_channel(P, &P->mpls_channel, proto_cf_mpls_channel(CF)); + return P; } @@ -2153,16 +2160,23 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF) WALK_LIST(C, p->p.channels) C->stale = 1; + /* Reconfigure BGP channels */ BGP_CF_WALK_CHANNELS(new, cc) { C = (struct channel *) bgp_find_channel(p, cc->afi); same = proto_configure_channel(P, &C, &cc->c) && same; } + /* Reconfigure MPLS channel */ + same = proto_configure_channel(P, &P->mpls_channel, proto_cf_mpls_channel(CF)) && same; + WALK_LIST_DELSAFE(C, C2, p->p.channels) if (C->stale) same = proto_configure_channel(P, &C, NULL) && same; + if (same) + proto_setup_mpls_map(P, RTS_BGP, 1); + if (same && (p->start_state > BSS_PREPARE)) bgp_update_bfd(p, new->bfd); @@ -2653,7 +2667,7 @@ struct protocol proto_bgp = { .template = "bgp%d", .class = PROTOCOL_BGP, .preference = DEF_PREF_BGP, - .channel_mask = NB_IP | NB_VPN | NB_FLOW, + .channel_mask = NB_IP | NB_VPN | NB_FLOW | NB_MPLS, .proto_size = sizeof(struct bgp_proto), .config_size = sizeof(struct bgp_config), .postconfig = bgp_postconfig, |