<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/passt-repair.c, branch bug165c</title>
<subtitle>Plug A Simple Socket Transport</subtitle>
<link rel='alternate' type='text/html' href='https://passt.top/passt/'/>
<entry>
<title>build: Fix errors of TCP_REPAIR_* undeclared</title>
<updated>2025-09-02T07:31:27+00:00</updated>
<author>
<name>Yumei Huang</name>
<email>yuhuang@redhat.com</email>
</author>
<published>2025-09-02T02:17:28+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=eef5bb8035491de0d180a9e20d56b0277e363950'/>
<id>eef5bb8035491de0d180a9e20d56b0277e363950</id>
<content type='text'>
Based on an original patch by Dongsheng, fix the following errors on systems with glibc &lt; 2.29:

tcp.c: In function ‘tcp_flow_repair_on’:
tcp.c:2787:38: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function); did you mean ‘TCP_REPAIR’?
  if ((rc = repair_set(c, conn-&gt;sock, TCP_REPAIR_ON)))
                                      ^~~~~~~~~~~~~
                                      TCP_REPAIR
tcp.c:2787:38: note: each undeclared identifier is reported only once for each function it appears in
tcp.c: In function ‘tcp_flow_repair_off’:
tcp.c:2807:38: error: ‘TCP_REPAIR_OFF’ undeclared (first use in this function); did you mean ‘TCP_REPAIR’?
  if ((rc = repair_set(c, conn-&gt;sock, TCP_REPAIR_OFF)))
                                      ^~~~~~~~~~~~~~
                                      TCP_REPAIR
make: *** [Makefile:94: passt] Error 1

Link: https://bugs.passt.top/show_bug.cgi?id=121
Reported-by: Dongsheng &lt;dongsheng.song@gmail.com&gt;
Signed-off-by: Yumei Huang &lt;yuhuang@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Based on an original patch by Dongsheng, fix the following errors on systems with glibc &lt; 2.29:

tcp.c: In function ‘tcp_flow_repair_on’:
tcp.c:2787:38: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function); did you mean ‘TCP_REPAIR’?
  if ((rc = repair_set(c, conn-&gt;sock, TCP_REPAIR_ON)))
                                      ^~~~~~~~~~~~~
                                      TCP_REPAIR
tcp.c:2787:38: note: each undeclared identifier is reported only once for each function it appears in
tcp.c: In function ‘tcp_flow_repair_off’:
tcp.c:2807:38: error: ‘TCP_REPAIR_OFF’ undeclared (first use in this function); did you mean ‘TCP_REPAIR’?
  if ((rc = repair_set(c, conn-&gt;sock, TCP_REPAIR_OFF)))
                                      ^~~~~~~~~~~~~~
                                      TCP_REPAIR
make: *** [Makefile:94: passt] Error 1

Link: https://bugs.passt.top/show_bug.cgi?id=121
Reported-by: Dongsheng &lt;dongsheng.song@gmail.com&gt;
Signed-off-by: Yumei Huang &lt;yuhuang@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Fix missing newlines in error messages</title>
<updated>2025-06-06T08:46:29+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-05-23T13:10:06+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=bcb559600545498ae7598617ef82d2810937132c'/>
<id>bcb559600545498ae7598617ef82d2810937132c</id>
<content type='text'>
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Hide bogus gcc warning from -Og</title>
<updated>2025-04-30T14:58:58+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-04-30T14:48:34+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=ea0a1240df671de221f469327899564ed74b5edd'/>
<id>ea0a1240df671de221f469327899564ed74b5edd</id>
<content type='text'>
When building with gcc 13 and -Og, we get:

