From nobody Fri Apr 28 13:56:18 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 4Q7DfV4KCdz48Vtf; Fri, 28 Apr 2023 13:56: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q7DfV3p5Sz3vNV; Fri, 28 Apr 2023 13:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682690178; 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=ezefy8YCKOzN/5VBkZNo9iNdrqesuHIl3xiQsm3WZTM=; b=pmWOr2SIAbHXdTbyyApJa6LHBsWffHJKampnETl0lTp0/hf581Oi6//fls2JZFreEizgvx EZ7wuU/OVy3rFsUKHGE18uumH3HrYpZjEQ2XfTH5meTn9MPrk2S14+CH+21hHaKBJOl3CN RFac+vCvRXiRc7IQfNt/Y9tvWtzoGdMofXp0QYlYVrHVflxzIDvq9aHHB7ugPCaMm2Srso oGopHeGowTxAyBwHWqlSCZX+YUOAzb0LhphnTk3ewFzcUmWgcmWWny646WDzP1KXobW24O K1elWE6zRnLa7HNlMoq0xOLRsV3qY8OVfMuskJU6ySmgvRk2BdT7ouL9yF5Jyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682690178; 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=ezefy8YCKOzN/5VBkZNo9iNdrqesuHIl3xiQsm3WZTM=; b=MKJcQ5fj3EaqsUnWMeJn8id1m6ws+3jMNiMjZG8VO4XS+zL15rKEGNqSfYpoZmj1s+OtEj MZjZLDTLHQbCo5gEg2eDGn3Lq5jNkIfQ58ydxrub2RVuruj34V5GyL+8itCmyME1NSCeD9 jsDh2jKfdQDu4bsYRS88YgCzqnl9wokyrECUMEYMYDJ6NZF6GZ/p9BgHVUOTbGrGOk0zLE o7zITuybfrkE4ldsLnQgZR/TrXREDisn28xREFixRRF5ncSVDEKt1Wdx0gHYlECJF+YZae 4wghDYlOhbx/1jcFXUQHkfsv1tBeZFQ+Q5wN2DnlwC7qrEUxXUm8vuwF8+L/kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682690178; a=rsa-sha256; cv=none; b=iowg3wOWtRi0TWLQNhrancunfFzd+kQbS1jpk9VypQ1AIh+YIxmyf21hXHf59zKBKtDkEm VGPWjk7EJpcFiuB/mTkSOxk5OyC86eb7xY6/pVTq12F4w377xpdH0vkeDgrNjvwztkunID U+TVCocH3uLdj7ga521vWS8L9Syzg7QBhvGnYURn+tRsgVAL182usIrpZpXRr+SmlSmd5g WqWgKyCGlF9QDGTIJbUNd4DQfv2CqajvY7WNYywTx+ZMJNsDDdtAGlAxyOhlgNgsZnEllB p/NHu0gebAoh4Ap2Hxm3VZ2IHw/kZVW4UDi4SRytfq0ljnvi8m+Hwf/Mj/dmDQ== 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 4Q7DfV2rSnz12Zy; Fri, 28 Apr 2023 13:56:18 +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 33SDuIKJ012391; Fri, 28 Apr 2023 13:56:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33SDuIc8012390; Fri, 28 Apr 2023 13:56:18 GMT (envelope-from git) Date: Fri, 28 Apr 2023 13:56:18 GMT Message-Id: <202304281356.33SDuIc8012390@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: 9e79038c5024 - main - netlink: fix netlink interface operations when netlink is loaded as a module. 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: 9e79038c502433f077b4d3b5bb1c0838329f1ebc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9e79038c502433f077b4d3b5bb1c0838329f1ebc commit 9e79038c502433f077b4d3b5bb1c0838329f1ebc Author: Alexander V. Chernikov AuthorDate: 2023-04-28 13:30:36 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-04-28 13:35:58 +0000 netlink: fix netlink interface operations when netlink is loaded as a module. This change completes 089104e0e01f. MFC after: 2 weeks --- sys/netlink/netlink_module.c | 2 ++ sys/netlink/route/iface_drivers.c | 5 +++-- sys/netlink/route/route_var.h | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/sys/netlink/netlink_module.c b/sys/netlink/netlink_module.c index 051eb0cb120b..31faf1d003d9 100644 --- a/sys/netlink/netlink_module.c +++ b/sys/netlink/netlink_module.c @@ -187,6 +187,8 @@ const static struct nl_function_wrapper nl_module = { .nlmsg_get_group_writer = _nlmsg_get_group_writer, .nlmsg_get_chain_writer = _nlmsg_get_chain_writer, .nlmsg_end_dump = _nlmsg_end_dump, + .nl_modify_ifp_generic = _nl_modify_ifp_generic, + .nl_store_ifp_cookie = _nl_store_ifp_cookie, }; #endif diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index 17fbc1000d23..6f6adc323be6 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -25,6 +25,7 @@ * SUCH DAMAGE. */ +#include "opt_netlink.h" #include __FBSDID("$FreeBSD$"); #include "opt_inet.h" @@ -64,7 +65,7 @@ _DECLARE_DEBUG(LOG_DEBUG); * such as state, mtu or description. */ int -nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, +_nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, const struct nlattr_bmask *bm, struct nl_pstate *npt) { int error; @@ -118,7 +119,7 @@ nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, * IFLA_IFNAME(string) */ void -nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) +_nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) { int ifname_len = strlen(if_name(ifp)); uint32_t ifindex = (uint32_t)ifp->if_index; diff --git a/sys/netlink/route/route_var.h b/sys/netlink/route/route_var.h index cbcc71e9ac21..7b83a533fdc2 100644 --- a/sys/netlink/route/route_var.h +++ b/sys/netlink/route/route_var.h @@ -77,9 +77,31 @@ struct nl_parsed_link { uint32_t ifi_change; }; +#if defined(NETLINK) || defined(NETLINK_MODULE) +/* Provide optimized calls to the functions inside the same linking unit */ + +int _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, + const struct nlattr_bmask *bm, struct nl_pstate *npt); +void _nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp); + +static inline int +nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, + const struct nlattr_bmask *bm, struct nl_pstate *npt) +{ + return (_nl_modify_ifp_generic(ifp, lattrs, bm, npt)); +} + +static inline void +nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp) +{ + _nl_store_ifp_cookie(npt, ifp); +} +#else +/* Provide access to the functions via netlink_glue.c */ int nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, const struct nlattr_bmask *bm, struct nl_pstate *npt); void nl_store_ifp_cookie(struct nl_pstate *npt, struct ifnet *ifp); +#endif /* defined(NETLINK) || defined(NETLINK_MODULE) */ typedef int rtnl_iface_create_f(struct nl_parsed_link *lattrs,