summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2009-08-27 00:28:28 +0200
committerDavid Lamparter <equinox@diac24.net>2010-02-03 05:18:41 +0100
commit8fcd030de867a3ca6eddf47753e3bac106a1b1e4 (patch)
treede9dd8b1c99861a9bb854ec0afc281b0b83c573a /zebra
parent3a57d76849e2fba8c53576b850ee85710074e283 (diff)
downloadquagga-8fcd030de867a3ca6eddf47753e3bac106a1b1e4.tar.bz2
quagga-8fcd030de867a3ca6eddf47753e3bac106a1b1e4.tar.xz
rib: default distance value for new protocols (v2)
adding protocols and forgetting to update zebra_rib.c currently causes a beyond end of array access for the default distance value. fix by making 150 the default distance for unknown routing protocols. 150 is higher than all other IGPs but lower than iBGP (200)
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_rib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 12f3fa5a..8228350f 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -67,6 +67,7 @@ static const struct
{ZEBRA_ROUTE_OSPF6, 110},
{ZEBRA_ROUTE_ISIS, 115},
{ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */}
+ /* no entry/default: 150 */
};
/* Vector for routing table. */
@@ -1511,7 +1512,10 @@ rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
/* Set default distance by route type. */
if (distance == 0)
{
- distance = route_info[type].distance;
+ if ((unsigned)type >= sizeof(route_info) / sizeof(route_info[0]))
+ distance = 150;
+ else
+ distance = route_info[type].distance;
/* iBGP distance is 200. */
if (type == ZEBRA_ROUTE_BGP && CHECK_FLAG (flags, ZEBRA_FLAG_IBGP))