From nobody Thu Mar 9 14:52:53 2023 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 4PXXGs43Xjz3x1VC; Thu, 9 Mar 2023 14:52:53 +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 4PXXGs3W3Fz3sfp; Thu, 9 Mar 2023 14:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678373573; 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=QH0JNJgmMXwmYZKaLQNHoODsBItBb6wqzkYlJEVrGMs=; b=wFUeTMagDOFXe9clA/WuBuDAVMUdjxSjicahV5iEFE0kRn6ZZkZiyNbgWzH/E5bZw8JMS0 DEN+HdYMEv2/HJcitCeKcqf/wlMhoy3i6QJ4OdpDNJvqujNxV30p3k9/lG7bks9c0OLhTZ lycgbFgqL0GeJm/iLQ/N+oLzxmvR3WzOhho6r8Vn7+uXTG/EVfOALVt7MgyBvhUEWUqslL CEhtbJU++h177EffWCUWOfRsbFlBIlYmAOWcaZsS13pAaGuPhpcyR+ypZp4d2ln++AuBMf NnXROBuXia5GHJkZSF3+oZXMHhbtkpB83YOyb/ShEbdL10g5VwsFjyKK2xZ5cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678373573; 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=QH0JNJgmMXwmYZKaLQNHoODsBItBb6wqzkYlJEVrGMs=; b=XufoFpzY0tPOOQRbHcgBIUFBUq6hmVk/r4MZUGDvxdIGu3OKDe72wGgZkDjFa8C4G86sHU /vP2A2/3qerk1YTYf01BbmLVrrW9CtEY05Ip4E79SYs4outVOaFIsVeQv9E34QHVqi3KIG APLD4v8gUIG7RsJlD4e4G3I2jDpUXyovzG0/ou+Xi/mdl196B677LKyZYOiF7BhMntu/28 dtR+AwEhrnnZioFsUEfRrHbYtmq1RVDdZcMGbsxmLlwJ6Q49Dt8iI2W13GFOyTUUdPgsup 0qFSiq3WaT4UfkUASL9NZZ3Ip3UMw4S6HdBTgkZnA6Ck77oBf+oNOLh1IHtDDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678373573; a=rsa-sha256; cv=none; b=TOydWLfjfaiGKeUuW/lt/rM6OO5Z4XlPaQwzTOwBThL4wtMP5dCCmvmTUXQX1dq8QuLFaH BJHRFlEaVP+ifVqXL0LMSRxtq+XBT4gU6S5CfvHMOM9fVbc7atSl4cQcXRG752VECSpLbC nHw3w/RDkmcFomwGzjSfAFvsF7iPO9qNiDs8ItLmLwKV+MgUxmUJpSJUSiPWpL6fKBjIxx /LaNulc4MXicbrinU95rKqjlbuwYITf7ipwbGzbKWNrPdCblFaatEE4ZdMfGmibJAQWDPj wZjDQbMwpuH7M8g9Zke3keyB7n1X6GriptuzbFUef3rVxFDIkukJrEzOPKWcpA== 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 4PXXGs2XLMz1BbM; Thu, 9 Mar 2023 14:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 329EqrjE064549; Thu, 9 Mar 2023 14:52:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 329EqrfQ064548; Thu, 9 Mar 2023 14:52:53 GMT (envelope-from git) Date: Thu, 9 Mar 2023 14:52:53 GMT Message-Id: <202303091452.329EqrfQ064548@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 90d625122886 - main - netlink: add rtsock-compatible header to use with netlink snl(3). 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90d625122886a2db5b66d248807b89f4a0270466 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=90d625122886a2db5b66d248807b89f4a0270466 commit 90d625122886a2db5b66d248807b89f4a0270466 Author: Alexander V. Chernikov AuthorDate: 2023-03-09 14:36:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-03-09 14:37:42 +0000 netlink: add rtsock-compatible header to use with netlink snl(3). Some routing socket defines (`RTM_` and `RTA_` ones) clash with the ones used by the the Netlink. As some rtsock definitions like interface flags or route flags are used in both netlink and rtsock, provide a convenient way to include those without running into the define collision. Differential Revision: https://reviews.freebsd.org/D38982 MFC after: 2 weeks --- sys/net/route.h | 7 +++++ sys/netlink/netlink_snl_route_compat.h | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/sys/net/route.h b/sys/net/route.h index 34a7b0d5c795..ad1847293502 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -265,6 +265,7 @@ struct rt_msghdr { #define RTM_VERSION 5 /* Up the ante and ignore older versions */ +#ifndef NETLINK_COMPAT /* * Message types. * @@ -297,6 +298,8 @@ struct rt_msghdr { #define RTM_IFANNOUNCE 0x11 /* (5) iface arrival/departure */ #define RTM_IEEE80211 0x12 /* (5) IEEE80211 wireless event */ +#endif /* NETLINK_COMPAT*/ + /* * Bitmask values for rtm_inits and rmx_locks. */ @@ -310,6 +313,8 @@ struct rt_msghdr { #define RTV_RTTVAR 0x80 /* init or lock _rttvar */ #define RTV_WEIGHT 0x100 /* init or lock _weight */ +#ifndef NETLINK_COMPAT + /* * Bitmask values for rtm_addrs. */ @@ -322,6 +327,8 @@ struct rt_msghdr { #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ #define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ +#endif /* NETLINK_COMPAT*/ + /* * Index offsets for sockaddr array for alternate internal encoding. */ diff --git a/sys/netlink/netlink_snl_route_compat.h b/sys/netlink/netlink_snl_route_compat.h new file mode 100644 index 000000000000..51904abb4003 --- /dev/null +++ b/sys/netlink/netlink_snl_route_compat.h @@ -0,0 +1,50 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2023 Alexander V. Chernikov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_ +#define _NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_ + +/* + * This file contains netlink-compatible definitions from the + * net/route.h header. + */ +#define NETLINK_COMPAT + +#include + +#define RTSOCK_RTM_ADD 0x1 +#define RTSOCK_RTM_DELETE 0x2 +#define RTSOCK_RTM_CHANGE 0x3 +#define RTSOCK_RTM_GET 0x4 +#define RTSOCK_RTM_NEWADDR 0xc +#define RTSOCK_RTM_DELADDR 0xd +#define RTSOCK_RTM_IFINFO 0xe +#define RTSOCK_RTM_NEWMADDR 0xf +#define RTSOCK_RTM_DELMADDR 0x10 +#define RTSOCK_RTM_IFANNOUNCE 0x11 +#define RTSOCK_RTM_IEEE80211 0x12 + +#endif