From 8b27ecc75d6a5f1f6e33bc4fc8f884ad2cab949f Mon Sep 17 00:00:00 2001 From: devStorm <59678453+developStorm@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:01:36 -0800 Subject: [PATCH 1/2] fix: http_readlimit_test should reuse port --- modules/http/http_readlimit_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/http/http_readlimit_test.go b/modules/http/http_readlimit_test.go index 2d35056c..02d38587 100644 --- a/modules/http/http_readlimit_test.go +++ b/modules/http/http_readlimit_test.go @@ -1,6 +1,7 @@ package http import ( + "context" "crypto/rsa" "encoding/hex" "fmt" @@ -8,12 +9,14 @@ import ( "math/big" "net" "strings" + "syscall" "testing" "time" "github.com/zmap/zcrypto/tls" "github.com/zmap/zgrab2" "github.com/zmap/zgrab2/lib/http" + "golang.org/x/sys/unix" ) // BEGIN Taken from handshake_server_test.go -- certs for TLS server @@ -81,7 +84,18 @@ func _write(writer io.Writer, data []byte) error { // XXXX.... func (cfg *readLimitTestConfig) runFakeHTTPServer(t *testing.T) { endpoint := fmt.Sprintf("127.0.0.1:%d", cfg.port) - listener, err := net.Listen("tcp", endpoint) + lc := net.ListenConfig{ + Control: func(network, address string, c syscall.RawConn) error { + var opErr error + if err := c.Control(func(fd uintptr) { + opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) + }); err != nil { + return err + } + return opErr + }, + } + listener, err := lc.Listen(context.Background(), "tcp", endpoint) if err != nil { t.Fatal(err) } From a40f7db1ee61dd4495684daf896647c2ecc7fb14 Mon Sep 17 00:00:00 2001 From: devStorm <59678453+developStorm@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:03:51 -0800 Subject: [PATCH 2/2] build: downgrade ubuntu for python2 compatibility --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index f2d6d783..8c136508 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -37,7 +37,7 @@ jobs: integration-test: name: Integration Test - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Check out source uses: actions/checkout@v4