mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-18 06:51:54 +00:00
BGP: explicitly sending route refresh from CLI
This commit is contained in:
parent
402a574050
commit
1d0e47e74b
@ -1297,6 +1297,10 @@ This argument can be omitted if there exists only a single instance.
|
|||||||
specified.
|
specified.
|
||||||
|
|
||||||
<!-- TODO: Move these protocol-specific remote control commands to the protocol sections -->
|
<!-- TODO: Move these protocol-specific remote control commands to the protocol sections -->
|
||||||
|
<tag><label id="cli-reload-bgp">reload bgp [in|out] [<m/name/]</tag>
|
||||||
|
Manually request (in) or send (out) route refresh (or both) on the
|
||||||
|
given BGP protocol(s).
|
||||||
|
|
||||||
<tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag>
|
<tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag>
|
||||||
Show detailed information about OSPF interfaces.
|
Show detailed information about OSPF interfaces.
|
||||||
|
|
||||||
|
@ -1599,44 +1599,32 @@ bgp_update_bfd(struct bgp_proto *p, const struct bfd_options *bfd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
void
|
||||||
bgp_reload_routes(struct channel *C, struct channel_import_request *cir)
|
bgp_reload_in(struct proto *P, uintptr_t _ UNUSED, int __ UNUSED)
|
||||||
{
|
{
|
||||||
struct bgp_proto *p = (void *) C->proto;
|
SKIP_BACK_DECLARE(struct bgp_proto, p, p, P);
|
||||||
struct bgp_channel *c = (void *) C;
|
|
||||||
|
|
||||||
/* For MPLS channel, reload all MPLS-aware channels */
|
if (P->proto_state == PS_UP)
|
||||||
if (C == p->p.mpls_channel)
|
|
||||||
{
|
{
|
||||||
|
struct bgp_channel *c;
|
||||||
BGP_WALK_CHANNELS(p, c)
|
BGP_WALK_CHANNELS(p, c)
|
||||||
if ((c->desc->mpls) && (p->route_refresh || c->cf->import_table))
|
if (&c->c != P->mpls_channel)
|
||||||
channel_request_reload(&c->c);
|
{
|
||||||
|
cli_msg(-15, "%s.%s: reloading", P->name, c->c.name);
|
||||||
/* Ignoring CIR, reloading always everything */
|
bgp_schedule_packet(p->conn, c, PKT_ROUTE_REFRESH);
|
||||||
cir->done(cir);
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/* Ignore non-BGP channels */
|
cli_msg(-8006, "%s: not reloading, not up", P->name);
|
||||||
if (C->class != &channel_bgp)
|
|
||||||
{
|
|
||||||
cir->done(cir);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cir->trie)
|
|
||||||
{
|
|
||||||
cir->done(cir);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* We do not need cir anymore and later we will not be able to detect when to free it. */
|
|
||||||
cir->done(cir);
|
|
||||||
|
|
||||||
ASSERT(p->conn && p->route_refresh);
|
|
||||||
bgp_schedule_packet(p->conn, c, PKT_ROUTE_REFRESH);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bgp_reload_out(struct proto *P, uintptr_t _ UNUSED, int __ UNUSED)
|
||||||
|
{
|
||||||
|
cli_msg(-8006, "%s: bgp reload out not implemented yet", P->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bgp_feed_begin(struct channel *C)
|
bgp_feed_begin(struct channel *C)
|
||||||
{
|
{
|
||||||
@ -1948,7 +1936,6 @@ bgp_init(struct proto_config *CF)
|
|||||||
P->rt_notify = bgp_rt_notify;
|
P->rt_notify = bgp_rt_notify;
|
||||||
P->preexport = bgp_preexport;
|
P->preexport = bgp_preexport;
|
||||||
P->iface_sub.neigh_notify = bgp_neigh_notify;
|
P->iface_sub.neigh_notify = bgp_neigh_notify;
|
||||||
P->reload_routes = bgp_reload_routes;
|
|
||||||
P->feed_begin = bgp_feed_begin;
|
P->feed_begin = bgp_feed_begin;
|
||||||
P->feed_end = bgp_feed_end;
|
P->feed_end = bgp_feed_end;
|
||||||
|
|
||||||
|
@ -589,6 +589,9 @@ void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code
|
|||||||
void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len);
|
void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len);
|
||||||
const char *bgp_format_role_name(u8 role);
|
const char *bgp_format_role_name(u8 role);
|
||||||
|
|
||||||
|
void bgp_reload_in(struct proto *P, uintptr_t, int);
|
||||||
|
void bgp_reload_out(struct proto *P, uintptr_t, int);
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
rte_resolvable(const rte *rt)
|
rte_resolvable(const rte *rt)
|
||||||
{
|
{
|
||||||
|
@ -365,6 +365,22 @@ custom_attr: ATTRIBUTE BGP NUM type symbol ';' {
|
|||||||
|
|
||||||
CF_ENUM(T_ENUM_BGP_ORIGIN, ORIGIN_, IGP, EGP, INCOMPLETE)
|
CF_ENUM(T_ENUM_BGP_ORIGIN, ORIGIN_, IGP, EGP, INCOMPLETE)
|
||||||
|
|
||||||
|
CF_CLI(RELOAD BGP, proto_patt, [<name>], [[Send and request route refresh to/from neighbor]])
|
||||||
|
{
|
||||||
|
proto_apply_cmd($3, bgp_reload_in, 1, 0);
|
||||||
|
proto_apply_cmd($3, bgp_reload_out, 1, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
CF_CLI(RELOAD BGP IN, proto_patt, [<name>], [[Request route refresh from neighbor]])
|
||||||
|
{
|
||||||
|
proto_apply_cmd($4, bgp_reload_in, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CF_CLI(RELOAD BGP OUT, proto_patt, [<name>], [[Refresh routes to neighbor]])
|
||||||
|
{
|
||||||
|
proto_apply_cmd($4, bgp_reload_out, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
CF_CODE
|
CF_CODE
|
||||||
|
|
||||||
CF_END
|
CF_END
|
||||||
|
Loading…
Reference in New Issue
Block a user