diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bfd/bfd.c | 21 | ||||
-rw-r--r-- | proto/bfd/config.Y | 4 | ||||
-rw-r--r-- | proto/bfd/packets.c | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.c | 8 | ||||
-rw-r--r-- | proto/ospf/neighbor.c | 7 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 2 | ||||
-rw-r--r-- | proto/rip/rip.c | 3 | ||||
-rw-r--r-- | proto/rpki/rpki.c | 6 | ||||
-rw-r--r-- | proto/static/static.c | 3 |
9 files changed, 26 insertions, 30 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index fdcd7225..93073070 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -624,6 +624,9 @@ 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_set && (p->p.vrf != req->vrf)) + return 0; + struct bfd_session *s = bfd_find_session_by_addr(p, req->addr); u8 state, diag; @@ -685,7 +688,8 @@ bfd_drop_requests(struct bfd_proto *p) static struct resclass bfd_request_class; struct bfd_request * -bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, +bfd_request_session(pool *p, ip_addr addr, ip_addr local, + struct iface *iface, struct iface *vrf, void (*hook)(struct bfd_request *), void *data) { struct bfd_request *req = ralloc(p, &bfd_request_class); @@ -696,6 +700,7 @@ bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, req->addr = addr; req->local = local; req->iface = iface; + req->vrf = vrf; bfd_submit_request(req); @@ -754,7 +759,7 @@ bfd_neigh_notify(struct neighbor *nb) if ((nb->scope > 0) && !n->req) { ip_addr local = ipa_nonzero(n->local) ? n->local : nb->ifa->ip; - n->req = bfd_request_session(p->p.pool, n->addr, local, nb->iface, NULL, NULL); + n->req = bfd_request_session(p->p.pool, n->addr, local, nb->iface, p->p.vrf, NULL, NULL); } if ((nb->scope <= 0) && n->req) @@ -771,7 +776,7 @@ bfd_start_neighbor(struct bfd_proto *p, struct bfd_neighbor *n) if (n->multihop) { - n->req = bfd_request_session(p->p.pool, n->addr, n->local, NULL, NULL, NULL); + n->req = bfd_request_session(p->p.pool, n->addr, n->local, NULL, p->p.vrf, NULL, NULL); return; } @@ -1051,15 +1056,6 @@ bfd_reconfigure(struct proto *P, struct proto_config *c) return 1; } -/* Ensure one instance */ -struct bfd_config *bfd_cf; - -static void -bfd_preconfig(struct protocol *P UNUSED, struct config *c UNUSED) -{ - bfd_cf = NULL; -} - static void bfd_copy_config(struct proto_config *dest, struct proto_config *src UNUSED) { @@ -1123,6 +1119,5 @@ struct protocol proto_bfd = { .start = bfd_start, .shutdown = bfd_shutdown, .reconfigure = bfd_reconfigure, - .preconfig = bfd_preconfig, .copy_config = bfd_copy_config, }; diff --git a/proto/bfd/config.Y b/proto/bfd/config.Y index 41228e51..ed416f25 100644 --- a/proto/bfd/config.Y +++ b/proto/bfd/config.Y @@ -38,10 +38,6 @@ bfd_proto_start: proto_start BFD this_proto = proto_config_new(&proto_bfd, $1); init_list(&BFD_CFG->patt_list); init_list(&BFD_CFG->neigh_list); - - if (bfd_cf) - cf_error("Only one BFD instance allowed"); - bfd_cf = BFD_CFG; }; bfd_proto_item: diff --git a/proto/bfd/packets.c b/proto/bfd/packets.c index 6d5151ea..703c6e28 100644 --- a/proto/bfd/packets.c +++ b/proto/bfd/packets.c @@ -413,6 +413,7 @@ bfd_open_rx_sk(struct bfd_proto *p, int multihop, int af) sk->type = SK_UDP; sk->subtype = af; sk->sport = !multihop ? BFD_CONTROL_PORT : BFD_MULTI_CTL_PORT; + sk->vrf = p->p.vrf; sk->data = p; sk->rbsize = BFD_MAX_LEN; @@ -444,6 +445,7 @@ bfd_open_tx_sk(struct bfd_proto *p, ip_addr local, struct iface *ifa) sk->saddr = local; sk->dport = ifa ? BFD_CONTROL_PORT : BFD_MULTI_CTL_PORT; sk->iface = ifa; + sk->vrf = p->p.vrf; sk->data = p; sk->tbsize = BFD_MAX_LEN; diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index b68575a5..5a403b40 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -1371,7 +1371,7 @@ bgp_update_bfd(struct bgp_proto *p, int use_bfd) if (use_bfd && !p->bfd_req && !bgp_is_dynamic(p)) p->bfd_req = bfd_request_session(p->p.pool, p->remote_ip, p->local_ip, p->cf->multihop ? NULL : p->neigh->iface, - bgp_bfd_notify, p); + p->p.vrf, bgp_bfd_notify, p); if (!use_bfd && p->bfd_req) { @@ -2011,12 +2011,10 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF) ((byte *) new) + sizeof(struct proto_config), // password item is last and must be checked separately OFFSETOF(struct bgp_config, password) - sizeof(struct proto_config)) - && ((!old->password && !new->password) - || (old->password && new->password && !strcmp(old->password, new->password))) + && !bstrcmp(old->password, new->password) && ((!old->remote_range && !new->remote_range) || (old->remote_range && new->remote_range && net_equal(old->remote_range, new->remote_range))) - && ((!old->dynamic_name && !new->dynamic_name) - || (old->dynamic_name && new->dynamic_name && !strcmp(old->dynamic_name, new->dynamic_name))) + && !bstrcmp(old->dynamic_name, new->dynamic_name) && (old->dynamic_name_digits == new->dynamic_name_digits); /* FIXME: Move channel reconfiguration to generic protocol code ? */ diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index 50ef6a49..30e80640 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -771,8 +771,11 @@ ospf_neigh_bfd_hook(struct bfd_request *req) void ospf_neigh_update_bfd(struct ospf_neighbor *n, int use_bfd) { + struct ospf_proto *p = n->ifa->oa->po; + if (use_bfd && !n->bfd_req) - n->bfd_req = bfd_request_session(n->pool, n->ip, n->ifa->addr->ip, n->ifa->iface, + n->bfd_req = bfd_request_session(n->pool, n->ip, n->ifa->addr->ip, + n->ifa->iface, p->p.vrf, ospf_neigh_bfd_hook, n); if (!use_bfd && n->bfd_req) @@ -854,7 +857,7 @@ ospf_sh_neigh_info(struct ospf_neighbor *n) pos = "Other"; } - cli_msg(-1013, "%-1R\t%3u\t%s/%s\t%7t\t%-10s %-1I", + cli_msg(-1013, "%-12R\t%3u\t%s/%s\t%6t\t%-10s %I", n->rid, n->priority, ospf_ns_names[n->state], pos, tm_remains(n->inactim), ifa->ifname, n->ip); } diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index ef627e20..63ff9e56 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -805,7 +805,7 @@ ospf_sh_neigh(struct proto *P, char *iff) } cli_msg(-1013, "%s:", p->p.name); - cli_msg(-1013, "%-12s\t%3s\t%-15s\t%-5s\t%-10s %-12s", "Router ID", "Pri", + cli_msg(-1013, "%-12s\t%3s\t%-15s\t%-5s\t%-10s %s", "Router ID", "Pri", " State", "DTime", "Interface", "Router IP"); WALK_LIST(ifa, p->iface_list) if ((iff == NULL) || patmatch(iff, ifa->ifname)) diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 91c00588..4559310e 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -483,7 +483,8 @@ rip_update_bfd(struct rip_proto *p, struct rip_neighbor *n) */ ip_addr saddr = rip_is_v2(p) ? n->ifa->sk->saddr : n->nbr->ifa->ip; n->bfd_req = bfd_request_session(p->p.pool, n->nbr->addr, saddr, - n->nbr->iface, rip_bfd_notify, n); + n->nbr->iface, p->p.vrf, + rip_bfd_notify, n); } if (!use_bfd && n->bfd_req) diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c index 36097dc5..70cd0cdd 100644 --- a/proto/rpki/rpki.c +++ b/proto/rpki/rpki.c @@ -687,9 +687,9 @@ rpki_reconfigure_cache(struct rpki_proto *p UNUSED, struct rpki_cache *cache, st { struct rpki_tr_ssh_config *ssh_old = (void *) old->tr_config.spec; struct rpki_tr_ssh_config *ssh_new = (void *) new->tr_config.spec; - if ((strcmp(ssh_old->bird_private_key, ssh_new->bird_private_key) != 0) || - (strcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) != 0) || - (strcmp(ssh_old->user, ssh_new->user) != 0)) + if (bstrcmp(ssh_old->bird_private_key, ssh_new->bird_private_key) || + bstrcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) || + bstrcmp(ssh_old->user, ssh_new->user)) { CACHE_TRACE(D_EVENTS, cache, "Settings of SSH transport configuration changed"); try_fast_reconnect = 1; diff --git a/proto/static/static.c b/proto/static/static.c index 2fa687eb..c899cc87 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -159,7 +159,8 @@ static_update_bfd(struct static_proto *p, struct static_route *r) if (bfd_up && !r->bfd_req) { // ip_addr local = ipa_nonzero(r->local) ? r->local : nb->ifa->ip; - r->bfd_req = bfd_request_session(p->p.pool, r->via, nb->ifa->ip, nb->iface, + r->bfd_req = bfd_request_session(p->p.pool, r->via, nb->ifa->ip, + nb->iface, p->p.vrf, static_bfd_notify, r); } |