logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 001f7af9b5ce4bd05487be8c93dcdaaad94c876e
parent 0d1023ae1fbdc59f41269d0d05b8766870fb6767
Author: Michael Forney <mforney@mforney.org>
Date:   Mon,  2 Dec 2019 21:14:25 -0800

Build nc from openbsd sources instead of libressl

Diffstat:

Mpkg/libressl/gen.lua4----
Mpkg/openbsd/gen.lua12++++++++++++
Apkg/openbsd/patch/0031-nc-Portability-fixes-from-libressl-portable.patch194+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/openbsd/ver2+-
4 files changed, 207 insertions(+), 5 deletions(-)

diff --git a/pkg/libressl/gen.lua b/pkg/libressl/gen.lua @@ -353,8 +353,4 @@ exe('openssl', [[apps/openssl/( file('bin/openssl', '755', '$outdir/openssl') man{'apps/openssl/openssl.1'} -exe('nc', [[apps/nc/(netcat.c atomicio.c socks.c) libtls.a.d]]) -file('bin/nc', '755', '$outdir/nc') -man{'apps/nc/nc.1'} - fetch 'curl' diff --git a/pkg/openbsd/gen.lua b/pkg/openbsd/gen.lua @@ -45,6 +45,18 @@ man{'usr.bin/doas/doas.1', 'usr.bin/doas/doas.conf.5'} file('bin/fmt', '755', exe('fmt', {'usr.bin/fmt/fmt.c', 'libbsd.a'})) man{'usr.bin/fmt/fmt.1'} +-- nc +sub('nc.ninja', function() + cflags{'-I $builddir/pkg/libressl/include'} + exe('nc', [[ + usr.bin/nc/(netcat.c atomicio.c socks.c) + $builddir/pkg/libressl/libtls.a.d + libbsd.a + ]], {'pkg/libressl/headers'}) + file('bin/nc', '755', '$outdir/nc') + man{'usr.bin/nc/nc.1'} +end) + -- m4 yacc('usr.bin/m4/parser', 'usr.bin/m4/parser.y') cc('usr.bin/m4/tokenizer.c', {'$outdir/usr.bin/m4/parser.tab.h'}, {cflags='$cflags -I $outdir/usr.bin/m4'}) diff --git a/pkg/openbsd/patch/0031-nc-Portability-fixes-from-libressl-portable.patch b/pkg/openbsd/patch/0031-nc-Portability-fixes-from-libressl-portable.patch @@ -0,0 +1,194 @@ +From b1277303a902a8fffe4adb9bff8807800353280c Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 2 Dec 2019 21:11:04 -0800 +Subject: [PATCH] nc: Portability fixes from libressl-portable + +--- + usr.bin/nc/netcat.c | 55 +++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 7 deletions(-) + +diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c +index c04298f64c3..2509421093b 100644 +--- a/usr.bin/nc/netcat.c ++++ b/usr.bin/nc/netcat.c +@@ -93,9 +93,13 @@ int zflag; /* Port Scan Flag */ + int Dflag; /* sodebug */ + int Iflag; /* TCP receive buffer size */ + int Oflag; /* TCP send buffer size */ ++#ifdef TCP_MD5SIG + int Sflag; /* TCP MD5 signature option */ ++#endif + int Tflag = -1; /* IP Type of Service */ ++#ifdef SO_RTABLE + int rtableid = -1; ++#endif + + int usetls; /* use TLS */ + const char *Cflag; /* Public cert file */ +@@ -268,12 +272,14 @@ main(int argc, char *argv[]) + case 'u': + uflag = 1; + break; ++#ifdef SO_RTABLE + case 'V': + rtableid = (int)strtonum(optarg, 0, + RT_TABLEID_MAX, &errstr); + if (errstr) + errx(1, "rtable %s: %s", errstr, optarg); + break; ++#endif + case 'v': + vflag = 1; + break; +@@ -320,9 +326,11 @@ main(int argc, char *argv[]) + case 'o': + oflag = optarg; + break; ++#ifdef TCP_MD5SIG + case 'S': + Sflag = 1; + break; ++#endif + case 'T': + errstr = NULL; + errno = 0; +@@ -346,9 +354,11 @@ main(int argc, char *argv[]) + argc -= optind; + argv += optind; + ++#ifdef SO_RTABLE + if (rtableid >= 0) + if (setrtable(rtableid) == -1) + err(1, "setrtable"); ++#endif + + /* Cruft to make sure options are clean, and used properly. */ + if (argv[0] && !argv[1] && family == AF_UNIX) { +@@ -919,7 +929,10 @@ int + remote_connect(const char *host, const char *port, struct addrinfo hints) + { + struct addrinfo *res, *res0; +- int s = -1, error, on = 1, save_errno; ++ int s = -1, error, save_errno; ++#ifdef SO_BINDANY ++ int on = 1; ++#endif + + if ((error = getaddrinfo(host, port, &hints, &res0))) + errx(1, "getaddrinfo for host \"%s\" port %s: %s", host, +@@ -934,8 +947,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) + if (sflag || pflag) { + struct addrinfo ahints, *ares; + ++#ifdef SO_BINDANY + /* try SO_BINDANY, but don't insist */ + setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); ++#endif + memset(&ahints, 0, sizeof(struct addrinfo)); + ahints.ai_family = res->ai_family; + ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; +@@ -1006,8 +1021,11 @@ int + local_listen(const char *host, const char *port, struct addrinfo hints) + { + struct addrinfo *res, *res0; +- int s = -1, ret, x = 1, save_errno; ++ int s = -1, save_errno; + int error; ++#ifdef SO_REUSEPORT ++ int ret, x = 1; ++#endif + + /* Allow nodename to be null. */ + hints.ai_flags |= AI_PASSIVE; +@@ -1027,9 +1045,11 @@ local_listen(const char *host, const char *port, struct addrinfo hints) + res->ai_protocol)) == -1) + continue; + ++#ifdef SO_REUSEPORT + ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); + if (ret == -1) + err(1, NULL); ++#endif + + set_common_sockopts(s, res->ai_family); + +@@ -1499,11 +1519,13 @@ set_common_sockopts(int s, int af) + { + int x = 1; + ++#ifdef TCP_MD5SIG + if (Sflag) { + if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG, + &x, sizeof(x)) == -1) + err(1, NULL); + } ++#endif + if (Dflag) { + if (setsockopt(s, SOL_SOCKET, SO_DEBUG, + &x, sizeof(x)) == -1) +@@ -1514,9 +1536,16 @@ set_common_sockopts(int s, int af) + IP_TOS, &Tflag, sizeof(Tflag)) == -1) + err(1, "set IP ToS"); + ++#ifdef IPV6_TCLASS + else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, + IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1) + err(1, "set IPv6 traffic class"); ++#else ++ else if (af == AF_INET6) { ++ errno = ENOPROTOOPT; ++ err(1, "set IPv6 traffic class not supported"); ++ } ++#endif + } + if (Iflag) { + if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, +@@ -1540,13 +1569,17 @@ set_common_sockopts(int s, int af) + } + + if (minttl != -1) { ++#ifdef IP_MINTTL + if (af == AF_INET && setsockopt(s, IPPROTO_IP, + IP_MINTTL, &minttl, sizeof(minttl))) + err(1, "set IP min TTL"); ++#endif + +- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, ++#ifdef IPV6_MINHOPCOUNT ++ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, + IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) + err(1, "set IPv6 min hop count"); ++#endif + } + } + +@@ -1768,14 +1801,22 @@ help(void) + \t-P proxyuser\tUsername for proxy authentication\n\ + \t-p port\t Specify local port for remote connects\n\ + \t-R CAfile CA bundle\n\ +- \t-r Randomize remote ports\n\ +- \t-S Enable the TCP MD5 signature option\n\ ++ \t-r Randomize remote ports\n" ++#ifdef TCP_MD5SIG ++ "\ ++ \t-S Enable the TCP MD5 signature option\n" ++#endif ++ "\ + \t-s source Local source address\n\ + \t-T keyword TOS value or TLS options\n\ + \t-t Answer TELNET negotiation\n\ + \t-U Use UNIX domain socket\n\ +- \t-u UDP mode\n\ +- \t-V rtable Specify alternate routing table\n\ ++ \t-u UDP mode\n" ++#ifdef SO_RTABLE ++ "\ ++ \t-V rtable Specify alternate routing table\n" ++#endif ++ "\ + \t-v Verbose\n\ + \t-W recvlimit Terminate after receiving a number of packets\n\ + \t-w timeout Timeout for connects and final net reads\n\ +-- +2.24.0 + diff --git a/pkg/openbsd/ver b/pkg/openbsd/ver @@ -1 +1 @@ -6.6 r0 +6.6 r1