-/* $OpenBSD: parse.y,v 1.316 2017/10/19 06:52:55 jsg Exp $ */
+/* $OpenBSD: parse.y,v 1.317 2018/02/04 05:08:16 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
netconf = &conf->networks;
- add_rib("Adj-RIB-In", conf->default_tableid,
- F_RIB_NOFIB | F_RIB_NOEVALUATE);
+ add_rib("Adj-RIB-In", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE);
+ add_rib("Adj-RIB-Out", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE);
add_rib("Loc-RIB", conf->default_tableid, F_RIB_LOCAL);
if ((file = pushfile(filename, 1)) == NULL) {
-/* $OpenBSD: rde.c,v 1.373 2017/11/14 22:04:50 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.374 2018/02/04 05:08:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
nexthop_init(nexthophashsize);
peer_init(peerhashsize);
+ /* make sure the default RIBs are setup */
+ rib_new("Adj-RIB-In", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE);
+ rib_new("Adj-RIB-Out", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE);
+
out_rules = calloc(1, sizeof(struct filter_head));
if (out_rules == NULL)
fatal(NULL);
peer->prefix_rcvd_update++;
/* add original path to the Adj-RIB-In */
- if (path_update(&ribs[0].rib, peer, asp, prefix, prefixlen))
+ if (path_update(&ribs[RIB_ADJ_IN].rib, peer, asp, prefix, prefixlen))
peer->prefix_cnt++;
- for (i = 1; i < rib_size; i++) {
+ for (i = RIB_LOC_START; i < rib_size; i++) {
if (*ribs[i].name == '\0')
break;
/* input filter */
{
u_int16_t i;
- for (i = 1; i < rib_size; i++) {
+ for (i = RIB_LOC_START; i < rib_size; i++) {
if (*ribs[i].name == '\0')
break;
if (prefix_remove(&ribs[i].rib, peer, prefix, prefixlen, 0)) {
}
/* remove original path form the Adj-RIB-In */
- if (prefix_remove(&ribs[0].rib, peer, prefix, prefixlen, 0))
+ if (prefix_remove(&ribs[RIB_ADJ_IN].rib, peer, prefix, prefixlen, 0))
peer->prefix_cnt--;
peer->prefix_rcvd_withdraw++;
ribs[rid].state = RECONF_RELOAD;
/* FALLTHROUGH */
case RECONF_REINIT:
- rib_dump(&ribs[0].rib, rde_softreconfig_in, &ribs[rid],
- AID_UNSPEC);
+ rib_dump(&ribs[RIB_ADJ_IN].rib, rde_softreconfig_in,
+ &ribs[rid], AID_UNSPEC);
break;
case RECONF_RELOAD:
log_warnx("Bad rib reload state");
rde_apply_set(asp, &nc->attrset, nc->prefix.aid, peerself, peerself);
if (vpnset)
rde_apply_set(asp, vpnset, nc->prefix.aid, peerself, peerself);
- for (i = 1; i < rib_size; i++) {
+ for (i = RIB_LOC_START; i < rib_size; i++) {
if (*ribs[i].name == '\0')
break;
path_update(&ribs[i].rib, peerself, asp, &nc->prefix,
}
}
- for (i = 1; i < rib_size; i++) {
+ for (i = RIB_LOC_START; i < rib_size; i++) {
if (*ribs[i].name == '\0')
break;
prefix_remove(&ribs[i].rib, peerself, &nc->prefix,
-/* $OpenBSD: rde_rib.c,v 1.154 2017/05/28 12:21:36 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.155 2018/02/04 05:08:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
{
u_int16_t id;
+ /* no name returns the first Loc-RIB */
if (name == NULL || *name == '\0')
- return (&ribs[1].rib); /* no name returns the Loc-RIB */
+ return (&ribs[RIB_LOC_START].rib);
for (id = 0; id < rib_size; id++) {
if (!strcmp(ribs[id].name, name))
}
/* only count Adj-RIB-In */
- if (re_rib(p->re) == &ribs[0].rib)
+ if (re_rib(p->re) == &ribs[RIB_ADJ_IN].rib)
rprefixes++;
prefix_destroy(p);