summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-08-18 17:02:43 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-08-18 17:02:43 +0000
commitb36a069d7da50acdb82942df598ac99712aabefb (patch)
tree2a444435fe6f9dbfcf6cbc02209fccab8e2ddd68 /usr.sbin/bgpd
parenteeb713d26cffec08344652f24a7ebeb1b765f611 (diff)
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@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/kroute.c9
1 files changed, 6 insertions, 3 deletions
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 <claudio@openbsd.org>
@@ -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);
}