From nobody Mon Jan 23 22:11:50 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 4P14865mqRz2t0ds; Mon, 23 Jan 2023 22:11:50 +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 4P14862mqDz3KTH; Mon, 23 Jan 2023 22:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674511910; 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=WJdglznQ4pJhtixSFDhwHcUx1X3yz9Rt39SuHuuAW6c=; b=TbmovGcKulwsQotceFKCm6KxS03xuGjfoS2IbCh/hEixPBXDHMJnVfYVyLw1YDIRjr7yWr tZgqT32XPRwEeXB5VaETORnnjin7QvQLfgADvpfBP8sSdDDpo0NoHj1JTRlTtYJy0aJxtK Pmjc4cNY2sN8F7sya8P6iHBorgS+HUFjRuLae4t3YEsUauWI0MjJHEdptpEaow4LMeMbKg qQ7LCFbp3kyUqF06989uGSz1WRoOXni4KLKD7DPMrqp4C+ypNGTL89eC6bUUHXi5V3t3Pc Ij+4muX0CepaC8nSSZmgb5bmaSGhXLrXS+pW+H6p4igBGpCdwrXYJ8bIDLeQ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674511910; 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=WJdglznQ4pJhtixSFDhwHcUx1X3yz9Rt39SuHuuAW6c=; b=x1jX/4N9ndd4uh8zWJl+P67OE3of3G7WJVrDeDg8zummXy/1wdLImf0WX3fDBSiI/yV716 MdrcYNK2ir5RZ/HedoIOX7l0IrnnqodQkZTkPH0xOUseiDNUV71f2DXXQOfxlFtwHF01H9 ccWxQ3QRsHWpsc9A4lENRZ4E5ep7LwxYkN5XXdtvoTsXgdS+4NDZ1C6Hf24ErKy6KZNd2s RVzQvTbJqwAep6+roWDiqE8AvdOfZgHxGcYuNTLOrlIwK+69uU/XGZ3pNehAoM36SQBMh2 KFBWVPD1L5XTR8seHUwrmXgfM3TSsYkwwWCadi+jgX3EtPaPnpT1quhlSmCPzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674511910; a=rsa-sha256; cv=none; b=ZO7IaqdJOImM9T8TCaKJp3x+IX5dk/N50YLdgBD4QKU8t76jgsw0/DeBe4wy5zqkglnO9M LMY6ZE4N+eC+aRJQsZrB2USOFCXGhR8jiulUhs2pn1DIWYqd//er+KT5P1H2Bq5X5zlqrk /p7EAzTn1q8ZOAL9ASWuWaUPILun7BswQBiyhIvT/LboZj+Bk11LSP05blwYMVPyoaOvY+ lH98tekMMRsc/Y0QgM+OuDyiXVZBcHgyjhtcbBiY3UJocyMWugWIpn8JVrxOFgnJ0LtJyD 7lGniQHzZNJHbWyAIQPtrKEsF2b90/YfuBeRteRFqNMCV+BTqCCUNPotttTKPg== 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 4P14861tqDzlqy; Mon, 23 Jan 2023 22:11:50 +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 30NMBoci012609; Mon, 23 Jan 2023 22:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30NMBoWb012608; Mon, 23 Jan 2023 22:11:50 GMT (envelope-from git) Date: Mon, 23 Jan 2023 22:11:50 GMT Message-Id: <202301232211.30NMBoWb012608@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 77ba029133bd - stable/13 - netlink: make it working without INET6 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 77ba029133bdd714239a258e1c98cf5da0f84f52 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=77ba029133bdd714239a258e1c98cf5da0f84f52 commit 77ba029133bdd714239a258e1c98cf5da0f84f52 Author: Gleb Smirnoff AuthorDate: 2022-10-04 21:39:49 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-01-23 22:04:02 +0000 netlink: make it working without INET6 (cherry picked from commit b958b862b1f43f5fef881c1f9aee6618d7d24197) --- sys/netlink/route/iface.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 8bb4406ad8be..5ffe11cc7e80 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -196,21 +196,27 @@ dump_sa(struct nl_writer *nw, int attr, const struct sockaddr *sa) { uint32_t addr_len = 0; const void *addr_data = NULL; +#ifdef INET6 struct in6_addr addr6; +#endif if (sa == NULL) return (true); switch (sa->sa_family) { +#ifdef INET case AF_INET: addr_len = sizeof(struct in_addr); addr_data = &((const struct sockaddr_in *)sa)->sin_addr; break; +#endif +#ifdef INET6 case AF_INET6: in6_splitscope(&((const struct sockaddr_in6 *)sa)->sin6_addr, &addr6, &addr_len); addr_len = sizeof(struct in6_addr); addr_data = &addr6; break; +#endif case AF_LINK: addr_len = ((const struct sockaddr_dl *)sa)->sdl_alen; addr_data = LLADDR_CONST((const struct sockaddr_dl *)sa); @@ -563,6 +569,7 @@ ifa_get_scope(const struct ifaddr *ifa) sa = ifa->ifa_addr; switch (sa->sa_family) { +#ifdef INET case AF_INET: { struct in_addr addr; @@ -573,6 +580,8 @@ ifa_get_scope(const struct ifaddr *ifa) addr_scope = RT_SCOPE_LINK; break; } +#endif +#ifdef INET6 case AF_INET6: { const struct in6_addr *addr; @@ -583,6 +592,7 @@ ifa_get_scope(const struct ifaddr *ifa) addr_scope = RT_SCOPE_LINK; break; } +#endif } return (addr_scope); @@ -599,20 +609,28 @@ inet6_get_plen(const struct in6_addr *addr) static uint8_t get_sa_plen(const struct sockaddr *sa) { - const struct in6_addr *paddr6; +#ifdef INET const struct in_addr *paddr; +#endif +#ifdef INET6 + const struct in6_addr *paddr6; +#endif switch (sa->sa_family) { +#ifdef INET case AF_INET: if (sa == NULL) return (32); paddr = &(((const struct sockaddr_in *)sa)->sin_addr); return bitcount32(paddr->s_addr);; +#endif +#ifdef INET6 case AF_INET6: if (sa == NULL) return (128); paddr6 = &(((const struct sockaddr_in6 *)sa)->sin6_addr); return inet6_get_plen(paddr6); +#endif } return (0); @@ -718,12 +736,16 @@ rtnl_handle_ifaddr(void *arg __unused, struct ifaddr *ifa, int cmd) uint32_t group = 0; switch (ifa->ifa_addr->sa_family) { +#ifdef INET case AF_INET: group = RTNLGRP_IPV4_IFADDR; break; +#endif +#ifdef INET6 case AF_INET6: group = RTNLGRP_IPV6_IFADDR; break; +#endif default: NL_LOG(LOG_DEBUG2, "ifa notification for unknown AF: %d", ifa->ifa_addr->sa_family);