From nobody Thu May 28 20:01:18 2026 X-Original-To: dev-commits-src-main@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 4gRHRy50yqz6f1J8 for ; Thu, 28 May 2026 20:01:18 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRHRy2k0mz4Jyq for ; Thu, 28 May 2026 20:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779998478; 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=A5nHVuqrKnxoUgiX4MeiaVMewzjjrR/vl/hrPZEyU9A=; b=oS7xmthGVN6+jhIrugQ02celdaMyC+WAc3csKgchqTBNDtNIBLxzThKsh5BCvD4/0PU2YP uz+b+vTOQDpwJ6hXYQqOL30EcTpm69kKcnBjfSaCrV2K+xrH4DvjUHH0580t+KXM2e/rym 0yWDbqIFNP55vRsacqo9yau9I7mWYKrux2TYN3sTuFENjjzTbS4WWjZpXwN3YhBMtU7DZA HgL8sNBQuUXoBJOR0/7pPur3NtYT1zGc042pHZcl5yWHG9av+lku+rhwQimyuaxNYuvYzT WhUTPLgA2rkRkcBYrKdH+VdeAijKr+0Nk03QZQy9ZCTwB2nFbjI7Am3xC4zoRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779998478; a=rsa-sha256; cv=none; b=fAisMhxZAeMxBFdy7Em721WCOa4cQ8x/Bx3M9yIblQuC6a/lF0q136T48HNH+j5+yNzBp2 3tr/KFLTbpgyMckwMtqISVJCd9olj4Qt3knwhnl7TuRDjas8BxgQuqLr6MOmrerST1gcIE PjXdgOTNE6o0+KHf/v1hyovxlWpCWRGUy2cGL/eCc30aMv0g21yV74HzlkdAQZzs9ehc1G Nuu2d2VKA29YgdFZEJ3Ne/u++TJ5RhgP2CnnDL4QPFRnU4VqHs+K8/Zb51iFBjmImQEzyG e5AVbK0IQzgnNPDTxp87NIHM2rbPLHLB0PHM04LCHZhi0cmrWCMhhdaci0XRZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779998478; 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=A5nHVuqrKnxoUgiX4MeiaVMewzjjrR/vl/hrPZEyU9A=; b=YF4q7uCErujxU07lShtRhqvZk75x88o/sYdyZXuWlCcAp7ymgBoVAtxMZrGv+MFRXT+SUr BLTuNxQnHAKY8lq/bFuCyTZfEQP1qtV9/V9L5s3a4H1wLrnpbfC4aEHEjJuvDW+DcMwscd Amv35H564P3qIIo78G4rGrKBmv8w+MX91VuBS4aJuHJjz8l+e6cymOoUPc9EOVYYH4Rids E5vGTup/5FjvZ8h5npcyXUZ0mqZT8xkmFOweyictlHZG5v+hWesYbgyASRsmXHEYZkw9ni hOSB96JdDNuWHA6fdO8jNVNunythdL4cBZfftH34puYUbELRVMXtIAaf6AGykQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRHRy24Yhz11Rq for ; Thu, 28 May 2026 20:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26ecf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 20:01:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: 97f7b21dd525 - main - rtnetlink: Fix weight overflow in RTA_MULTIPATH List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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: 97f7b21dd52542421bc883e336e35af078af47fe Auto-Submitted: auto-generated Date: Thu, 28 May 2026 20:01:18 +0000 Message-Id: <6a189f0e.26ecf.5c59f70@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=97f7b21dd52542421bc883e336e35af078af47fe commit 97f7b21dd52542421bc883e336e35af078af47fe Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-05-27 09:58:34 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-05-28 20:00:15 +0000 rtnetlink: Fix weight overflow in RTA_MULTIPATH If the weight value is larger than 8 bits, set it to the maximum. Also, only send RTA_WEIGHT if its value is not the default. This reduces message size and matches the behavior of non-multipath routes. Reviewed by: emaste, markj Differential Revision: https://reviews.freebsd.org/D57266 --- sys/netlink/route/rt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index ee17737426ed..17aae399c10a 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -217,7 +217,7 @@ dump_rc_nhg(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtms return; rtnh->rtnh_flags = 0; rtnh->rtnh_ifindex = if_getindex(wn[i].nh->nh_ifp); - rtnh->rtnh_hops = wn[i].weight; + rtnh->rtnh_hops = MIN(wn[i].weight, UINT8_MAX); dump_rc_nhop_gw(nw, wn[i].nh); uint32_t rtflags = nhop_get_rtflags(wn[i].nh); if (rtflags != base_rtflags) @@ -242,7 +242,8 @@ dump_rc_nhg(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtms } nlattr_set_len(nw, off); nlattr_add_u32(nw, NL_RTA_PRIORITY, nhop_metric); - nlattr_add_u32(nw, NL_RTA_WEIGHT, nhop_weight); + if (nhop_weight != RT_DEFAULT_WEIGHT) + nlattr_add_u32(nw, NL_RTA_WEIGHT, nhop_weight); } static void