public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Bug 181 & bug 182
@ 2025-12-10  7:02 David Gibson
  2025-12-10  7:02 ` [PATCH 1/2] tcp: Correct timer expiry value in trace message David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Gibson @ 2025-12-10  7:02 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

These are fixes for two regressions in the latest release.

David Gibson (2):
  tcp: Correct timer expiry value in trace message
  pif: Correctly set scope_id for guest-side link local addresses

 pif.c | 10 +++++++---
 tcp.c | 10 +++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] tcp: Correct timer expiry value in trace message
  2025-12-10  7:02 [PATCH 0/2] Bug 181 & bug 182 David Gibson
@ 2025-12-10  7:02 ` David Gibson
  2025-12-10  7:02 ` [PATCH 2/2] pif: Correctly set scope_id for guest-side link local addresses David Gibson
  2025-12-10 13:36 ` [PATCH 0/2] Bug 181 & bug 182 Stefano Brivio
  2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2025-12-10  7:02 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

000601ba8 ("tcp: Adaptive interval based on RTT for socket-side
acknowledgement checks") added (amongst other things) a new trace message
showing the expiry time for the TCP timer in ms rather than s.

Unfortunately there were some arithmetic errors in the message, meaning it
will print incorrect numbers.  Correct them

Fixes: 000601ba86da ("tcp: Adaptive interval based on RTT for socket-side acknowledgement checks")
Link: https://bugs.passt.top/show_bug.cgi?id=182

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tcp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tcp.c b/tcp.c
index 8dabfd30..ce36bbd3 100644
--- a/tcp.c
+++ b/tcp.c
@@ -626,11 +626,11 @@ static void tcp_timer_ctl(const struct ctx *c, struct tcp_tap_conn *conn)
 	}
 
 	if (conn->flags & ACK_TO_TAP_DUE) {
-		flow_trace(conn, "timer expires in %llu.%03llums",
-			   (unsigned long)it.it_value.tv_sec * 1000 +
-			   (unsigned long long)it.it_value.tv_nsec %
-					       ((long)1000 * 1000),
-			   (unsigned long long)it.it_value.tv_nsec / 1000);
+		flow_trace(conn, "timer expires in %llu.%02llums",
+			   (unsigned long long)it.it_value.tv_sec * 1000 +
+			   it.it_value.tv_nsec / 1000 / 1000,
+			   (unsigned long long)it.it_value.tv_nsec
+			   / 1000 / 10 % 100);
 	} else {
 		flow_dbg(conn, "timer expires in %llu.%03llus",
 			 (unsigned long long)it.it_value.tv_sec,
-- 
2.52.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] pif: Correctly set scope_id for guest-side link local addresses
  2025-12-10  7:02 [PATCH 0/2] Bug 181 & bug 182 David Gibson
  2025-12-10  7:02 ` [PATCH 1/2] tcp: Correct timer expiry value in trace message David Gibson
@ 2025-12-10  7:02 ` David Gibson
  2025-12-10 13:36 ` [PATCH 0/2] Bug 181 & bug 182 Stefano Brivio
  2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2025-12-10  7:02 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

pif_sockaddr() is supposed to generate a suitable socket address, either
for the host, or for the guest, depending on the 'pif' parameter.  When
given a link-local address, this means it needs to generate a suitable
scope_id to specify which link.  It does this for the host, but not for the
guest.

I think this was done on the assumption that we won't ever generate guest
side link local addresses when forwarding connections.  That, however, is
not the case, at least with the recent extensions to "local mode".  Fix the
problem by properly populating the scope_id field for guest addresses.

Link: https://bugs.passt.top/show_bug.cgi?id=181
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 pif.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pif.c b/pif.c
index 3d7a90e5..6ae970a0 100644
--- a/pif.c
+++ b/pif.c
@@ -50,10 +50,14 @@ void pif_sockaddr(const struct ctx *c, union sockaddr_inany *sa,
 		sa->sa_family = AF_INET6;
 		sa->sa6.sin6_addr = addr->a6;
 		sa->sa6.sin6_port = htons(port);
-		if (pif == PIF_HOST && IN6_IS_ADDR_LINKLOCAL(&addr->a6))
-			sa->sa6.sin6_scope_id = c->ifi6;
-		else
+		if (IN6_IS_ADDR_LINKLOCAL(&addr->a6)) {
+			if (pif == PIF_HOST)
+				sa->sa6.sin6_scope_id = c->ifi6;
+			else if (pif == PIF_SPLICE)
+				sa->sa6.sin6_scope_id = c->pasta_ifi;
+		} else {
 			sa->sa6.sin6_scope_id = 0;
+		}
 		sa->sa6.sin6_flowinfo = 0;
 	}
 }
-- 
2.52.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Bug 181 & bug 182
  2025-12-10  7:02 [PATCH 0/2] Bug 181 & bug 182 David Gibson
  2025-12-10  7:02 ` [PATCH 1/2] tcp: Correct timer expiry value in trace message David Gibson
  2025-12-10  7:02 ` [PATCH 2/2] pif: Correctly set scope_id for guest-side link local addresses David Gibson
@ 2025-12-10 13:36 ` Stefano Brivio
  2 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2025-12-10 13:36 UTC (permalink / raw)
  To: David Gibson; +Cc: passt-dev

On Wed, 10 Dec 2025 18:02:55 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> These are fixes for two regressions in the latest release.
> 
> David Gibson (2):
>   tcp: Correct timer expiry value in trace message
>   pif: Correctly set scope_id for guest-side link local addresses

Applied!

-- 
Stefano


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-10 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10  7:02 [PATCH 0/2] Bug 181 & bug 182 David Gibson
2025-12-10  7:02 ` [PATCH 1/2] tcp: Correct timer expiry value in trace message David Gibson
2025-12-10  7:02 ` [PATCH 2/2] pif: Correctly set scope_id for guest-side link local addresses David Gibson
2025-12-10 13:36 ` [PATCH 0/2] Bug 181 & bug 182 Stefano Brivio

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).