From: Eric Wong <e@80x24.org>
To: dtas-all@nongnu.org
Subject: [PATCH] drop MSG_EOR for AF_UNIX + SOCK_SEQPACKET
Date: Mon, 4 Sep 2023 06:22:19 +0000 [thread overview]
Message-ID: <20230904062220.2054739-1-e@80x24.org> (raw)
Using MSG_EOR with these local sockets is not necessary, and
appears to trigger a truncation bug on OpenBSD 7.3.
Link: https://marc.info/?i=20230826020759.M335788@dcvr
---
lib/dtas/player/client_handler.rb | 2 +-
lib/dtas/unix_accepted.rb | 4 ++--
lib/dtas/unix_client.rb | 2 +-
test/test_unixserver.rb | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 2914fe7..3c5fe5d 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -564,7 +564,7 @@ def state_file_dump_async(io, sf)
rescue => e
res = "ERR dumping to #{xs(sf.path)} #{e.message}"
end
- io.to_io.send(res, Socket::MSG_EOR)
+ io.to_io.send(res, 0)
ensure
exit!(0)
end
diff --git a/lib/dtas/unix_accepted.rb b/lib/dtas/unix_accepted.rb
index a84eade..63d3ce0 100644
--- a/lib/dtas/unix_accepted.rb
+++ b/lib/dtas/unix_accepted.rb
@@ -17,7 +17,7 @@ def initialize(sock)
# returns :wait_readable on success
def emit(msg)
if @sbuf.empty?
- case rv = @to_io.sendmsg_nonblock(msg, Socket::MSG_EOR, exception: false)
+ case rv = @to_io.sendmsg_nonblock(msg, 0, exception: false)
when :wait_writable
@sbuf << msg
rv
@@ -34,7 +34,7 @@ def emit(msg)
# flushes pending data if it got buffered
def writable_iter
- case @to_io.sendmsg_nonblock(@sbuf[0], Socket::MSG_EOR, exception: false)
+ case @to_io.sendmsg_nonblock(@sbuf[0], 0, exception: false)
when :wait_writable then return :wait_writable
else
@sbuf.shift
diff --git a/lib/dtas/unix_client.rb b/lib/dtas/unix_client.rb
index 71f833c..8c73b7d 100644
--- a/lib/dtas/unix_client.rb
+++ b/lib/dtas/unix_client.rb
@@ -24,7 +24,7 @@ def initialize(path = self.class.default_path)
def req_start(args)
args = xs(args) if Array === args
- @to_io.send(args, Socket::MSG_EOR)
+ @to_io.send(args, 0)
end
def req_ok(args, timeout = nil)
diff --git a/test/test_unixserver.rb b/test/test_unixserver.rb
index 7e99b9e..c91354d 100644
--- a/test/test_unixserver.rb
+++ b/test/test_unixserver.rb
@@ -41,7 +41,7 @@ def test_server_loop
@srv.run_once # nothing
msgs = []
clients = []
- client.send("HELLO", Socket::MSG_EOR)
+ client.send("HELLO", 0)
@srv.run_once do |c, msg|
clients << c
msgs << msg
reply other threads:[~2023-09-04 6:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
List information: https://80x24.org/dtas/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230904062220.2054739-1-e@80x24.org \
--to=e@80x24.org \
--cc=dtas-all@nongnu.org \
/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://80x24.org/dtas.git/
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 read-only IMAP folder(s) and NNTP newsgroup(s).