From 0a3a377aee9bb28546fd2d1e45baa3fcad02439b Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Mon, 30 Aug 2021 21:49:00 +0000 Subject: [PATCH] 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); }