From: claudio Date: Thu, 18 Aug 2022 17:02:42 +0000 (+0000) Subject: In kroute_insert() fix the check for multipath routes. Use a helper variable X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d7ab08139e00b2370627149e410fa8ac15aed644;p=openbsd In kroute_insert() fix the check for multipath routes. Use a helper variable since krm is only set for IPv4 routes but not for IPv6 ones. OK tb@ --- diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 80d01ceb3ea..8c55e80cd18 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.293 2022/08/18 12:14:00 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.294 2022/08/18 17:02:42 claudio Exp $ */ /* * Copyright (c) 2022 Claudio Jeker @@ -1607,6 +1607,7 @@ kroute_insert(struct ktable *kt, struct kroute_full *kf) struct kroute6 *kr6, *kr6m; struct knexthop *n; uint32_t mplslabel = 0; + int multipath = 0; if (kf->prefix.aid == AID_VPN_IPv4 || kf->prefix.aid == AID_VPN_IPv6) { @@ -1648,6 +1649,7 @@ kroute_insert(struct ktable *kt, struct kroute_full *kf) while (krm->next != NULL) krm = krm->next; krm->next = kr; + multipath = 1; } if (kf->flags & F_BGPD) @@ -1684,6 +1686,7 @@ kroute_insert(struct ktable *kt, struct kroute_full *kf) while (kr6m->next != NULL) kr6m = kr6m->next; kr6m->next = kr6; + multipath = 1; } if (kf->flags & F_BGPD) @@ -1699,8 +1702,8 @@ kroute_insert(struct ktable *kt, struct kroute_full *kf) kf->prefixlen) == 0) knexthop_validate(kt, n); - if (krm == NULL) - /* redistribute multipath routes only once */ + /* redistribute multipath routes only once */ + if (!multipath) kr_redistribute(IMSG_NETWORK_ADD, kt, kf); }