passt-repair.c: In function ‘main’:
passt-repair.c:161:23: warning: ‘ev’ may be used uninitialized [-Wmaybe-uninitialized]
  161 |                 if (ev-&gt;len &gt; NAME_MAX + 1 || ev-&gt;name[ev-&gt;len - 1] != '\0') {
      |                     ~~^~~~~

but that can't actually happen, because we only exit the preceding
while loop if 'found' is true, and that only happens, in turn, as we
assign 'ev'.

Get rid of the warning by (redundantly) initialising ev to NULL.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When building with gcc 13 and -Og, we get:

passt-repair.c: In function ‘main’:
passt-repair.c:161:23: warning: ‘ev’ may be used uninitialized [-Wmaybe-uninitialized]
  161 |                 if (ev-&gt;len &gt; NAME_MAX + 1 || ev-&gt;name[ev-&gt;len - 1] != '\0') {
      |                     ~~^~~~~

but that can't actually happen, because we only exit the preceding
while loop if 'found' is true, and that only happens, in turn, as we
assign 'ev'.

Get rid of the warning by (redundantly) initialising ev to NULL.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Ensure that read buffer is NULL-terminated</title>
<updated>2025-04-05T09:28:23+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-04-03T17:01:02+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=06784d7fc6761528d587837b241d27c6d17c0842'/>
<id>06784d7fc6761528d587837b241d27c6d17c0842</id>
<content type='text'>
After 3d41e4d83895 ("passt-repair: Correct off-by-one error verifying
name"), Coverity Scan isn't convinced anymore about the fact that the
ev-&gt;name used in the snprintf() is NULL-terminated.

It comes from a read() call, and read() of course doesn't terminate
it, but we already check that the byte at ev-&gt;len - 1 is a NULL
terminator, so this is actually a false positive.

In any case, the logic ensuring that ev-&gt;name is NULL-terminated isn't
necessarily obvious, and additionally checking that the last byte in
the buffer we read is a NULL terminator is harmless, so do that
explicitly, even if it's redundant.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After 3d41e4d83895 ("passt-repair: Correct off-by-one error verifying
name"), Coverity Scan isn't convinced anymore about the fact that the
ev-&gt;name used in the snprintf() is NULL-terminated.

It comes from a read() call, and read() of course doesn't terminate
it, but we already check that the byte at ev-&gt;len - 1 is a NULL
terminator, so this is actually a false positive.

In any case, the logic ensuring that ev-&gt;name is NULL-terminated isn't
necessarily obvious, and additionally checking that the last byte in
the buffer we read is a NULL terminator is harmless, so do that
explicitly, even if it's redundant.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Correct off-by-one error verifying name</title>
<updated>2025-04-02T06:29:42+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2025-04-02T04:43:40+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=3d41e4d8389578e5d5f3cf2e47b9ff9cdd29ffd1'/>
<id>3d41e4d8389578e5d5f3cf2e47b9ff9cdd29ffd1</id>
<content type='text'>
passt-repair will generate an error if the name it gets from the kernel is
too long or not NUL terminated.  Downstream testing has reported
occasionally seeing this error in practice.

In turns out there is a trivial off-by-one error in the check: ev-&gt;len is
the length of the name, including terminating \0 characters, so to check
for a \0 at the end of the buffer we need to check ev-&gt;name[len - 1] not
ev-&gt;name[len].

Fixes: 42a854a52b6f ("pasta, passt-repair: Support multiple events per read() in inotify handlers")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
passt-repair will generate an error if the name it gets from the kernel is
too long or not NUL terminated.  Downstream testing has reported
occasionally seeing this error in practice.

In turns out there is a trivial off-by-one error in the check: ev-&gt;len is
the length of the name, including terminating \0 characters, so to check
for a \0 at the end of the buffer we need to check ev-&gt;name[len - 1] not
ev-&gt;name[len].

Fixes: 42a854a52b6f ("pasta, passt-repair: Support multiple events per read() in inotify handlers")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pasta, passt-repair: Support multiple events per read() in inotify handlers</title>
<updated>2025-03-28T12:24:44+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-03-28T00:39:58+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=42a854a52b6fa2bbd70cbc0c7657c8a49a9c3d2d'/>
<id>42a854a52b6fa2bbd70cbc0c7657c8a49a9c3d2d</id>
<content type='text'>
The current code assumes that we'll get one event per read() on
inotify descriptors, but that's not the case, not from documentation,
and not from reports.

Add loops in the two inotify handlers we have, in pasta-specific code
and passt-repair, to go through all the events we receive.

Link: https://bugs.passt.top/show_bug.cgi?id=119
[dwg: Remove unnecessary buffer expansion, use strnlen instead of strlen
 to make Coverity happier]
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
[sbrivio: Add additional check on ev-&gt;name and ev-&gt;len in passt-repair]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current code assumes that we'll get one event per read() on
inotify descriptors, but that's not the case, not from documentation,
and not from reports.

Add loops in the two inotify handlers we have, in pasta-specific code
and passt-repair, to go through all the events we receive.

Link: https://bugs.passt.top/show_bug.cgi?id=119
[dwg: Remove unnecessary buffer expansion, use strnlen instead of strlen
 to make Coverity happier]
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
[sbrivio: Add additional check on ev-&gt;name and ev-&gt;len in passt-repair]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Fix build with -Werror=format-security</title>
<updated>2025-03-18T16:18:47+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-03-18T16:18:47+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=51f3c071a76bd20677e72b49007b822dca71e755'/>
<id>51f3c071a76bd20677e72b49007b822dca71e755</id>
<content type='text'>
Fixes: 04701702471e ("passt-repair: Add directory watch")
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes: 04701702471e ("passt-repair: Add directory watch")
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Add directory watch</title>
<updated>2025-03-12T20:34:36+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-03-07T22:27:03+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=04701702471ececee362669cc6b49ed9e20a1b6d'/>
<id>04701702471ececee362669cc6b49ed9e20a1b6d</id>
<content type='text'>
It might not be feasible for users to start passt-repair after passt
is started, on a migration target, but before the migration process
starts.

For instance, with libvirt, the guest domain (and, hence, passt) is
started on the target as part of the migration process. At least for
the moment being, there's no hook a libvirt user (including KubeVirt)
can use to start passt-repair before the migration starts.

Add a directory watch using inotify: if PATH is a directory, instead
of connecting to it, we'll watch for a .repair socket file to appear
in it, and then attempt to connect to that socket.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It might not be feasible for users to start passt-repair after passt
is started, on a migration target, but before the migration process
starts.

For instance, with libvirt, the guest domain (and, hence, passt) is
started on the target as part of the migration process. At least for
the moment being, there's no hook a libvirt user (including KubeVirt)
can use to start passt-repair before the migration starts.

Add a directory watch using inotify: if PATH is a directory, instead
of connecting to it, we'll watch for a .repair socket file to appear
in it, and then attempt to connect to that socket.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>repair, passt-repair: Build and warning fixes for musl</title>
<updated>2025-02-17T07:28:48+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-02-15T05:13:13+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=3e903bbb1f386ebb892b1196d339d2d705bce8a2'/>
<id>3e903bbb1f386ebb892b1196d339d2d705bce8a2</id>
<content type='text'>
Checked against musl 1.2.5.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Checked against musl 1.2.5.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Fix off-by-one in check for number of file descriptors</title>
<updated>2025-02-12T18:46:46+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2025-02-12T00:07:33+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=836fe215e049ee423750d3315a02742d8224eab2'/>
<id>836fe215e049ee423750d3315a02742d8224eab2</id>
<content type='text'>
Actually, 254 is too many, but 253 isn't.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Actually, 254 is too many, but 253 isn't.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
