From nobody Tue Jan 25 05:03:25 2022 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 1FF5F197B6FE; Tue, 25 Jan 2022 05:03:26 +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 4JjZW16Ljbz3KsR; Tue, 25 Jan 2022 05:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643087005; 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=+IYqKsjIoWM7DLwoCqUeczr62W10m3PZl2oari4kPwA=; b=uzI+on7QcltUZSq164eGd5BSdtbzeKTUFwEKTx/HuBMf7ubsQic7BRYRawodAmo4HNfYfD wqY+gbvHinqWsgun3QhVFkztYNcLKyE1v6Ad90U2vz2MFYoEuhtGwRBvr2tg40rHZkE0DZ pucevZpLgWs6hRWyOoIFIrSp0Eei4zwqmZlHFfe+CwVdA6hsGq36ZrFJlb18pcN4hH35yo 0GluUs0VhDKuU1j1CRtKtdOvFbZExF9jiYnW/6SN5QUTa9xRKH1Q7FfIgSE/RJD4qDqb7T Uu37S6Ze6eI6/fE9BDvW0dnabHYMjnID356V56afOzf7MI5FYxV2NJiPxSmO/A== 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 BBCEE23845; Tue, 25 Jan 2022 05:03:25 +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 20P53PE7023773; Tue, 25 Jan 2022 05:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20P53P0h023772; Tue, 25 Jan 2022 05:03:25 GMT (envelope-from git) Date: Tue, 25 Jan 2022 05:03:25 GMT Message-Id: <202201250503.20P53P0h023772@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: bc6abdd97e95 - main - nd6: use CARP link level address in SLLAO for NS sent out 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc6abdd97e951b54294d331698317a607246255d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643087005; 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=+IYqKsjIoWM7DLwoCqUeczr62W10m3PZl2oari4kPwA=; b=u2v5Jqg7yi1jwjuZwQjWSEMMH1jyZQDVlPhnL5egGtfAoZS4A/POWF9K1n0R8JDWEGoXJj MeUmF+c2Mkp/M4HA45tDta92MC05rsYyZZgNQ7R7IS3p2VO6FsQoAyZqZJwTWnZQ2aof5t 9wiQMDplG+KcBO24ajGt4i8LapixjGKRQ77H2wSEgdrX+0qIB7IH1txPnYzG7F1rVnRBZO EiwurdpW0D0589qaEExc9qBaTCqq7uwBuWba8K2LI6g+GcDBvCPKWiCZAOJ31niRi2OwFx NDuNts8ZdhMGTljhVRgL6FQee7evn1jTWHVlEgkc7MzE+aTbetYir7DEujfLDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643087005; a=rsa-sha256; cv=none; b=u+vrRyZq4Dx7flj/B7aS5RHyMO5Fpuv6P9rmdxKosysnNP4lP7s8/XVgIkwo/l46sHQCqf 7uwm2Eh82g8big+PgtWqbg4FIvMoHqYtn7KmpZ7ZtQI9fklj/oHMnVE9VQ/fGhxWrxa5qb oCMXC2VxfFuf2VfKaFQewcXsfXx5lXOIDYe7GybWdb/2iUCotqpf75XfIxXNiZUnaKZaHh X0QAY3duUEZ9pHFHZrWhdgUBWHLIJ0MKdcX+ff2YvT7vuBw4nmWR0dKJYWX93G75MEQUWZ A+vskpYbS7u3eHmvuwzHdRVuXUbX4coQfG3HwA54IQEGbwASvOdSk6/3JPSarg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=bc6abdd97e951b54294d331698317a607246255d commit bc6abdd97e951b54294d331698317a607246255d Author: Thomas Steen Rasmussen AuthorDate: 2022-01-25 05:02:47 +0000 Commit: Gleb Smirnoff CommitDate: 2022-01-25 05:02:47 +0000 nd6: use CARP link level address in SLLAO for NS sent out When sending an NS, check if we are using a IPv6 CARP address and if we do, then put proper CARP link level address into ND_OPT_SOURCE_LINKADDR option and also put PACKET_TAG_CARP tag on the packet. The latter will enforce CARP link level address at the data link layer too, which might be necessary for broken implementations. The code really follows what NA sending code has been doing since introduction of carp(4). While here, bring to style(9) the whole block of code. PR: 193280 Differential revision: https://reviews.freebsd.org/D33858 --- sys/netinet6/nd6_nbr.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 2100700733ad..0c6dd9e0361f 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -411,7 +411,6 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, struct ip6_moptions im6o; int icmp6len; int maxlen; - caddr_t mac; NET_EPOCH_ASSERT(); @@ -534,19 +533,30 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, * Multicast NS MUST add one add the option * Unicast NS SHOULD add one add the option */ - if (nonce == NULL && (mac = nd6_ifptomac(ifp))) { - int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; - struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_ns + 1); - /* 8 byte alignments... */ - optlen = (optlen + 7) & ~7; - - m->m_pkthdr.len += optlen; - m->m_len += optlen; - icmp6len += optlen; - bzero((caddr_t)nd_opt, optlen); - nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; - nd_opt->nd_opt_len = optlen >> 3; - bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen); + if (nonce == NULL) { + struct nd_opt_hdr *nd_opt; + char *mac; + int optlen; + + mac = NULL; + if (ifp->if_carp) + mac = (*carp_macmatch6_p)(ifp, m, &ip6->ip6_src); + if (mac == NULL) + mac = nd6_ifptomac(ifp); + + if (mac != NULL) { + nd_opt = (struct nd_opt_hdr *)(nd_ns + 1); + optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; + /* 8 byte alignments... */ + optlen = (optlen + 7) & ~7; + m->m_pkthdr.len += optlen; + m->m_len += optlen; + icmp6len += optlen; + bzero(nd_opt, optlen); + nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; + nd_opt->nd_opt_len = optlen >> 3; + bcopy(mac, nd_opt + 1, ifp->if_addrlen); + } } /* * Add a Nonce option (RFC 3971) to detect looped back NS messages.