[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: shutdown(2)'ing a bound UDP socket
On 15/07/2020 13:00, Peter J. Philipp wrote:
I'm the author of delphinusdnsd, a lightweight dns server. I develop on
OpenBSD but produce ports to Linux, FreeBSD and NetBSD. My latest code I
have ported to Linux and FreeBSD successfully, but NetBSD is not working.
What I do in my code is I bind (with SO_REUSEPORT option) two UDP descriptors
on the same port and shutdown(2) one of those (called dup) in the receive
setting (SHUT_RD). This allows me to read off the non-shut descriptor but
send packets on either, it works out well on OpenBSD. However while NetBSD
does allow shutting down the descriptor (unlike FreeBSD which has other
code to fix that problem it looks like), it does want to deliver incoming
queries to the shut descriptor. I get one answer from my server on NetBSD
and then it blocks. I tried patching this in kernel but it seems to be over
my head, I'm doing something wrong. Basically the socket should get a
SS_CANTRCVMORE state, but checking for this seems to be hard, plus I don't
know what I'M doing in the NetBSD kernel.
So I'm basically left of begging someone to fix this functionality to skip
shutdown(2)'ed bound reading sockets and let the ones that do read receive
Otherwise this may be my last year of supporting NetBSD unfortunately. I
would like to give a donation but I'm dirt poor, as gesture I can maybe
afford five euros or something, but can't find more. I have donated five USD
before in 2018, if it's worth any. I'm releasing version 1.5.0 between
september 2020 and november 2020, and I hope to continue NetBSD support, if
only in -current.
If you need to see my code to see what I'm doing you can get it at
https://delphinusdns.org/download/snapshot/delphinusdnsd-snapshot.tgz and the
relevant lines of code are in delphinusdnsd.c (main()) and go further into
forward.c. If you need a config file for the forwarding mode I can produce
you one on request.
Please CC me directly as I'm not on the tech-net%netbsd.org@localhost list.
Do you have a small test case for this that can reproduce the issue?
Main Index |
Thread Index |