From nobody Thu Jun 20 23:11:23 2024 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 4W4x7c1vd8z5NwgV; Thu, 20 Jun 2024 23:11:24 +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 4W4x7c04Z3z4GtJ; Thu, 20 Jun 2024 23:11:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718925084; 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=5Ak1fzz0q5SNTVI9+Ue3eUOW3eTt0hvpwFEP3B8HNMA=; b=RmQfpM8hxKAd6+IBDAw7PPnSMmbit2SGbxF1LDrXoPXIwHx2CR1CaNMOBfAosTYYgr6me9 MVvL/BU2Mqm1DheZ5AKNwskz2ChbdOaiajVFhMCRl3rK4BWVpQ+a8coYEGnWKIXsRTa+IO zV1DBNGrrSf1LVjASGd2jICuvTqUDxHka5ZzEpDeEtWyRz1ctn+RyoAIDwqcxBH2eQJBT1 dtqejGfKxytzMAlb4lIfjePCpe4iUka4PFNBc1kwalJnd17+fDuJYTepWVlnhlhaZiUA44 gxLtPDmy4z1qM1MX2e2DTjNQA9LzI47BjLBoaLheqcOWvB+ABOk3aisFI0oBEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718925084; a=rsa-sha256; cv=none; b=ueEA++IV7986NvAxM0bLOG+S6SVGW2vpPhCKqi8jZe701or7ftGaBcafKYwb4JcJoP5nGy S3Gp/gfTriqBUwXn+MBqRVnpdoNYeEqviqOdxpquavCPZJoi0vL5656m7XPZ+F9tlmojJZ 3h1No3L4ZLUiDQlVv0+Yjx00Uz51rHDBW4xN5w61yNZQq1Mepv00Uug4qo24cqjCpKU8EN ceU0P75VOHRjq+oFymOD2SHJok/wekfmXP8IBMr/jPYwfiGc9ocy3DRj311R8LLybtqSJH 34Gqwx0xWdxWlAbzhDY3cer/r3KK580zVZkZRBPYoxlUUq28EpyWeFsgukcgRA== 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=1718925084; 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=5Ak1fzz0q5SNTVI9+Ue3eUOW3eTt0hvpwFEP3B8HNMA=; b=cGe6O0kvrU5A659WNDH7kPKy9iknc1ZFcMkTWZMdS8+TuYT16W+1dgb2mK2yIJXWGsFs13 JQoI+MOpMyYndw9utOsuGy96B/Qfkcsv5H6i4wjk42rUzBM+TmO4nhEifcZG7nQ1R06GkD Qt52tbU/308GcbceOCiMO2iMhow8GBzVULuD3EoVyU/35QS1Vp1FL7grHf2908R9uXRVPh S+wmNLwKXl6/a2GktnxELj5n/jAIYRaxwEJzHLLj1NzU60qW9sOAixewRzrO/7D0dIZS3J IC8THEcSHU0gGNzdpaWMPBQpaKW+4K+7/SuHN7gzv2JRTUdsjV8oIrHApS8hWA== 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 4W4x7b6mtczkf0; Thu, 20 Jun 2024 23:11:23 +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 45KNBNQ7004503; Thu, 20 Jun 2024 23:11:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45KNBNkI004492; Thu, 20 Jun 2024 23:11:23 GMT (envelope-from git) Date: Thu, 20 Jun 2024 23:11:23 GMT Message-Id: <202406202311.45KNBNkI004492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: f34aca55adef - main - netlink/route: provide pre-2.6.19 Linux compat shim 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 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/main X-Git-Reftype: branch X-Git-Commit: f34aca55adef1e28cd68b2e6705a0cac03f0238e Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f34aca55adef1e28cd68b2e6705a0cac03f0238e commit f34aca55adef1e28cd68b2e6705a0cac03f0238e Author: Gleb Smirnoff AuthorDate: 2024-06-20 23:10:39 +0000 Commit: Gleb Smirnoff CommitDate: 2024-06-20 23:10:39 +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 --- 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 ffa06fb4c1ab..00315afbcb02 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 @@ -937,7 +939,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); }