public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 1/8] ndp: Remove redundant update to addr_seen
Date: Thu, 14 Nov 2024 14:33:03 +1100	[thread overview]
Message-ID: <20241114033310.2926316-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20241114033310.2926316-1-david@gibson.dropbear.id.au>

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 <david@gibson.dropbear.id.au>
---
 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 */
-- 
@@ -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


  reply	other threads:[~2024-11-14  3:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14  3:33 [PATCH v2 0/8] ndp: Unsolicited RAs David Gibson
2024-11-14  3:33 ` David Gibson [this message]
2024-11-14  3:33 ` [PATCH v2 2/8] ndp: Add ndp_send() helper David Gibson
2024-11-14  3:33 ` [PATCH v2 3/8] ndp: Split out helpers for sending specific NDP message types David Gibson
2024-11-14  3:33 ` [PATCH v2 4/8] ndp: Use struct assignment in preference to memcpy() for IPv6 addresses David Gibson
2024-11-14  3:33 ` [PATCH v2 5/8] ndp: Make route lifetime a #define David Gibson
2024-11-14  3:33 ` [PATCH v2 6/8] util: Add general low-level random bytes helper David Gibson
2024-11-14  3:33 ` [PATCH v2 7/8] passt: Seed libc's pseudo random number generator David Gibson
2024-11-14  3:33 ` [PATCH v2 8/8] ndp: Send unsolicited Router Advertisements David Gibson
2024-11-14 18:18 ` [PATCH v2 0/8] ndp: Unsolicited RAs Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241114033310.2926316-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).