nc: new virtual package providing "netcat" functionality
PATCH 1/1 nc: new virtual package providing "netcat" functionality
Add the "nc" virtual package and modify netcat, netcat-openbsd and nmap to become providers.
Make the nmap recipe install "ncat" (with a symbolic link to nc) if the BR2_PACKAGE_NMAP_NCAT option is set. Other programs (ncat, ndiff, etc.) are still chosen via BR2_PACKAGE_NMAP, in the "Networking applications" menu.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double. Both lack features available in more modern netcats like IPv6, proxies, and Unix sockets.
--- package/Config.in | 3 +- package/nc/Config.in | 83 ++++++++++++++++++++++++++++++++ package/nc/nc.mk | 7 +++ package/netcat-openbsd/Config.in | 25 ---------- package/netcat-openbsd/netcat-openbsd.mk | 2 + package/netcat/Config.in | 13 ----- package/netcat/netcat.mk | 1 + package/nmap/nmap.mk | 30 +++++++++++- 8 files changed, 122 insertions(+), 42 deletions(-) create mode 100644 package/nc/Config.in create mode 100644 package/nc/nc.mk
package/Config.in +1 -2
@@ -1676,11 +1676,10 @@ menu "Networking applications" source "package/mrouted/Config.in" source "package/mtr/Config.in" source "package/nbd/Config.in" + source "package/nc/Config.in" source "package/ncftp/Config.in" source "package/ndisc6/Config.in" source "package/netatalk/Config.in" - source "package/netcat/Config.in" - source "package/netcat-openbsd/Config.in" source "package/netplug/Config.in" source "package/netsnmp/Config.in" source "package/netstat-nat/Config.in"
package/nc/Config.in new file +83 -0
83 lines not on this page · raw message
package/nc/nc.mk new file +7 -0
@@ -0,0 +1,7 @@ +################################################################################ +# +# nc +# +################################################################################ + +$(eval $(virtual-package))
package/netcat-openbsd/Config.in +0 -25
@@ -1,25 +0,0 @@ -config BR2_PACKAGE_NETCAT_OPENBSD - bool "netcat-openbsd" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on BR2_TOOLCHAIN_HAS_THREADS - depends on BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - select BR2_PACKAGE_LIBBSD - help - A simple Unix utility which reads and writes data across network - connections using TCP or UDP protocol. It is designed to be a - reliable "back-end" tool that can be used directly or easily driven - by other programs and scripts. At the same time it is a feature-rich - network debugging and exploration tool, since it can create almost - any kind of connection you would need and has several interesting - built-in capabilities. - - This package contains the OpenBSD rewrite of netcat, including - support for IPv6, proxies, and Unix sockets. - - https://packages.debian.org/sid/netcat-openbsd - -comment "netcat-openbsd needs a glibc toolchain w/ threads" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/netcat-openbsd/netcat-openbsd.mk +2 -0
@@ -8,6 +8,8 @@ NETCAT_OPENBSD_VERSION = debian/1.105-7 NETCAT_OPENBSD_SITE = git://anonscm.debian.org/collab-maint/netcat-openbsd NETCAT_OPENBSD_LICENSE = BSD-3-Clause NETCAT_OPENBSD_LICENSE_FILES = debian/copyright +NETCAT_OPENBSD_PROVIDES = nc + NETCAT_OPENBSD_DEPENDENCIES = host-pkgconf libbsd # Ensure Busybox gets built/installed before, so that this package
package/netcat/Config.in +0 -13
@@ -1,13 +0,0 @@ -config BR2_PACKAGE_NETCAT - bool "netcat" - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - help - Netcat is a featured networking utility which reads and writes data - across network connections, using the TCP/IP protocol. - It is designed to be a reliable "back-end" tool that can be used - directly or easily driven by other programs and scripts. At the - same time, it is a feature-rich network debugging and exploration - tool, since it can create almost any kind of connection you would - need and has several interesting built-in capabilities. - - http://netcat.sourceforge.net/download.php
package/netcat/netcat.mk +1 -0
@@ -8,5 +8,6 @@ NETCAT_VERSION = 0.7.1 NETCAT_SITE = http://downloads.sourceforge.net/project/netcat/netcat/$(NETCAT_VERSION) NETCAT_LICENSE = GPL-2.0+ NETCAT_LICENSE_FILES = COPYING +NETCAT_PROVIDES = nc $(eval $(autotools-package))
package/nmap/nmap.mk +28 -2
@@ -7,12 +7,14 @@ NMAP_VERSION = 7.40 NMAP_SITE = http://nmap.org/dist NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 -NMAP_DEPENDENCIES = libpcap pcre +NMAP_DEPENDENCIES = libpcap NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING +NMAP_PROVIDES = nc + # needed by libpcap NMAP_LIBS_FOR_STATIC_LINK += `$(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs`
@@ -35,6 +37,9 @@ else NMAP_CONF_OPTS += --without-openssl endif +ifeq ($(BR2_PACKAGE_NMAP),y) + +NMAP_DEPENDENCIES += pcre # ndiff only works with python2.x ifeq ($(BR2_PACKAGE_PYTHON),y) NMAP_DEPENDENCIES += python
@@ -42,4 +47,25 @@ else NMAP_CONF_OPTS += --without-ndiff endif +else # only ncat + +NMAP_CONF_OPTS += --without-ndiff --without-zenmap --without-nping --without-nmap-update +define NMAP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) build-ncat +endef +define NMAP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-ncat +endef + +endif + +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK +else +NMAP_CONF_OPTS += --without-ncat +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.5
PATCH v2 1/1 nc: new virtual package providing "netcat" functionality
Add the "nc" virtual package and modify netcat, netcat-openbsd and nmap to become providers.
Make the nmap recipe install "ncat" (with a symbolic link to nc) if the BR2_PACKAGE_NMAP_NCAT option is set. Other programs (ncat, ndiff, etc.) are still chosen via BR2_PACKAGE_NMAP, in the "Networking applications" menu.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double. Both lack features available in more modern netcats like IPv6, proxies, and Unix sockets.
---
Changes v1->v2:
- Prevent build error
Makefile:537: *** nmap is in the dependency chain of nc that has \
added it to its _DEPENDENCIES variable without selecting it or \
depending on it from Config.in. Stop.
---
package/Config.in | 3 +-
package/nc/Config.in | 84 ++++++++++++++++++++++++++++++++
package/nc/nc.mk | 7 +++
package/netcat-openbsd/Config.in | 25 ----------
package/netcat-openbsd/netcat-openbsd.mk | 2 +
package/netcat/Config.in | 13 -----
package/netcat/netcat.mk | 1 +
package/nmap/Config.in | 4 ++
package/nmap/nmap.mk | 30 +++++++++++-
9 files changed, 127 insertions(+), 42 deletions(-)
create mode 100644 package/nc/Config.in
create mode 100644 package/nc/nc.mkpackage/Config.in +1 -2
@@ -1676,11 +1676,10 @@ menu "Networking applications" source "package/mrouted/Config.in" source "package/mtr/Config.in" source "package/nbd/Config.in" + source "package/nc/Config.in" source "package/ncftp/Config.in" source "package/ndisc6/Config.in" source "package/netatalk/Config.in" - source "package/netcat/Config.in" - source "package/netcat-openbsd/Config.in" source "package/netplug/Config.in" source "package/netsnmp/Config.in" source "package/netstat-nat/Config.in"
package/nc/Config.in new file +84 -0
84 lines not on this page · raw message
package/nc/nc.mk new file +7 -0
@@ -0,0 +1,7 @@ +################################################################################ +# +# nc +# +################################################################################ + +$(eval $(virtual-package))
package/netcat-openbsd/Config.in +0 -25
@@ -1,25 +0,0 @@ -config BR2_PACKAGE_NETCAT_OPENBSD - bool "netcat-openbsd" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on BR2_TOOLCHAIN_HAS_THREADS - depends on BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - select BR2_PACKAGE_LIBBSD - help - A simple Unix utility which reads and writes data across network - connections using TCP or UDP protocol. It is designed to be a - reliable "back-end" tool that can be used directly or easily driven - by other programs and scripts. At the same time it is a feature-rich - network debugging and exploration tool, since it can create almost - any kind of connection you would need and has several interesting - built-in capabilities. - - This package contains the OpenBSD rewrite of netcat, including - support for IPv6, proxies, and Unix sockets. - - https://packages.debian.org/sid/netcat-openbsd - -comment "netcat-openbsd needs a glibc toolchain w/ threads" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/netcat-openbsd/netcat-openbsd.mk +2 -0
@@ -8,6 +8,8 @@ NETCAT_OPENBSD_VERSION = debian/1.105-7 NETCAT_OPENBSD_SITE = git://anonscm.debian.org/collab-maint/netcat-openbsd NETCAT_OPENBSD_LICENSE = BSD-3-Clause NETCAT_OPENBSD_LICENSE_FILES = debian/copyright +NETCAT_OPENBSD_PROVIDES = nc + NETCAT_OPENBSD_DEPENDENCIES = host-pkgconf libbsd # Ensure Busybox gets built/installed before, so that this package
package/netcat/Config.in +0 -13
@@ -1,13 +0,0 @@ -config BR2_PACKAGE_NETCAT - bool "netcat" - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - help - Netcat is a featured networking utility which reads and writes data - across network connections, using the TCP/IP protocol. - It is designed to be a reliable "back-end" tool that can be used - directly or easily driven by other programs and scripts. At the - same time, it is a feature-rich network debugging and exploration - tool, since it can create almost any kind of connection you would - need and has several interesting built-in capabilities. - - http://netcat.sourceforge.net/download.php
package/netcat/netcat.mk +1 -0
@@ -8,5 +8,6 @@ NETCAT_VERSION = 0.7.1 NETCAT_SITE = http://downloads.sourceforge.net/project/netcat/netcat/$(NETCAT_VERSION) NETCAT_LICENSE = GPL-2.0+ NETCAT_LICENSE_FILES = COPYING +NETCAT_PROVIDES = nc $(eval $(autotools-package))
package/nmap/Config.in +4 -0
@@ -1,8 +1,12 @@ config BR2_PACKAGE_NMAP + bool + +config BR2_PACKAGE_NMAP_NMAP bool "nmap" depends on BR2_INSTALL_LIBSTDCPP depends on BR2_USE_MMU # fork() depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_NMAP select BR2_PACKAGE_LIBPCAP select BR2_PACKAGE_PCRE help
package/nmap/nmap.mk +28 -2
@@ -7,12 +7,14 @@ NMAP_VERSION = 7.40 NMAP_SITE = http://nmap.org/dist NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 -NMAP_DEPENDENCIES = libpcap pcre +NMAP_DEPENDENCIES = libpcap NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING +NMAP_PROVIDES = nc + # needed by libpcap NMAP_LIBS_FOR_STATIC_LINK += `$(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs`
@@ -35,6 +37,9 @@ else NMAP_CONF_OPTS += --without-openssl endif +ifeq ($(BR2_PACKAGE_NMAP_NMAP),y) + +NMAP_DEPENDENCIES += pcre # ndiff only works with python2.x ifeq ($(BR2_PACKAGE_PYTHON),y) NMAP_DEPENDENCIES += python
@@ -42,4 +47,25 @@ else NMAP_CONF_OPTS += --without-ndiff endif +else # only ncat + +NMAP_CONF_OPTS += --without-ndiff --without-zenmap --without-nping --without-nmap-update +define NMAP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) build-ncat +endef +define NMAP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-ncat +endef + +endif + +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK +else +NMAP_CONF_OPTS += --without-ncat +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.5
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
Add the "nc" virtual package and modify netcat, netcat-openbsd and nmap to become providers.
Make the nmap recipe install "ncat" (with a symbolic link to nc) if the BR2_PACKAGE_NMAP_NCAT option is set. Other programs (ncat, ndiff, etc.) are still chosen via BR2_PACKAGE_NMAP, in the "Networking applications" menu.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double. Both lack features available in more modern netcats like IPv6, proxies, and Unix sockets.
---
Changes v1->v2:
- Prevent build error
Makefile:537: *** nmap is in the dependency chain of nc that has \
added it to its _DEPENDENCIES variable without selecting it or \
depending on it from Config.in. Stop.
Changes v1->v2:
- Remove package/netcat-openbsd/Config.in (was left empty)
---
package/Config.in | 3 +-
package/nc/Config.in | 84 ++++++++++++++++++++++++++++++++
package/nc/nc.mk | 7 +++
package/netcat-openbsd/Config.in | 25 ----------
package/netcat-openbsd/netcat-openbsd.mk | 2 +
package/netcat/Config.in | 13 -----
package/netcat/netcat.mk | 1 +
package/nmap/Config.in | 4 ++
package/nmap/nmap.mk | 30 +++++++++++-
9 files changed, 127 insertions(+), 42 deletions(-)
create mode 100644 package/nc/Config.in
create mode 100644 package/nc/nc.mk
delete mode 100644 package/netcat-openbsd/Config.inpackage/Config.in +1 -2
@@ -1665,11 +1665,10 @@ menu "Networking applications" source "package/mrouted/Config.in" source "package/mtr/Config.in" source "package/nbd/Config.in" + source "package/nc/Config.in" source "package/ncftp/Config.in" source "package/ndisc6/Config.in" source "package/netatalk/Config.in" - source "package/netcat/Config.in" - source "package/netcat-openbsd/Config.in" source "package/netplug/Config.in" source "package/netsnmp/Config.in" source "package/netstat-nat/Config.in"
package/nc/Config.in new file +84 -0
84 lines not on this page · raw message
package/nc/nc.mk new file +7 -0
@@ -0,0 +1,7 @@ +################################################################################ +# +# nc +# +################################################################################ + +$(eval $(virtual-package))
package/netcat-openbsd/Config.in deleted +0 -25
@@ -1,25 +0,0 @@ -config BR2_PACKAGE_NETCAT_OPENBSD - bool "netcat-openbsd" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on BR2_TOOLCHAIN_HAS_THREADS - depends on BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - select BR2_PACKAGE_LIBBSD - help - A simple Unix utility which reads and writes data across network - connections using TCP or UDP protocol. It is designed to be a - reliable "back-end" tool that can be used directly or easily driven - by other programs and scripts. At the same time it is a feature-rich - network debugging and exploration tool, since it can create almost - any kind of connection you would need and has several interesting - built-in capabilities. - - This package contains the OpenBSD rewrite of netcat, including - support for IPv6, proxies, and Unix sockets. - - https://packages.debian.org/sid/netcat-openbsd - -comment "netcat-openbsd needs a glibc toolchain w/ threads" - depends on BR2_PACKAGE_LIBBSD_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/netcat-openbsd/netcat-openbsd.mk +2 -0
@@ -8,6 +8,8 @@ NETCAT_OPENBSD_VERSION = debian/1.105-7 NETCAT_OPENBSD_SITE = git://anonscm.debian.org/collab-maint/netcat-openbsd NETCAT_OPENBSD_LICENSE = BSD-3-Clause NETCAT_OPENBSD_LICENSE_FILES = debian/copyright +NETCAT_OPENBSD_PROVIDES = nc + NETCAT_OPENBSD_DEPENDENCIES = host-pkgconf libbsd # Ensure Busybox gets built/installed before, so that this package
package/netcat/Config.in +0 -13
@@ -1,13 +0,0 @@ -config BR2_PACKAGE_NETCAT - bool "netcat" - depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS - help - Netcat is a featured networking utility which reads and writes data - across network connections, using the TCP/IP protocol. - It is designed to be a reliable "back-end" tool that can be used - directly or easily driven by other programs and scripts. At the - same time, it is a feature-rich network debugging and exploration - tool, since it can create almost any kind of connection you would - need and has several interesting built-in capabilities. - - http://netcat.sourceforge.net/download.php
package/netcat/netcat.mk +1 -0
@@ -8,5 +8,6 @@ NETCAT_VERSION = 0.7.1 NETCAT_SITE = http://downloads.sourceforge.net/project/netcat/netcat/$(NETCAT_VERSION) NETCAT_LICENSE = GPL-2.0+ NETCAT_LICENSE_FILES = COPYING +NETCAT_PROVIDES = nc $(eval $(autotools-package))
package/nmap/Config.in +4 -0
@@ -1,8 +1,12 @@ config BR2_PACKAGE_NMAP + bool + +config BR2_PACKAGE_NMAP_NMAP bool "nmap" depends on BR2_INSTALL_LIBSTDCPP depends on BR2_USE_MMU # fork() depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_NMAP select BR2_PACKAGE_LIBPCAP select BR2_PACKAGE_PCRE help
package/nmap/nmap.mk +28 -2
@@ -7,12 +7,14 @@ NMAP_VERSION = 7.40 NMAP_SITE = http://nmap.org/dist NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 -NMAP_DEPENDENCIES = libpcap pcre +NMAP_DEPENDENCIES = libpcap NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING +NMAP_PROVIDES = nc + # needed by libpcap NMAP_LIBS_FOR_STATIC_LINK += `$(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs`
@@ -35,6 +37,9 @@ else NMAP_CONF_OPTS += --without-openssl endif +ifeq ($(BR2_PACKAGE_NMAP_NMAP),y) + +NMAP_DEPENDENCIES += pcre # ndiff only works with python2.x ifeq ($(BR2_PACKAGE_PYTHON),y) NMAP_DEPENDENCIES += python
@@ -42,4 +47,25 @@ else NMAP_CONF_OPTS += --without-ndiff endif +else # only ncat + +NMAP_CONF_OPTS += --without-ndiff --without-zenmap --without-nping --without-nmap-update +define NMAP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) build-ncat +endef +define NMAP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-ncat +endef + +endif + +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK +else +NMAP_CONF_OPTS += --without-ncat +endif + $(eval $(autotools-package))
Signature · 1 line
2.7.5
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
Hello,
Quoted 8 lines · Carlos Santos
Add the "nc" virtual package and modify netcat, netcat-openbsd and nmap to become providers.
Make the nmap recipe install "ncat" (with a symbolic link to nc) if the
BR2_PACKAGE_NMAP_NCAToption is set. Other programs (ncat, ndiff, etc.) are still chosen viaBR2_PACKAGE_NMAP, in the "Networking applications" menu.
Quoted 5 lines
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double. Both lack features available in more modern netcats like IPv6, proxies, and Unix sockets.
Signed-off-by Carlos Santos <[email protected]>
What is the benefit of having a virtual package for this ?
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
However, in the case of netcat, I don't see the point. Yes, you can currently enable several packages that provide the netcat functionality, and they will step on each other in some combinations.
But you can also enable several Web servers that will try to listen on port 80 at boot time, leaving only one functional, and still we're not going to have a "webserver" virtual package.
So, I don't see where the problem is, and therefore I don't think a solution is necessary :-)
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 12 lines
What is the benefit of having a virtual package for this ?
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
However, in the case of netcat, I don't see the point. Yes, you can currently enable several packages that provide the netcat functionality, and they will step on each other in some combinations.
Quoted 6 lines
But you can also enable several Web servers that will try to listen on port 80 at boot time, leaving only one functional, and still we're not going to have a "webserver" virtual package.
So, I don't see where the problem is, and therefore I don't think a solution is necessary :-)
FYI, this is my feeling as well. The current setup afaik only has issues if you enable more than one package providing a nc implementation (this solution fixes it by not allowing such setup), but I'm not sure if there's really a realistic use case where somebody would want to do this in the first place?
Signature · 1 line
Bye, Peter Korsgaard
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
Quoted 27 lines
From: "Peter Korsgaard" <[email protected]>
To: "Thomas Petazzoni" <[email protected]>
Cc: "Carlos Santos" <[email protected]>, "Maxime Hadjinlian" <[email protected]>, buildroot at buildroot.org
Sent: Monday, October 2, 2017 4:44:56 PM
Subject: Re: [PATCH v3] nc: new virtual package providing "netcat" functionalityQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 15 lines
What is the benefit of having a virtual package for this ?
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
However, in the case of netcat, I don't see the point. Yes, you can currently enable several packages that provide the netcat functionality, and they will step on each other in some combinations.
But you can also enable several Web servers that will try to listen on port 80 at boot time, leaving only one functional, and still we're not going to have a "webserver" virtual package.
Quoted 8 lines
Quoted 2 lines
So, I don't see where the problem is, and therefore I don't think a solution is necessary :-)
FYI, this is my feeling as well. The current setup afaik only has issues if you enable more than one package providing a nc implementation (this solution fixes it by not allowing such setup), but I'm not sure if there's really a realistic use case where somebody would want to do this in the first place?
I'm currenly working on porting libvirt to buildroor. It requires a modern "nc" command (with support for unix sockets) to provide remote access via ssh using virt-manager. Currently this is impossible with uClibc because openbsd-netcat depends on GLIBC.
At the same time I think it's waste of space to install the full nmap suite just to have one command.
By the way, nmap's ncat is the "nc" command used on Fedora Linux while Debian uses openbsd-netcat by default.
Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D ?The greatest triumph that modern PR can offer is the transcendent success of having your words and actions judged by your reputation, rather than the other way about.? ? Christopher Hitchens
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
In reply to Thomas PetazzoniQuoted 17 lines
From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Maxime Hadjinlian" <[email protected]>
Sent: Monday, October 2, 2017 4:18:40 PM
Subject: Re: [Buildroot] [PATCH v3] nc: new virtual package providing "netcat" functionalityHello,
Quoted 8 lines · Carlos Santos
Add the "nc" virtual package and modify netcat, netcat-openbsd and nmap to become providers.
Make the nmap recipe install "ncat" (with a symbolic link to nc) if the
BR2_PACKAGE_NMAP_NCAToption is set. Other programs (ncat, ndiff, etc.) are still chosen viaBR2_PACKAGE_NMAP, in the "Networking applications" menu.
Quoted 7 lines
Quoted 5 lines
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double. Both lack features available in more modern netcats like IPv6, proxies, and Unix sockets.
Signed-off-by Carlos Santos <[email protected]>What is the benefit of having a virtual package for this ?
My first solution just allowed the user to build and install ncat with a symlink to "nc".
Quoted 5 lines
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
There are three packages able to provide the "nc" command (four, if we count busybox). I want to allow the user to choose only one of them, unambiguously.
Quoted 3 lines
However, in the case of netcat, I don't see the point. Yes, you can currently enable several packages that provide the netcat functionality, and they will step on each other in some combinations.
The problem with this approach is that it does not prevent the user from selecting netcat and/or openbsd-netcat along with nmap, leading to the same tricky situation we have now with BusyBox, coreutils and util-linux, which compete for the ownership os some commands.
Right now the problem is solved (wiped down the carpet) by making coreutils depend on busybox, for instance, but this works just because the busybox install step does not override existing files.
Quoted 3 lines
But you can also enable several Web servers that will try to listen on port 80 at boot time, leaving only one functional, and still we're not going to have a "webserver" virtual package.
I'm following your own example: check luainterpreter, mysql and udev.
Quoted 2 lines
So, I don't see where the problem is, and therefore I don't think a solution is necessary :-)
I admit that is not mandatory but I still believe that it would lead to a more organized selection of packages/features.
Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D ?The greatest triumph that modern PR can offer is the transcendent success of having your words and actions judged by your reputation, rather than the other way about.? ? Christopher Hitchens
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
Hello Carlos,
Quoted 9 lines · Carlos Santos
Quoted 5 lines
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
There are three packages able to provide the "nc" command (four, if we count busybox). I want to allow the user to choose only one of them, unambiguously.
I'm sorry, but I really don't think we want to go down this route. As I explained, there are lots of other packages in Buildroot that conflict with each other. If you select two web servers, they will compete to bind to port 80. If you select two SSH servers, they will compete to bind to port 22. And so on and so on. We are not going to add virtual packages for all of those cases.
The only situation where virtual packages make sense is when we have multiple packages using an API provided by multiple packages (OpenGL, jpeg, etc.).
Quoted 5 lines
Quoted 3 lines
But you can also enable several Web servers that will try to listen on port 80 at boot time, leaving only one functional, and still we're not going to have a "webserver" virtual package.
I'm following your own example: check luainterpreter, mysql and udev.
All of those are providing an implementation to other packages:
- luainterpreter is used by all Lua modules, because they can support using different Lua interpreters
- mysql because it provides a client library that is used by numerous packages
- udev because it is provided either by systemd or by eudev, and is a library API used by a large number of packages.
So, I'm sorry but no, we are not going to add a virtual packages for netcat.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 nmap: add option to build/install "ncat"
Ncat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double (the openbsd-netcat package cannot be used because it requires GLIBC). Both lack features available in modern netcats like IPv6, proxies, and Unix sockets.
------
Changes v1->v2:
- Prevent build error
Makefile:537: *** nmap is in the dependency chain of nc that has \
added it to its _DEPENDENCIES variable without selecting it or \
depending on it from Config.in. Stop.
------
package/Config.in | 3 +-
package/nc/Config.in | 84 ++++++++++++++++++++++++++++++++
package/nc/nc.mk | 7 +++
package/netcat-openbsd/Config.in | 25 ----------
package/netcat-openbsd/netcat-openbsd.mk | 2 +
package/netcat/Config.in | 13 -----
package/netcat/netcat.mk | 1 +
package/nmap/Config.in | 4 ++
package/nmap/nmap.mk | 30 +++++++++++-
9 files changed, 127 insertions(+), 42 deletions(-)
create mode 100644 package/nc/Config.in
create mode 100644 package/nc/nc.mk
---
package/nmap/Config.in | 12 ++++++++++++
package/nmap/nmap.mk | 21 ++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)package/nmap/Config.in +12 -0
@@ -11,6 +11,18 @@ config BR2_PACKAGE_NMAP http://nmap.org +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NCAT + bool "nmap-ncat" + help + Ncat is a feature-packed networking utility which reads and + writes data across networks from the command line. Ncat was + written for the Nmap Project as a much-improved + reimplementation of the venerable Netcat. + +endif + comment "nmap needs a toolchain w/ C++, threads" depends on BR2_USE_MMU depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
package/nmap/nmap.mk +20 -1
@@ -10,7 +10,7 @@ NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 NMAP_DEPENDENCIES = libpcap pcre NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING
@@ -50,4 +50,23 @@ else NMAP_CONF_OPTS += --without-ndiff endif +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) + +# If both nmap-ncat and busybox are selected, make certain coreutils +# wins the fight over who gets to have their utils actually installed. +ifeq ($(BR2_PACKAGE_BUSYBOX),Y) +NMAP_DEPENDENCIES += busybox +endif + +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK + +else + +NMAP_CONF_OPTS += --without-ncat + +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH 1/1 nmap: add option to build/install "ncat"
Hi Carlos,
Quoted 70 lines · Carlos Santos
Ncat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double (the openbsd-netcat package cannot be used because it requires GLIBC). Both lack features available in modern netcats like IPv6, proxies, and Unix sockets.
Signed-off-by Carlos Santos <[email protected]>------
Changesv1->v2:
- Prevent build errorMakefile:537: *** nmap is in the dependency chain of nc that has \ added it to its _DEPENDENCIES variable without selecting it or \ depending on it from Config.in. Stop. ------ package/Config.in | 3 +- package/nc/Config.in | 84 ++++++++++++++++++++++++++++++++ package/nc/nc.mk | 7 +++ package/netcat-openbsd/Config.in | 25 ---------- package/netcat-openbsd/netcat-openbsd.mk | 2 + package/netcat/Config.in | 13 ----- package/netcat/netcat.mk | 1 + package/nmap/Config.in | 4 ++ package/nmap/nmap.mk | 30 +++++++++++- 9 files changed, 127 insertions(+), 42 deletions(-) create mode 100644 package/nc/Config.in create mode 100644 package/nc/nc.mk --- package/nmap/Config.in | 12 ++++++++++++ package/nmap/nmap.mk | 21 ++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)package/nmap/Config.in +12
-0@@ -11,6 +11,18 @@ config BR2_PACKAGE_NMAP http://nmap.org +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NCAT + bool "nmap-ncat" + help + Ncat is a feature-packed networking utility which reads and + writes data across networks from the command line. Ncat was + written for the Nmap Project as a much-improved + reimplementation of the venerable Netcat. + +endif + comment "nmap needs a toolchain w/ C++, threads" depends on BR2_USE_MMU depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)package/nmap/nmap.mk +1
-1@@ -10,7 +10,7 @@ NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 NMAP_DEPENDENCIES = libpcap pcre NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING
package/nmap/nmap.mk else · line 55
Quoted 6 lines
package/nmap/nmap.mk +3
-0@@ -50,4 +50,23 @@ else NMAP_CONF_OPTS += --without-ndiff endif +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) + +# If both nmap-ncat and busybox are selected, make certain coreutils
coreutils?
Quoted 7 lines
package/nmap/nmap.mk +7
-0+# wins the fight over who gets to have their utils actually installed. +ifeq ($(BR2_PACKAGE_BUSYBOX),Y) +NMAP_DEPENDENCIES += busybox +endif + +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc
package/nmap/nmap.mk else · line 72
Quoted 10 lines
package/nmap/nmap.mk +9
-0+endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK + +else + +NMAP_CONF_OPTS += --without-ncat + +endif + $(eval $(autotools-package))
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH v2 1/1 nmap: add option to build/install "ncat"
In reply to Carlos SantosNcat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc.
So far the "nc" options available to build with uClibc were the ancient GNU netcat and its Busybox double (the openbsd-netcat package cannot be used because it requires GLIBC). Both lack features available in modern netcats like IPv6, proxies, and Unix sockets.
---
Changes v1->v2:
- Add dependens on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS, like netcat does
- Remove forced dependence on busybox, since its installation script does not override existing programs.
--- package/nmap/Config.in | 13 +++++++++++++ package/nmap/nmap.mk | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
package/nmap/Config.in +13 -0
@@ -11,6 +11,19 @@ config BR2_PACKAGE_NMAP http://nmap.org +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NCAT + bool "nmap-ncat" + depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + help + Ncat is a feature-packed networking utility which reads and + writes data across networks from the command line. Ncat was + written for the Nmap Project as a much-improved + reimplementation of the venerable Netcat. + +endif + comment "nmap needs a toolchain w/ C++, threads" depends on BR2_USE_MMU depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
package/nmap/nmap.mk +14 -1
@@ -10,7 +10,7 @@ NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 NMAP_DEPENDENCIES = libpcap pcre NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING
@@ -50,4 +50,17 @@ else NMAP_CONF_OPTS += --without-ndiff endif +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) + +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK + +else + +NMAP_CONF_OPTS += --without-ncat + +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v2 1/1 nmap: add option to build/install "ncat"
Hi Carlos,
Sorry to iterate yet another time on this patch...
Quoted 4 lines · Carlos Santos
Ncat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc.
So far the "nc" options available to build with uClibc were the ancient
uClibc and musl.
Quoted 1 line
GNU netcat and its Busybox double (the openbsd-netcat package cannot be
The package is called netcat-openbsd.
Quoted 4 lines
used because it requires GLIBC). Both lack features available in modern netcats like IPv6, proxies, and Unix sockets.
Signed-off-by Carlos Santos <[email protected]>
[snip]
package/nmap/Config.in config BR2_PACKAGE_NMAP · line 17
Quoted 12 lines
package/nmap/Config.in +4
-0@@ -11,6 +11,19 @@ config BR2_PACKAGE_NMAP http://nmap.org +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NCAT + bool "nmap-ncat"
ncat itself is very small (+- 150K) compared to the rest of nmap (+- 2.5M), so
it's not really worth making a config option for it.
Conversely, it *could* be worthwhile to have an optionBR2_PACKAGE_NMAP_NCAT_ONLY that just installs the ncat tool (+symlink) from the package. So my idea would be:
- always build with ncat and install the symlink;
- if BR2_PACKAGE_NMAP_NCAT_ONLY is selected, override the install commands to just install ncat + symlink.
Perhaps to be sure you can do it as two patches, first one that always enables
ncat and installs symlink, second one that adds the BR2_PACKAGE_NMAP_NCAT_ONLY option. That kind of option is a bit controversial (it's a "negative" option because it removes stuff from the nmap package; we generally prefer additive options instead, but that would be a bit complicated here).
One more thing though: are the ncat options compatible with those for
netcat-openbsd? And I'm talking about the options that are not in busybox or GNU netcat now. If they are not compatible (and a quick look at the man pages tells me that only the -6 and -U options are the same), I feel awkward about creating the symlink: since you need to know which netcat type you're using, you could just as well call ncat directly. And for scripts that don't rely on any of these, the busybox or GNU nc is enough.
Regards,
Arnout
Quoted 44 lines
package/nmap/Config.in +9
-0+ depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + help + Ncat is a feature-packed networking utility which reads and + writes data across networks from the command line. Ncat was + written for the Nmap Project as a much-improved + reimplementation of the venerable Netcat. + +endif + comment "nmap needs a toolchain w/ C++, threads" depends on BR2_USE_MMU depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)package/nmap/nmap.mk +14
-1@@ -10,7 +10,7 @@ NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 NMAP_DEPENDENCIES = libpcap pcre NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING@@ -50,4 +50,17 @@ else NMAP_CONF_OPTS += --without-ndiff endif +ifeq ($(BR2_PACKAGE_NMAP_NCAT),y) + +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK + +else + +NMAP_CONF_OPTS += --without-ncat + +endif + $(eval $(autotools-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 nmap: add option to build/install "ncat"
Quoted 10 lines
From: "Arnout Vandecappelle" <[email protected]>
To: "Carlos Santos" <[email protected]>, buildroot at buildroot.org
Cc: "Thomas Petazzoni" <[email protected]>, "Maxime Hadjinlian" <[email protected]>
Sent: Friday, October 6, 2017 4:58:19 PM
Subject: Re: [Buildroot] [PATCH v2] nmap: add option to build/install "ncat"Hi Carlos,
Sorry to iterate yet another time on this patch...
Quoted 7 lines
Quoted 4 lines · Carlos Santos
Ncat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc.
So far the "nc" options available to build with uClibc were the ancient
uClibc and musl.
OK
Quoted 3 lines
Quoted 1 line
GNU netcat and its Busybox double (the openbsd-netcat package cannot be
The package is called netcat-openbsd.
OK
Quoted 29 lines
Quoted 4 lines
used because it requires GLIBC). Both lack features available in modern netcats like IPv6, proxies, and Unix sockets.
Signed-off-by Carlos Santos <[email protected]>[snip]
package/nmap/Config.in config BR2_PACKAGE_NMAP · line 17
Quoted 12 lines
package/nmap/Config.in +4
-0@@ -11,6 +11,19 @@ config BR2_PACKAGE_NMAP http://nmap.org +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NCAT + bool "nmap-ncat"ncat itself is very small (+- 150K) compared to the rest of nmap (+- 2.5M), so it's not really worth making a config option for it.
Conversely, it *could* be worthwhile to have an option
BR2_PACKAGE_NMAP_NCAT_ONLYthat just installs the ncat tool (+symlink) from the package. So my idea would be:- always build with ncat and install the symlink;
- ifBR2_PACKAGE_NMAP_NCAT_ONLYis selected, override the install commands to just install ncat + symlink.
Quoted 5 lines
Perhaps to be sure you can do it as two patches, first one that always enables ncat and installs symlink, second one that adds the
BR2_PACKAGE_NMAP_NCAT_ONLYoption. That kind of option is a bit controversial (it's a "negative" option because it removes stuff from the nmap package; we generally prefer additive options instead, but that would be a bit complicated here).
That's what I did in https://patchwork.ozlabs.org/patch/820503/.
I can give it a another try but I hope you guys reach an agreement about what you want. :-)
Quoted 7 lines
One more thing though: are the ncat options compatible with those for netcat-openbsd? And I'm talking about the options that are not in busybox or GNU netcat now. If they are not compatible (and a quick look at the man pages tells me that only the -6 and -U options are the same), I feel awkward about creating the symlink: since you need to know which netcat type you're using, you could just as well call ncat directly. And for scripts that don't rely on any of these, the busybox or GNU nc is enough.
This diversity is already known. Debian/Ubuntu uses netcat-openbsd as its nc command while Fedora/RHEL uses nmap-ncat. The user of "nc" that I have in mind is virt-manager, which is used to manage libvirtd (check https://patchwork.ozlabs.org/patch/814396/).
virt-manager accesses the target machine via ssh and there it runs nc connect to the unix socket on which libvirtd listens. The connection script tests what syntax the nc command recognizes.
Obviously the same restrictions would apply to any software depending on nc but already happens, since buildroot provides three different nc commands, so I do not consider the diversity a regression.
Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D ?The greatest triumph that modern PR can offer is the transcendent success of having your words and actions judged by your reputation, rather than the other way about.? ? Christopher Hitchens
PATCH v2 1/1 nmap: add option to build/install "ncat"
On 09-10-17 18:13, Carlos Santos wrote:
[snip]
Quoted 17 lines
Quoted 11 lines
ncat itself is very small (+- 150K) compared to the rest of nmap (+- 2.5M), so it's not really worth making a config option for it.
Conversely, it *could* be worthwhile to have an option
BR2_PACKAGE_NMAP_NCAT_ONLYthat just installs the ncat tool (+symlink) from the package. So my idea would be:- always build with ncat and install the symlink;
- ifBR2_PACKAGE_NMAP_NCAT_ONLYis selected, override the install commands to just install ncat + symlink.Quoted 5 lines
Perhaps to be sure you can do it as two patches, first one that always enables ncat and installs symlink, second one that adds the
BR2_PACKAGE_NMAP_NCAT_ONLYoption. That kind of option is a bit controversial (it's a "negative" option because it removes stuff from the nmap package; we generally prefer additive options instead, but that would be a bit complicated here).
Quoted 3 lines
That's what I did in https://patchwork.ozlabs.org/patch/820503/.
I can give it a another try but I hope you guys reach an agreement about what you want. :-)
Well, that patch (and its v1 and v2) introduced a virtual package for nc and
AFAICS you only got comments on the virtual package aspect. I don't think anybody commented on having a BR2_PACKAGE_NMAP_NCAT_ONLY option. You anyway didn't have that, you had a BR2_PACKAGE_NMAP_NMAP option, but I don't think you got any direct comments on that choice.
That said, it's indeed a good idea to converge on the right approach upfront.
Thomas, Peter, what do you think? I'm also adding Yann in Cc, he usually has bright ideas about this kind of thing. The options (that I see):
1. Current patch, i.e. BR2_PACKAGE_NMAP builds just nmap and BR2_PACKAGE_NMAP_NCAT builds nmap + ncat.
2. No specific option, always install nmap + ncat if BR2_PACKAGE_NMAP is selected. Note that this might create a problem if both nmap and netcat-openbsd are selected, so there should probably be a dependency introduced and a check that nc doesn't exist yet before creating the symlink.
3. BR2_PACKAGE_NMAP_NCAT_ONLY *disables* nmap.
4. New option BR2_PACKAGE_NMAP_NMAP to build nmap (this option should default y for backward compatibility). ncat is always built if BR2_PACKAGE_NMAP is selected. So BR2_PACKAGE_NMAP means ncat, and BR2_PACKAGE_NMAP_NMAP means nmap + ncat.
5. BR2_PACKAGE_NMAP builds nothing, two new options BR2_PACKAGE_NMAP_NMAP and BR2_PACKAGE_NMAP_NCAT build nmap resp. ncat. To avoid building nothing, you could try something like
config BR2_PACKAGE_NMAP
select BR2_PACKAGE_NMAP_NCAT if !BR2_PACKAGE_NMAP_NMAP
if BR2_PACKAGE_NMAP
config BR2_PACKAGE_NMAP_NMAP
default y
config BR2_PACKAGE_NMAP_NCAT
endif
but that might give a circular dependency.
Quoted 13 lines
Quoted 7 lines
One more thing though: are the ncat options compatible with those for netcat-openbsd? And I'm talking about the options that are not in busybox or GNU netcat now. If they are not compatible (and a quick look at the man pages tells me that only the -6 and -U options are the same), I feel awkward about creating the symlink: since you need to know which netcat type you're using, you could just as well call ncat directly. And for scripts that don't rely on any of these, the busybox or GNU nc is enough.
This diversity is already known. Debian/Ubuntu uses netcat-openbsd as its nc command while Fedora/RHEL uses nmap-ncat. The user of "nc" that I have in mind is virt-manager, which is used to manage libvirtd (check https://patchwork.ozlabs.org/patch/814396/).
Quoted 7 lines
virt-manager accesses the target machine via ssh and there it runs nc connect to the unix socket on which libvirtd listens. The connection script tests what syntax the nc command recognizes.
Obviously the same restrictions would apply to any software depending on nc but already happens, since buildroot provides three different nc commands, so I do not consider the diversity a regression.
OK, makes sense. Perhaps you can add something like this to the commit log.
We symlink 'nc' to ncat, even though ncat does not have the same interface as netcat-openbsd. However, since Fedora/RHEL install nmap-ncat as 'nc', it can be assumed that packages that depend on 'nc' know how to deal with this diversity. For example, the virt-manager package does that. Also user-supplied scripts can be assumed to do the right thing, since the user also selects whether nmap-ncat or netcat-openbsd is installed.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 nmap: add option to build/install "ncat"
Quoted 4 lines · Arnout Vandecappelle
2. No specific option, always install nmap + ncat if
BR2_PACKAGE_NMAPis selected. Note that this might create a problem if both nmap and netcat-openbsd are selected, so there should probably be a dependency introduced and a check that nc doesn't exist yet before creating the symlink.
Let me clarify that bit: in all the other options, the user makes a conscious
decision to enable ncat (and therefore the nc symlink). With this option, however, the nc symlink will be created without the user being aware of it, so it could be that it is not what the user intended. This is only a problem if netcat-openbsd is also installed (since ncat is a strict superset of GNU and busybox nc).
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 nmap: add option to build/install "ncat"
Quoted 13 lines
From: "Arnout Vandecappelle" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Thomas Petazzoni" <[email protected]>, "Maxime Hadjinlian" <[email protected]>, "Peter Korsgaard" <[email protected]>, "Yann E. MORIN" <[email protected]>
Sent: Monday, October 9, 2017 7:10:55 PM
Subject: Re: [Buildroot] [PATCH v2] nmap: add option to build/install "ncat"Quoted 4 lines · Arnout Vandecappelle
2. No specific option, always install nmap + ncat if
BR2_PACKAGE_NMAPis selected. Note that this might create a problem if both nmap and netcat-openbsd are selected, so there should probably be a dependency introduced and a check that nc doesn't exist yet before creating the symlink.
Quoted 6 lines
Let me clarify that bit: in all the other options, the user makes a conscious decision to enable ncat (and therefore the nc symlink). With this option, however, the nc symlink will be created without the user being aware of it, so it could be that it is not what the user intended. This is only a problem if netcat-openbsd is also installed (since ncat is a strict superset of GNU and busybox nc).
That was one of the advantages of the virtual package "nc": it would require the user to choose only one netcat variant at a time.
Anyway, I can make the link creation optional or create it only if none of the competing netcat variants is selected.
Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D ?The greatest triumph that modern PR can offer is the transcendent success of having your words and actions judged by your reputation, rather than the other way about.? ? Christopher Hitchens
PATCH v2 1/1 nmap: add option to build/install "ncat"
Quoted 20 lines · Carlos Santos
Quoted 13 lines
From: "Arnout Vandecappelle" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Thomas Petazzoni" <[email protected]>, "Maxime Hadjinlian" <[email protected]>, "Peter Korsgaard" <[email protected]>, "Yann E. MORIN" <[email protected]>
Sent: Monday, October 9, 2017 7:10:55 PM
Subject: Re: [Buildroot] [PATCH v2] nmap: add option to build/install "ncat"Quoted 4 lines · Arnout Vandecappelle
2. No specific option, always install nmap + ncat if
BR2_PACKAGE_NMAPis selected. Note that this might create a problem if both nmap and netcat-openbsd are selected, so there should probably be a dependency introduced and a check that nc doesn't exist yet before creating the symlink.Quoted 6 lines
Let me clarify that bit: in all the other options, the user makes a conscious decision to enable ncat (and therefore the nc symlink). With this option, however, the nc symlink will be created without the user being aware of it, so it could be that it is not what the user intended. This is only a problem if netcat-openbsd is also installed (since ncat is a strict superset of GNU and busybox nc).
Quoted 5 lines
That was one of the advantages of the virtual package "nc": it would require the user to choose only one netcat variant at a time.
Anyway, I can make the link creation optional or create it only if none of the competing netcat variants is selected.
Good plan indeed.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 nmap: add option to build/install "ncat"
In reply to Arnout VandecappelleHello,
Quoted 7 lines · Arnout Vandecappelle
5.
BR2_PACKAGE_NMAPbuilds nothing, two new optionsBR2_PACKAGE_NMAP_NMAPandBR2_PACKAGE_NMAP_NCATbuild nmap resp. ncat. To avoid building nothing, you could try something likeconfig
BR2_PACKAGE_NMAP
selectBR2_PACKAGE_NMAP_NCATif !BR2_PACKAGE_NMAP_NMAP
Quoted 8 lines
if
BR2_PACKAGE_NMAP
configBR2_PACKAGE_NMAP_NMAP
default yconfig
BR2_PACKAGE_NMAP_NCAT
endifbut that might give a circular dependency.
This option has my preference. And it doesn't have a circular dependency, we use this construct in several places already.
One example:
config BR2_PACKAGE_ANDROID_TOOLS
bool "android-tools"
select BR2_PACKAGE_ANDROID_TOOLS_ADBD if \
!BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT && \
!BR2_PACKAGE_ANDROID_TOOLS_ADBif BR2_PACKAGE_ANDROID_TOOLS
config BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT
bool "fastboot"
config BR2_PACKAGE_ANDROID_TOOLS_ADB
bool "adb"
config BR2_PACKAGE_ANDROID_TOOLS_ADBD
bool "adbd"
endif
However, perhaps we should invert the select:
select BR2_PACKAGE_NMAP_NMAP if !BR2_PACKAGE_NMAP_NCAT
and drop the "default y" in BR2_PACKAGE_NMAP_NMAP. This way, we still have "nmap" enabled by default, and now allow the option to select ncat.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/1 nmap: add option to build/install "ncat"
Thomas, Carlos, Arnout, All,
On 2017-10-10 10:12 +0200, Thomas Petazzoni spake thusly:
Quoted 39 lines · Arnout Vandecappelle
Quoted 7 lines
5.
BR2_PACKAGE_NMAPbuilds nothing, two new optionsBR2_PACKAGE_NMAP_NMAPandBR2_PACKAGE_NMAP_NCATbuild nmap resp. ncat. To avoid building nothing, you could try something likeconfig
BR2_PACKAGE_NMAP
selectBR2_PACKAGE_NMAP_NCATif !BR2_PACKAGE_NMAP_NMAPQuoted 8 lines
if
BR2_PACKAGE_NMAP
configBR2_PACKAGE_NMAP_NMAP
default yconfig
BR2_PACKAGE_NMAP_NCAT
endifbut that might give a circular dependency.
This option has my preference. And it doesn't have a circular dependency, we use this construct in several places already.
One example:
config
BR2_PACKAGE_ANDROID_TOOLSbool "android-tools" select BR2_PACKAGE_ANDROID_TOOLS_ADBD if \ !BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT && \ !BR2_PACKAGE_ANDROID_TOOLS_ADBif
BR2_PACKAGE_ANDROID_TOOLSconfig
BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT
bool "fastboot"config
BR2_PACKAGE_ANDROID_TOOLS_ADB
bool "adb"config
BR2_PACKAGE_ANDROID_TOOLS_ADBD
bool "adbd"
Quoted 8 lines
endif
However, perhaps we should invert the select:
select
BR2_PACKAGE_NMAP_NMAPif !BR2_PACKAGE_NMAP_NCATand drop the "default y" in
BR2_PACKAGE_NMAP_NMAP. This way, we still have "nmap" enabled by default, and now allow the option to select ncat.
Since Arnout pulled me in the discussion, here is my stake at it: I second Thomas' position on this. ;-)
Regards,
Yann E. MORIN.
Quoted 7 lines
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 nmap: add option to build/install ncat
In reply to Carlos SantosNcat is a much-improved reimplementation of the venerable Netcat and is compatible with uClibc and musl. It provides features not available in the ancient GNU netcat and its Busybox double like IPv6, proxies, and Unix sockets.
Tha nmap package now installs ncat if the BR2_PACKAGE_NMAP_NCAT option is selected. The other programs (nmap, ndiff, etc.) are chosen via the BR2_PACKAGE_NMAP_NMAP option.
We symlink 'nc' to ncat if neiter netcat nor netcat-openbsd is selected, even though ncat does not have the same interface as netcat-openbsd. However, since Fedora/RHEL install nmap-ncat as 'nc', it can be assumed that packages that depend on 'nc' know how to deal with this diversity. For example, the virt-manager package does that. Also user-supplied scripts can be assumed to do the right thing, since the user also selects whether nmap-ncat, netcat or netcat-openbsd is installed.
---
Changes v1->v2:
- Add dependens on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS, like netcat does
- Remove forced dependence on busybox, since its installation script does not override existing programs.
Changes v2->v3:
- Use a better logic to select either ncat tools, nmap or both, as suggested by Arnout Vandecappelle and Thomas Petazzoni.
- Add a prominent comment about the symlink to 'nc', as suggested by Arnout.
--- package/nmap/Config.in | 27 ++++++++++++++++++++++++++- package/nmap/nmap.mk | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-)
package/nmap/Config.in +26 -1
@@ -4,6 +4,12 @@ config BR2_PACKAGE_NMAP depends on BR2_USE_MMU # fork() depends on BR2_TOOLCHAIN_HAS_THREADS select BR2_PACKAGE_LIBPCAP + select BR2_PACKAGE_NMAP_NMAP if !BR2_PACKAGE_NMAP_NCAT + +if BR2_PACKAGE_NMAP + +config BR2_PACKAGE_NMAP_NMAP + bool "install nmap tools" select BR2_PACKAGE_PCRE help Nmap ("Network Mapper") is a free and open source (license)
@@ -11,6 +17,25 @@ config BR2_PACKAGE_NMAP http://nmap.org -comment "nmap needs a toolchain w/ C++, threads" +config BR2_PACKAGE_NMAP_NCAT + bool "install ncat" + depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + help + Ncat is a feature-packed networking utility which reads and + writes data across networks from the command line. Ncat was + written for the Nmap Project as a much-improved + reimplementation of the venerable Netcat. + + If symlink to "nc" is installed if neither netcat or + netcat-openbsd is selected. + +comment "a symlink from ncat to 'nc' will be installed" + depends on BR2_PACKAGE_NMAP_NCAT + depends on !BR2_PACKAGE_NETCAT + depends on !BR2_PACKAGE_NETCAT_OPENBSD + +endif + +comment "nmap-nmap needs a toolchain w/ C++, threads" depends on BR2_USE_MMU depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
package/nmap/nmap.mk +30 -2
@@ -7,10 +7,10 @@ NMAP_VERSION = 7.40 NMAP_SITE = http://nmap.org/dist NMAP_SOURCE = nmap-$(NMAP_VERSION).tar.bz2 -NMAP_DEPENDENCIES = libpcap pcre +NMAP_DEPENDENCIES = libpcap NMAP_CONF_OPTS = --without-liblua --without-zenmap \ --with-libdnet=included --with-liblinear=included \ - --with-libpcre="$(STAGING_DIR)/usr" --without-ncat + --with-libpcre="$(STAGING_DIR)/usr" NMAP_LICENSE = GPL-2.0 NMAP_LICENSE_FILES = COPYING
@@ -35,6 +35,10 @@ else NMAP_CONF_OPTS += --without-openssl endif +ifeq ($(BR2_PACKAGE_NMAP_NMAP),y) + +NMAP_DEPENDENCIES += pcre + # ndiff only works with python2.x ifeq ($(BR2_PACKAGE_PYTHON),y) NMAP_DEPENDENCIES += python
@@ -42,4 +46,28 @@ else NMAP_CONF_OPTS += --without-ndiff endif +ifeq ($(BR2_PACKAGE_NMAP_NCAT),) +NMAP_CONF_OPTS += --without-ncat +endif + +else # only ncat + +NMAP_CONF_OPTS += --without-ndiff --without-zenmap --without-nping --without-nmap-update +define NMAP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) build-ncat +endef +define NMAP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-ncat +endef + +endif + +# Add a symlink to "nc" if none of the competing netcats is selected +ifeq ($(BR2_PACKAGE_NMAP_NCAT):$(BR2_PACKAGE_NETCAT)$(BR2_PACKAGE_NETCAT_OPENBSD),y:) +define NMAP_INSTALL_NCAT_SYMLINK + ln -fs ncat $(TARGET_DIR)/usr/bin/nc +endef +NMAP_POST_INSTALL_TARGET_HOOKS += NMAP_INSTALL_NCAT_SYMLINK +endif + $(eval $(autotools-package))
Signature · 1 line
2.7.5
PATCH v3 1/1 nc: new virtual package providing "netcat" functionality
In reply to Thomas PetazzoniQuoted 16 lines
From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Maxime Hadjinlian" <[email protected]>
Sent: Wednesday, October 4, 2017 6:20:08 AM
Subject: Re: [Buildroot] [PATCH v3] nc: new virtual package providing "netcat" functionalityHello Carlos,
Quoted 6 lines · Carlos Santos
Quoted 5 lines
Virtual packages are mainly useful when several variants of a given library provide the same API, but different implementations, and we have N consumers of this API. In such a case, a virtual package avoids having each consumer explicitly handle every possible provider of the API.
Quoted 5 lines
Quoted 3 lines
There are three packages able to provide the "nc" command (four, if we count busybox). I want to allow the user to choose only one of them, unambiguously.
I'm sorry, but I really don't think we want to go down this route.
---8<---
OK, I sent a smaller patch which simply adds an option to build/install ncat.
Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D ?The greatest triumph that modern PR can offer is the transcendent success of having your words and actions judged by your reputation, rather than the other way about.? ? Christopher Hitchens