From nobody Tue Jun 25 12:47:34 2024 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 4W7l3V5VJfz5PV7N; Tue, 25 Jun 2024 12:47:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W7l3V4YYXz4dP3; Tue, 25 Jun 2024 12:47:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719319654; 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=CrjitpHnuO+foPMIE09SpnwzuxCm0AKUjoI47MivW+g=; b=QBYViGYayDZjxFxM1cBP6vWuuOMmRqsOyanhpx9Ae4zDR6muwlhMSJSwrBZAQ8d0u9zlH3 RQa5H6h2/HihjolwIPSu3DhwWvmoAVt4M8nlsmLoilckGiQnb6R2I9V8O855hfN2gKENRw lTHojpiS5AaXeJyqab9vQK/OIGlT9bIZqeRFrDCnDQ45/Z4LyETun0VibmCjQXzJjZSsSC 9rM1LrpzzEvFpD4DhCzaYk11KB7B/tNPWE+k+gXLB6jjj+KQG9BOY/zJG+9Z4uPYVr/hzs fR2UTjGvg2/5iD+T0RpYIx5mTOIYl7BKjpsAXqw8N8Hg5Qp6YpWGbMicjXLxZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719319654; a=rsa-sha256; cv=none; b=ObbMhjlPutxGO+A4O5dnN5wWqyrDQOY1q7QJuN0mDOvOunBsTe4iARypBeTpcp4D4cIOJU 0PU5wI0idRMFPz7f1nR1f+MgJXGc4/LLzAC96RQ3v+FfisbfudK7JOC8LyPd6ZnELzYQVJ 9iiGi8tluRNNPSLU+8yOrKEWH2YwURKZ3sjJ59EoDBbNy+XTY5vOzKoX7xSC1Whz0u7jX3 UOmeUqY+mP1MTTXR6xDhW23oFSvMFrc+gzO/ileN61GRqO12iTfqwlbA+VgNDjCSBUnxIY RDeFSmWHIlknVP6xppHqkuCKA15tfo5GT4B/eKnmG18WrHUfAS4huxJQ9EFucw== 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=1719319654; 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=CrjitpHnuO+foPMIE09SpnwzuxCm0AKUjoI47MivW+g=; b=WpirVoTIvYwco+1JWPQsvJJOwZrE43BDmqsv56N3eNn5+fZ6M1nVndyodKjv0lq+jduTuR 6gUhn4u6879UhUDOwuBkNQHU3UzErX1KrINp/Q5dfag6vcvPwkdemFwMP/M7u9+GOAh338 UrzL+rQgeurdlBY+tdjIsvC4P1QOY643aPyc148+vvrCAe+jTLnS0kOP3PA1v2EIjLBz2H rnV22ZrE21Q6Fr3QZcJOIxeAjKSbc51wQKVJtt2HBld9K0AXrT+o5RxIaGwZm32PzBmMap RyaJc1YKuQsm7bOa7aK9yuK0dY5Vdt5oGd9iDnnb5cNwic0gn5of7ywAFnKmOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4W7l3V48Drz12Zg; Tue, 25 Jun 2024 12:47:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45PClYW3032506; Tue, 25 Jun 2024 12:47:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45PClYWw032503; Tue, 25 Jun 2024 12:47:34 GMT (envelope-from git) Date: Tue, 25 Jun 2024 12:47:34 GMT Message-Id: <202406251247.45PClYWw032503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: df7001bad094 - stable/14 - netlink/route: provide pre-2.6.19 Linux compat shim List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: df7001bad09474da00885ed853bc6708019fb292 Auto-Submitted: auto-generated The branch stable/14 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=df7001bad09474da00885ed853bc6708019fb292 commit df7001bad09474da00885ed853bc6708019fb292 Author: Gleb Smirnoff AuthorDate: 2024-06-20 23:10:39 +0000 Commit: Gleb Smirnoff CommitDate: 2024-06-25 12:47:24 +0000 netlink/route: provide pre-2.6.19 Linux compat shim The old Linux used 8-bit rtm_table field of the RTM_NEWROUTE message to specify routing table id. Modern netlink uses RTA_TABLE 32-bit attribute. Unfortunately, there is modern software (namely bird) that would prefer the old API as long as the routing table id fits into 8-bit. PR: 279662 (cherry picked from commit f34aca55adef1e28cd68b2e6705a0cac03f0238e) --- sys/netlink/route/rt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index ed09748995dc..7379d49b96a9 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -475,6 +475,7 @@ struct nl_parsed_route { uint32_t rta_nh_id; uint32_t rta_weight; uint32_t rtax_mtu; + uint8_t rtm_table; uint8_t rtm_family; uint8_t rtm_dst_len; uint8_t rtm_protocol; @@ -507,6 +508,7 @@ static const struct nlfield_parser nlf_p_rtmsg[] = { { .off_in = _IN(rtm_dst_len), .off_out = _OUT(rtm_dst_len), .cb = nlf_get_u8 }, { .off_in = _IN(rtm_protocol), .off_out = _OUT(rtm_protocol), .cb = nlf_get_u8 }, { .off_in = _IN(rtm_type), .off_out = _OUT(rtm_type), .cb = nlf_get_u8 }, + { .off_in = _IN(rtm_table), .off_out = _OUT(rtm_table), .cb = nlf_get_u8 }, { .off_in = _IN(rtm_flags), .off_out = _OUT(rtm_flags), .cb = nlf_get_u32 }, }; #undef _IN @@ -939,7 +941,10 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (EINVAL); } - if (attrs.rta_table >= V_rt_numfibs) { + if (attrs.rtm_table > 0 && attrs.rta_table == 0) { + /* pre-2.6.19 Linux API compatibility */ + attrs.rta_table = attrs.rtm_table; + } else if (attrs.rta_table >= V_rt_numfibs) { NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); return (EINVAL); }