From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202410 header.b=ZMIs0xGD; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 1F3165A0624 for ; Tue, 12 Nov 2024 05:06:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1731384378; bh=mgu92n1Xx9i1xmGXA7ecc6zl7Xs0wiFOW5RYcHZs2m4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZMIs0xGDEywQuguNSsNmam76ZSWWfhJoDM8CjVACE/QbEkta1izaZJV1YMqTaaVUR PfreXvbmyGJU6fEnJGB2XnyupFvc7PPpz/UIwsAMEvpa43I/SH/ukzJQPO4ngx9jrE amloHVNmmpfZMIkAL/7VvgUXvMN4a7Yc5LeVP9kqKlkCf6PK8tcnyjNB7Spw1PoFVx WBydn5L7xL16RXaUCGubCPZbtW+oLqPpKAZbiNzwMth8ChTTMp6d38Z/nTZZI/ArKO 5Hu1gfRtxFQDHnEVnK99666bqNR0tkOBQLORnIBpdfbGmZbOmxfhk+DcBZY5ZLG+cq 7ZeSGMa+cpLcg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XnXsQ24jKz4wcn; Tue, 12 Nov 2024 15:06:18 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/6] ndp: Remove redundant update to addr_seen Date: Tue, 12 Nov 2024 15:06:13 +1100 Message-ID: <20241112040618.1804081-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112040618.1804081-1-david@gibson.dropbear.id.au> References: <20241112040618.1804081-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: MEMDXGXOANMIAPVU4EAOXFCSL7L4KTO4 X-Message-ID-Hash: MEMDXGXOANMIAPVU4EAOXFCSL7L4KTO4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ndp() updates addr_seen or addr_ll_seen based on the source address of the received packet. This is redundant since tap6_handler() has already updated addr_seen for any type of packet, not just NDP. Signed-off-by: David Gibson --- ndp.c | 9 ++------- ndp.h | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ndp.c b/ndp.c index faae408..ab80898 100644 --- a/ndp.c +++ b/ndp.c @@ -179,8 +179,8 @@ struct ndp_ns { * * Return: 0 if not handled here, 1 if handled, -1 on failure */ -int ndp(struct ctx *c, const struct icmp6hdr *ih, const struct in6_addr *saddr, - const struct pool *p) +int ndp(const struct ctx *c, const struct icmp6hdr *ih, + const struct in6_addr *saddr, const struct pool *p) { struct ndp_na na = { .ih = { @@ -336,11 +336,6 @@ dns_done: return 1; } - if (IN6_IS_ADDR_LINKLOCAL(saddr)) - c->ip6.addr_ll_seen = *saddr; - else - c->ip6.addr_seen = *saddr; - rsaddr = &c->ip6.our_tap_ll; if (ih->icmp6_type == NS) { diff --git a/ndp.h b/ndp.h index a786441..abe6d02 100644 --- a/ndp.h +++ b/ndp.h @@ -6,7 +6,7 @@ #ifndef NDP_H #define NDP_H -int ndp(struct ctx *c, const struct icmp6hdr *ih, const struct in6_addr *saddr, - const struct pool *p); +int ndp(const struct ctx *c, const struct icmp6hdr *ih, + const struct in6_addr *saddr, const struct pool *p); #endif /* NDP_H */ -- 2.47.0