From nobody Thu Sep 11 21:05:17 2025 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 4cN97K5h1mz67R2n; Thu, 11 Sep 2025 21:05:17 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cN97K5BVbz3y2b; Thu, 11 Sep 2025 21:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757624717; 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=U3vFnp0ls2dtD7r84ILSZh3nxvqPjs9lctZ5YHMlxbs=; b=TdlTOAd2H0l5hEwUzIWZ2u9AHAff4uN6CrpQPgrux9U2jl0a8cMiIWJKyV4MDjEnqCM6po PoGKGSi+v5Uro8P864oLFqJpSbR1SI9+I6GiQFbhnOE0Wcv+AjvDnTXOCB72d1jVuYhHCO kl12WxLhj7UuX8OF9LvjAlkWvpv7FV6bsnyY58A1mstPP+K8RvBKGKHDnKoEb5FBLnM3BG OyUzSrKyOAPUTwiL6lB+6w7ii0KZSLu83hecleBK5rCko61w7yUSjcn7z1ue/VXTxIkfbT nebWrkEF12mPCmsFyRf8HFumUyyUGuPM2C799B0mxr8Af89KiSTZ+60BpHRkxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757624717; 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=U3vFnp0ls2dtD7r84ILSZh3nxvqPjs9lctZ5YHMlxbs=; b=RjfdbZmpg0ClnF0CdmnrkeNvx7H+dIIxzKbvLuUrAO9nmPIVDkhIFtQH+MWXVFYZuzgf4E xJ7QmqCgtkUO1ZUmluXxYSXZHgZZI3KqDcnrm/BXPgAD8EbZVpRyu+e31pRL5+0HSoy0U9 m11T2tEdIfRyG29IqPamDxpiUVOe46bz5vMpfbthcOmipQv179rY5P8jRO9kOPsF4E1fxv 6QV+xaBA19KV8zb1ujsfUsoM7KMw8U4jhYRRpkmP3PTQj7LrO8fpYSKKUERF8R+wQkWNAI Tm88GOqW0auosYz5VGHrO1wvoAzH0NH8jc0oNEmm27njNRLq8OLiZ+GY436cuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757624717; a=rsa-sha256; cv=none; b=AaEZKLGSUmhdjWHq3O6dNY+TXG/dTQNWwb3QKIYUxuLRdHBgbFT2jqXgMkM874JYY6+kuC MsTgJGJ5L2YfdojU53xBOsi+y9fPbJFUJQwtLqs0ZsUeZGFPsZHCkneOgDtHEfiCdkvKdR BJmNhGEt9YTMok4SBHfvw7g7+1MC4RiwA/LFvgzzvnTdZqFphw0lBzE6+KpLJPKKN92Wyw hYedqAG3hnB8ph2y+6SQvzXAX8wC2w8Y9pJGdgAfk2YQrZ8LwsOioJYspi6gD8nyR8LsNO cWQf3IicW8HTL+RAJr6qB5lZB5XXrs1gx3qYLGL7yuteA0/V2KOB9FT+RZKYmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cN97K4SXFz7nZ; Thu, 11 Sep 2025 21:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58BL5H6d047447; Thu, 11 Sep 2025 21:05:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58BL5Hbm047444; Thu, 11 Sep 2025 21:05:17 GMT (envelope-from git) Date: Thu, 11 Sep 2025 21:05:17 GMT Message-Id: <202509112105.58BL5Hbm047444@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: 1014003c538c - main - Revert "linux: fix reporting NL_RTM_DELLINK to Netlink sockets" 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/main X-Git-Reftype: branch X-Git-Commit: 1014003c538ccf8b258c9f0b11c0c131573a63cf Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1014003c538ccf8b258c9f0b11c0c131573a63cf commit 1014003c538ccf8b258c9f0b11c0c131573a63cf Author: Gleb Smirnoff AuthorDate: 2025-09-11 21:02:51 +0000 Commit: Gleb Smirnoff CommitDate: 2025-09-11 21:02:51 +0000 Revert "linux: fix reporting NL_RTM_DELLINK to Netlink sockets" I received a report that certain Linux application would crash on a message of a departure of an interface with FreeBSD name. Looks like dropping NL_RTM_DELLINK is a lesser evil than relay them with FreeBSD names. This reverts commit 554907bac3b264863a051f75eedc35d180d3e18c. --- sys/compat/linux/linux_netlink.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/sys/compat/linux/linux_netlink.c b/sys/compat/linux/linux_netlink.c index 927f3689e2b6..6aeafe84adc6 100644 --- a/sys/compat/linux/linux_netlink.c +++ b/sys/compat/linux/linux_netlink.c @@ -241,10 +241,25 @@ nlmsg_copy_nla(const struct nlattr *nla_orig, struct nl_writer *nw) return (false); } +/* + * Translate a FreeBSD interface name to a Linux interface name. + */ +static bool +nlmsg_translate_ifname_nla(struct nlattr *nla, struct nl_writer *nw) +{ + char ifname[LINUX_IFNAMSIZ]; + + if (ifname_bsd_to_linux_name((char *)(nla + 1), ifname, + sizeof(ifname)) <= 0) + return (false); + return (nlattr_add_string(nw, IFLA_IFNAME, ifname)); +} + +#define LINUX_NLA_UNHANDLED -1 /* * Translate a FreeBSD attribute to a Linux attribute. - * Returns false when the attribute is not processed and the caller must take - * care of it. + * Returns LINUX_NLA_UNHANDLED when the attribute is not processed + * and the caller must take care of it, otherwise the result is returned. */ static int nlmsg_translate_all_nla(struct nlmsghdr *hdr, struct nlattr *nla, @@ -256,27 +271,22 @@ nlmsg_translate_all_nla(struct nlmsghdr *hdr, struct nlattr *nla, case NL_RTM_DELLINK: case NL_RTM_GETLINK: switch (nla->nla_type) { - case IFLA_IFNAME: { - char ifname[LINUX_IFNAMSIZ]; - - if (ifname_bsd_to_linux_name((char *)(nla + 1), ifname, - sizeof(ifname)) > 0) - return (true); - break; - } + case IFLA_IFNAME: + return (nlmsg_translate_ifname_nla(nla, nw)); default: break; } default: break; } - return (false); + return (LINUX_NLA_UNHANDLED); } static bool nlmsg_copy_all_nla(struct nlmsghdr *hdr, int raw_hdrlen, struct nl_writer *nw) { struct nlattr *nla; + int ret; int hdrlen = NETLINK_ALIGN(raw_hdrlen); int attrs_len = hdr->nlmsg_len - sizeof(struct nlmsghdr) - hdrlen; @@ -287,12 +297,15 @@ nlmsg_copy_all_nla(struct nlmsghdr *hdr, int raw_hdrlen, struct nl_writer *nw) if (nla->nla_len < sizeof(struct nlattr)) { return (false); } - if (!nlmsg_translate_all_nla(hdr, nla, nw) && - !nlmsg_copy_nla(nla, nw)) + ret = nlmsg_translate_all_nla(hdr, nla, nw); + if (ret == LINUX_NLA_UNHANDLED) + ret = nlmsg_copy_nla(nla, nw); + if (!ret) return (false); } return (true); } +#undef LINUX_NLA_UNHANDLED static unsigned int rtnl_if_flags_to_linux(unsigned int if_flags)