git: 0a3a377aee9b - main - routing: Disallow zero nexthop weights in nexthop groups.

Alexander V. Chernikov melifaro at FreeBSD.org
Wed Sep 1 07:19:34 UTC 2021


The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a3a377aee9bb28546fd2d1e45baa3fcad02439b

commit 0a3a377aee9bb28546fd2d1e45baa3fcad02439b
Author:     Alexander V. Chernikov <melifaro at FreeBSD.org>
AuthorDate: 2021-08-30 21:49:00 +0000
Commit:     Alexander V. Chernikov <melifaro at FreeBSD.org>
CommitDate: 2021-09-01 07:16:24 +0000

    routing: Disallow zero nexthop weights in nexthop groups.
    
    Adding such nexthops breaks calc_min_mpath_slots() assumptions,
     thus resulting in the incorrect nexthop group creation and
     eventually leading to panic.
    Reported by:    avg
    MFC after:      1 week
---
 sys/net/route/route_ctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c
index 6db088102cd3..dc40b6b8de71 100644
--- a/sys/net/route/route_ctl.c
+++ b/sys/net/route/route_ctl.c
@@ -266,6 +266,8 @@ get_info_weight(const struct rt_addrinfo *info, uint32_t default_weight)
 	/* Keep upper 1 byte for adm distance purposes */
 	if (weight > RT_MAX_WEIGHT)
 		weight = RT_MAX_WEIGHT;
+	else if (weight == 0)
+		weight = default_weight;
 
 	return (weight);
 }


More information about the dev-commits-src-main mailing list