From nobody Fri Nov 13 21:51:20 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jR9tw42Znz6y9By for ; Fri, 13 Nov 2026 21:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jR9tw28K4z3H2r for ; Fri, 13 Nov 2026 21:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794606680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmlkNX3jY3a2jtk/STSOgzN6NYsuEnbUssxSq8p8n0Y=; b=dTKxY3nqmDn1+hdWtU6+G7G79kkEGuAAf0JSiUsdDP7HMvluWV+PglSeq6UAvB4I3ajR1/ NKEH0wZ9ct9amwvsEEJN09ubJWV0WrUj9apnlEAjep5aczJ1wBidPdzLiLF3PX9ppyf50x MsCfjVal5FTXTwiEd86Uc8MYBHkDJxHtGiSjIEdPfMvD0UM6h40gUGoM2iRN9u9QDYz8WZ sBNbmvz28Kl6/yj463hTrH3zSOxxovZ1dWtgp66PMuxSQkDHp18lXjuLSW9iXQGdTdh3wU SW1epFe3L8wZebe6AyLxbn2yArCMmM1dVvwIraqzTfnUpCCKZPvXD9YKwjvkjQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794606680; b=jBAh/0ot2Brkf7e6i/uGYxm9f7jg5+SeTo4wtPZ+cqbYDUcAdxBvmfYvNO2NxhWfWeX/E8 qA/XXSIuZSeiI1i/w1lze8Dz1zvOWQkZ2xw1doSD1hWVqrT9xS+XerXnk4gVOXlFKcAJqI +nVUTA+1i3xA7DVqk6oH4D2zH6MTsNVrV+DSDlO7A1VQH57fN/yOJiex9BtF/FY93z+Z3w Z33cEhAKwBxYXsdpHTO/hMTwvo8aaLr1eVY/Mt6tqZewxRY4QLZssl1izdlyktC+iiHH1t pIDy4lqenxXuqLd4MFjsL2+ps3uhFV7YeP501UE02xE9u3pijLYL2cyyp5jIpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794606680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmlkNX3jY3a2jtk/STSOgzN6NYsuEnbUssxSq8p8n0Y=; b=SLm5l9HQhc1dQvbNKB9hEDhfON2CjTj5h0i8ZsVljzs4zNzHepMQCviIqL3TJ4tcyeOw0D TDNrmuIfsGMNiOLgXtAA6IkY0wgcjY/S7fluX24g/nsiy3L9xyja9IRG0HVxGLl9Wy/cGE yNqjSmZmMpGVOvNrwZCavdj31qTUNuoIzxbrcqbnEC5i+NPEuFkOM0qQSqUNLtPXm0jMPn CV0ELcSfSuS8B0AlbcrnfGEMEt/r8iahbnd6Zv/h9W1n0/oJElpmHiJL3n2ftkZiP8AN5W xsWsikxWpdofJtjMtwbQV1C4RxipqPPOaWQ7hMkXEciykogtpmlvVOMt/MqDdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jR9tw1WnlztXv for ; Fri, 13 Nov 2026 21:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id d73e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 21:51:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: 1db6e2c6c355 - main - rtnetlink: Use default weight for unset weights in NHA_GROUP List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1db6e2c6c3554efe5acdcc20bc7aa889e1efe372 Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 21:51:20 +0000 Message-Id: <6af78658.d73e.4c36d0d6@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=1db6e2c6c3554efe5acdcc20bc7aa889e1efe372 commit 1db6e2c6c3554efe5acdcc20bc7aa889e1efe372 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-11-13 21:40:45 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-11-13 21:47:24 +0000 rtnetlink: Use default weight for unset weights in NHA_GROUP newnhg() copied the weights of a nhgrp as is and a group whose members all have a zero weight, which is what userland sends when it leaves the weight unset, made calc_min_mpath_slots_fast() divide by zero. Therefore replace weight of zero with RT_DEFAULT_WEIGHT. While here, return early from calc_min_mpath_slots_fast() if all weights are zero. MFC after: 3 days Fixes: 7e5bf68495cc ("netlink: add netlink support") --- sys/net/route/nhgrp_ctl.c | 2 +- sys/netlink/route/nexthop.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index 93c468e785c8..3d5546ffe317 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -174,7 +174,7 @@ calc_min_mpath_slots_fast(struct weightened_nhop *wn, size_t num_items, } *ptotal = total; /* xmin is the minimum unit of desired capacity */ - if ((total % xmin) != 0) + if (xmin == 0 || (total % xmin) != 0) return (0); for (i = 0; i < num_items; i++) { if ((wn[i].weight % xmin) != 0) diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index e5f776e9d052..2cbaffcebcbd 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -778,7 +778,7 @@ newnhg(struct unhop_ctl *ctl, struct nl_parsed_nhop *attrs, struct user_nhop *un * restrict nexthops with the same gateway */ wn[i].nh = unhop->un_nhop_src; - wn[i].weight = grp[i].weight; + wn[i].weight = grp[i].weight > 0 ? grp[i].weight : RT_DEFAULT_WEIGHT; } unhop->un_nhgrp_src = wn; unhop->un_nhgrp_count = count;