mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Nest: VRF of protocol can be explicitly specified as 'default'
Protocol can have specified VRF, in such case it is restricted to a set of ifaces associated with the VRF, otherwise it can use all interfaces. The patch allows to specify VRF as 'default', in which case it is restricted to a set of iface not associated with any VRF.
This commit is contained in:
parent
d72d3891bf
commit
da8644d7d9
@ -55,7 +55,7 @@ get_passwords(void)
|
||||
CF_DECLS
|
||||
|
||||
CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
|
||||
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, TABLE, STATES, ROUTES, FILTERS)
|
||||
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, STATES, ROUTES, FILTERS)
|
||||
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
|
||||
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
|
||||
CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512)
|
||||
@ -227,7 +227,8 @@ proto_item:
|
||||
| IMPORT LIMIT limit_spec { this_proto->in_limit = $3; }
|
||||
| EXPORT LIMIT limit_spec { this_proto->out_limit = $3; }
|
||||
| IMPORT KEEP FILTERED bool { this_proto->in_keep_filtered = $4; }
|
||||
| VRF text { this_proto->vrf = if_get_by_name($2); }
|
||||
| VRF text { this_proto->vrf = if_get_by_name($2); this_proto->vrf_set = 1; }
|
||||
| VRF DEFAULT { this_proto->vrf = NULL; this_proto->vrf_set = 1; }
|
||||
| TABLE rtable { this_proto->table = $2; }
|
||||
| ROUTER ID idval { this_proto->router_id = $3; }
|
||||
| DESCRIPTION text { this_proto->dsc = $2; }
|
||||
|
@ -140,7 +140,7 @@ if_copy(struct iface *to, struct iface *from)
|
||||
static inline void
|
||||
ifa_send_notify(struct proto *p, unsigned c, struct ifa *a)
|
||||
{
|
||||
if (p->ifa_notify && (!p->vrf || p->vrf == a->iface->master))
|
||||
if (p->ifa_notify && (!p->vrf_set || p->vrf == a->iface->master))
|
||||
{
|
||||
if (p->debug & D_IFACES)
|
||||
log(L_TRACE "%s <%s address %I/%d on interface %s %s",
|
||||
@ -177,7 +177,7 @@ ifa_notify_change(unsigned c, struct ifa *a)
|
||||
static inline void
|
||||
if_send_notify(struct proto *p, unsigned c, struct iface *i)
|
||||
{
|
||||
if (p->if_notify && (!p->vrf || p->vrf == i->master))
|
||||
if (p->if_notify && (!p->vrf_set || p->vrf == i->master))
|
||||
{
|
||||
if (p->debug & D_IFACES)
|
||||
log(L_TRACE "%s < interface %s %s", p->name, i->name,
|
||||
|
@ -153,7 +153,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
|
||||
}
|
||||
else
|
||||
WALK_LIST(i, iface_list)
|
||||
if ((!p->vrf || p->vrf == i->master) &&
|
||||
if ((!p->vrf_set || p->vrf == i->master) &&
|
||||
((scope = if_connected(a, i, &addr)) >= 0))
|
||||
{
|
||||
ifa = i;
|
||||
|
@ -387,6 +387,7 @@ proto_init(struct proto_config *c)
|
||||
q->export_state = ES_DOWN;
|
||||
q->last_state_change = now;
|
||||
q->vrf = c->vrf;
|
||||
q->vrf_set = c->vrf_set;
|
||||
|
||||
add_tail(&initial_proto_list, &q->n);
|
||||
|
||||
@ -411,6 +412,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
|
||||
if ((nc->protocol != oc->protocol) ||
|
||||
(nc->disabled != p->disabled) ||
|
||||
(nc->vrf != oc->vrf) ||
|
||||
(nc->vrf_set != oc->vrf_set) ||
|
||||
(nc->table->table != oc->table->table))
|
||||
return 0;
|
||||
|
||||
@ -1567,6 +1569,9 @@ proto_cmd_show(struct proto *p, uintptr_t verbose, int cnt)
|
||||
if (p->cf->router_id)
|
||||
cli_msg(-1006, " Router ID: %R", p->cf->router_id);
|
||||
|
||||
if (p->vrf_set)
|
||||
cli_msg(-1006, " VRF: %s", p->vrf ? p->vrf->name : "default");
|
||||
|
||||
if (p->proto->show_proto_info)
|
||||
p->proto->show_proto_info(p);
|
||||
else
|
||||
|
@ -93,6 +93,7 @@ struct proto_config {
|
||||
int class; /* SYM_PROTO or SYM_TEMPLATE */
|
||||
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */
|
||||
unsigned preference, disabled; /* Generic parameters */
|
||||
int vrf_set; /* Related VRF instance (below) is defined */
|
||||
int in_keep_filtered; /* Routes rejected in import filter are kept */
|
||||
u32 router_id; /* Protocol specific router ID */
|
||||
struct iface *vrf; /* Related VRF instance, NULL if global */
|
||||
@ -149,6 +150,7 @@ struct proto {
|
||||
unsigned preference; /* Default route preference */
|
||||
byte accept_ra_types; /* Which types of route announcements are accepted (RA_OPTIMAL or RA_ANY) */
|
||||
byte disabled; /* Manually disabled */
|
||||
byte vrf_set; /* Related VRF instance (above) is defined */
|
||||
byte proto_state; /* Protocol state machine (PS_*, see below) */
|
||||
byte core_state; /* Core state machine (FS_*, see below) */
|
||||
byte export_state; /* Route export state (ES_*, see below) */
|
||||
|
@ -624,7 +624,7 @@ bfd_request_notify(struct bfd_request *req, u8 state, u8 diag)
|
||||
static int
|
||||
bfd_add_request(struct bfd_proto *p, struct bfd_request *req)
|
||||
{
|
||||
if (p->p.vrf && (p->p.vrf != req->vrf))
|
||||
if (p->p.vrf_set && (p->p.vrf != req->vrf))
|
||||
return 0;
|
||||
|
||||
struct bfd_session *s = bfd_find_session_by_addr(p, req->addr);
|
||||
|
Loading…
Reference in New Issue
Block a user