Add a patch for NetBSD for the vendor/net2 crate.

NetBSD doesn't actually need the same workaround as OpenBSD and Haiku;
on the TCP level, the TCP_KEEPALIVE socket option is recognized.

Without this we saw

 13038     19 routinator CALL  setsockopt(0x15,0xffff,8,0x7d60bd3d62b4,4)
 13038     19 routinator RET   setsockopt 0
 13038     19 routinator CALL  setsockopt(0x15,6,8,0x7d60bd3d62b4,4)
 13038     19 routinator RET   setsockopt -1 errno 42 Protocol option not available

and '8' in the latter corresponds to the

from <netinet/tcp.h> if I'm not sorely mistaken.  Instead we end up
using TCP_KEEPIDLE, which works fine by the looks of it.
This commit is contained in:
Havard Eidnes 2020-12-11 18:14:34 +01:00
parent 84fc4b2193
commit e079b4436d
3 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,7 @@
DISTNAME= routinator-0.8.2
PKGNAME= ${DISTNAME:S/-rc/rc/}
PKGREVISION= 1
CATEGORIES= net
EXTRACT_SUFX= .tar.gz

View File

@ -796,3 +796,4 @@ SHA1 (ws2_32-sys-0.2.1.crate) = dae41c117c3746c05852b6ce72f17954e6d6dd8b
RMD160 (ws2_32-sys-0.2.1.crate) = 883038c3ec6db615e0c96f0788f1a24892a855b2
SHA512 (ws2_32-sys-0.2.1.crate) = 18356861fc595efe7d0180afb8ce7649da35a4f9ba456271d2068679ab258a861af32a2e016e241fbfbf5f6ef0eb33127b26eabfc11428af39506538faa4821f
Size (ws2_32-sys-0.2.1.crate) = 4697 bytes
SHA1 (patch-vendor_net2-0.2.36_src_ext.rs) = 7eac1cd01be00bcd63ea95e959a26d3f912fa97a

View File

@ -0,0 +1,16 @@
$NetBSD$
NetBSD doesn't actually need the same workaround as OpenBSD and Haiku;
on the TCP level, the TCP_KEEPALIVE socket option is recognized.
--- ../vendor/net2-0.2.36/src/ext.rs.orig 2020-09-07 17:29:04.000000000 +0000
+++ ../vendor/net2-0.2.36/src/ext.rs
@@ -668,7 +668,7 @@ impl<T: AsRawSocket> AsSock for T {
cfg_if! {
if #[cfg(any(target_os = "macos", target_os = "ios"))] {
use libc::TCP_KEEPALIVE as KEEPALIVE_OPTION;
- } else if #[cfg(any(target_os = "haiku", target_os = "netbsd", target_os = "openbsd"))] {
+ } else if #[cfg(any(target_os = "haiku", target_os = "openbsd"))] {
use libc::SO_KEEPALIVE as KEEPALIVE_OPTION;
} else if #[cfg(unix)] {
use libc::TCP_KEEPIDLE as KEEPALIVE_OPTION;