Index | Thread | Search

From:
David Uhden Collado <david@uhden.dev>
Subject:
Re: Dealing with software using Linux TCP socket options
To:
jca@wxcvbn.org
Cc:
ports@openbsd.org
Date:
Sat, 24 Aug 2024 00:37:02 +0200

Download raw body.

Thread
>> Dear all,
>>
>> As mentioned in a previous email I sent to this mailing list [1], I am
>> currently working on porting SimpleXMQ and SimpleX Chat CLI to OpenBSD.
>> Unfortunately, I have encountered several challenges. In addition to the
>> issue I previously discussed [1], two more complications have arisen:
>>
>> 1. OpenSSL Requirement: It is necessary to use OpenSSL because,
>> unfortunately, LibreSSL does not support the encryption algorithms used by
>> this software.
> 
> README.md seems to say OpenSSL is needed for the server part.  I
> suspect it's about the lack of Ed448.  Do you know what else would be
> missing?

I have asked the developers what algorithms are missing from LibreSSL 
that prevent SimpleXMQ from working properly, but have not received a 
reply. I think that the situation with LibreSSL is similar to what 
happens with BSD Make: instead of testing their software with other 
implementations of Make, or making sure their Makefiles comply with the 
POSIX standard for portability, developers often just tell you to 
install and use GNU Make. It's always easier to push software 
monocultures than to embrace the diversity that exists. On the other 
hand, as I mentioned in my first email, SimpleXMQ is a dependency for 
both the server and the client.

> 
>> This issue seems to have a relatively straightforward
>> solution by installing OpenSSL from the ports tree and specifying the
>> location of these libraries in a cabal.project.local file located in the
>> root directory before compiling the software.
> 
> The LibreSSL developers try to keep the list of OpenSSL consumers in
> ports short, but yes, it is a possible approach.

I managed to compile SimpleXMQ version 6.0.1.0 without errors using 
LibreSSL version 3.9.0 with the patch mentioned at the end of this 
email. However, successfully building it is one thing, making sure it 
works properly is another. I have attempted to link the binaries with 
OpenSSL 1.1.1, which is available in the ports tree, by adding the 
location of these libraries to a cabal.project.local file. 
Unfortunately, I have not been able to link the binaries correctly with 
these libraries, and have encountered persistent errors related to the 
libraries not loading.

> 
>> 2. Linux TCP Socket Options: SimpleXMQ, on which the SimpleX Chat CLI client
>> depends, uses Linux-specific TCP socket options [2] that are not available
>> in OpenBSD [3], namely TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT. My
>> questions regarding this issue are:
>>
>>     - Why are these options not present in OpenBSD's TCP stack? Both FreeBSD
>> [4] and NetBSD [5] include them in their TCP stacks. Is there a specific
>> reason for their absence in OpenBSD?
> 
> I suspect nobody bothered to implement those options.  I think adding
> them would make sense.

I also think it would make sense to add these options to OpenBSD's TCP 
stack, but I have neither the cognitive ability to implement them nor 
the authority to decide on changes in OpenBSD.

> 
>>     - Is there an equivalent to these TCP socket options in OpenBSD? Are
>> there other ports facing similar issues? If so, how have they been patched
>> to function correctly in OpenBSD?
> 
> By patching out the relevant setsockopt(2) calls, or by hiding them
> behind #ifndef TCP_KEEPSOMETHING. Just use grep on the ports tree to
> see examples.
> 
>> For your reference, here is the source code file I am attempting to patch to
>> build SimpleXMQ on OpenBSD:
>>
>> https://github.com/simplex-chat/simplexmq/blob/stable/src/Simplex/Messaging/Transport/KeepAlive.hs
> 
> I guess you could just kill lines 65-67.

Thanks for your suggestion; it helped me create a patch to successfully 
compile SimpleXMQ on OpenBSD. I have submitted a pull request to the 
SimpleXMQ GitHub repository with the patch [1], but I doubt it will be 
accepted -- they will probably ignore it as they have so far. In the 
end, I may have to add the patch to the port myself.

> 
>> References:
>> 1. https://marc.info/?l=openbsd-ports&m=172387102027342&w=2
>> 2. https://www.man7.org/linux/man-pages/man7/tcp.7.html
>> 3. https://man.openbsd.org/tcp
>> 4. https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
>> 5. https://man.netbsd.org/tcp.4
>>
>> Thank you for your time and assistance.
>>
>> Best regards,
>> David.
>>
> 

References:

1. https://github.com/simplex-chat/simplexmq/pull/1273/files