diff --git a/netcat-openbsd.changes b/netcat-openbsd.changes index b9c2dd9..f375c35 100644 --- a/netcat-openbsd.changes +++ b/netcat-openbsd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Dec 7 13:09:09 UTC 2020 - Cristian Rodríguez + +- Add port-select-on-connect.patch: if -s is given but not -p + do not select port at bind() but at connect() time. + ------------------------------------------------------------------- Mon Sep 9 18:48:35 UTC 2019 - Tomáš Chvátal diff --git a/netcat-openbsd.spec b/netcat-openbsd.spec index 347bd50..766d00e 100644 --- a/netcat-openbsd.spec +++ b/netcat-openbsd.spec @@ -1,7 +1,7 @@ # # spec file for package netcat-openbsd # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -39,6 +39,7 @@ Patch10: set-TCP-MD5SIG-correctly-for-client-connections.patch Patch11: destination-port-list.patch Patch12: use-flags-to-specify-listen-address.patch Patch13: misc-failures-and-features.patch +Patch14: port-select-on-connect.patch BuildRequires: pkgconfig BuildRequires: pkgconfig(libbsd) Provides: nc6 = %{version} diff --git a/port-select-on-connect.patch b/port-select-on-connect.patch new file mode 100644 index 0000000..2803a26 --- /dev/null +++ b/port-select-on-connect.patch @@ -0,0 +1,16 @@ +Index: netcat-openbsd-1.203/netcat.c +=================================================================== +--- netcat-openbsd-1.203.orig/netcat.c ++++ netcat-openbsd-1.203/netcat.c +@@ -1190,7 +1190,10 @@ remote_connect(const char *host, const c + ahints.ai_flags = AI_PASSIVE; + if ((error = getaddrinfo(sflag, pflag, &ahints, &ares))) + errx(1, "getaddrinfo: %s", gai_strerror(error)); +- ++#ifdef IP_BIND_ADDRESS_NO_PORT ++ if(sflag && !pflag) ++ setsockopt(s, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &on, sizeof(on)); ++#endif + if (bind(s, (struct sockaddr *)ares->ai_addr, + ares->ai_addrlen) < 0) + err(1, "bind failed");