[PATCH] gnu: Add hping.

  • Done
  • quality assurance status badge
Details
4 participants
  • Jakub K?dzio?ka
  • Leo Famulari
  • Marius Bakke
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Marius Bakke
Severity
normal
M
M
Marius Bakke wrote on 24 Oct 2017 08:06
(address . guix-patches@gnu.org)(name . Marius Bakke)(address . mbakke@fastmail.com)
20171024060636.30232-1-mbakke@fastmail.com
* gnu/packages/networking.scm (hping): New public variable.
---
gnu/packages/networking.scm | 67 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)

Toggle diff (101 lines)
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index a6c104297..4c1771459 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -18,6 +18,7 @@
;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
+;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -38,6 +39,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system gnu)
@@ -75,6 +77,7 @@
#:use-module (gnu packages qt)
#:use-module (gnu packages readline)
#:use-module (gnu packages ssh)
+ #:use-module (gnu packages tcl)
#:use-module (gnu packages textutils)
#:use-module (gnu packages tls)
#:use-module (gnu packages valgrind)
@@ -563,6 +566,70 @@ send out a ping packet and move on to the next target in a round-robin
fashion.")
(license license:expat)))
+(define-public hping
+ (let ((commit "3547c7691742c6eaa31f8402e0ccbb81387c1b99")
+ (revision "0"))
+ (package
+ (name "hping")
+ (version (string-append "3.0.0-" revision "-" (string-take commit 7)))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/antirez/hping")
+ (commit commit)))
+ (file-name (string-append name "-" version "-checkout"))
+ (sha256
+ (base32
+ "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'prepare-build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((tcl (assoc-ref inputs "tcl")))
+ ;; Search for bpf.h in the right place.
+ (substitute* '("libpcap_stuff.c" "script.c")
+ (("<net/bpf\\.h>") "<pcap/bpf.h>"))
+ ;; Likewise for TCL.
+ (substitute* "configure"
+ (("/usr/include/tcl.h")
+ (string-append tcl "/include/tcl.h"))
+ (("ls -1 /usr/local/lib")
+ (string-append "ls -1 " tcl "/lib")))
+ ;; Required environment variables.
+ (setenv "CC" "gcc")
+ (setenv "TCLSH" (which "tclsh"))
+ #t)))
+ (add-before 'install 'pre-install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (sbin (string-append out "/sbin"))
+ (man (string-append out "/share/man")))
+ (mkdir-p sbin)
+ (mkdir-p (string-append man "/man8"))
+ (substitute* "Makefile"
+ (("/usr/sbin") sbin)
+ (("\\$\\{INSTALL_MANPATH\\}") man))
+ ;; Fix references to wrong executable name.
+ (substitute* "docs/hping3.8"
+ (("hping2") "hping3")
+ (("HPING2") "HPING3"))
+ #t))))
+ #:tests? #f)) ;no tests
+ (inputs
+ `(("libpcap" ,libpcap)
+ ("tcl" ,tcl)))
+ (home-page "http://www.hping.org/")
+ (synopsis "Network testing tool")
+ (description
+ "hping is a command-line oriented TCP/IP packet assembler/analyzer.
+The interface is inspired by the @command{ping(8)} command, but hping isn't
+only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP
+protocols, has a traceroute mode, the ability to send files between a covered
+channel, and many other features.")
+ (license license:gpl2)))) ;strlcpy.c is BSD-3
+
(define-public httping
(package
(name "httping")
--
2.14.3
T
T
Tobias Geerinckx-Rice wrote on 24 Oct 2017 16:39
a53350b1-1742-dfcc-3c1c-827e53246dff@tobias.gr
Marius,

Marius Bakke wrote on 24/10/17 at 08:06:
Toggle quote (2 lines)
> * gnu/packages/networking.scm (hping): New public variable.

Nice. I like stuff that sends random packets and breaks things.

Toggle quote (54 lines)
> diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
> index a6c104297..4c1771459 100644
> --- a/gnu/packages/networking.scm
> +++ b/gnu/packages/networking.scm
> @@ -563,6 +566,70 @@ send out a ping packet and move on to the next target in a round-robin
> fashion.")
> (license license:expat)))
>
> +(define-public hping
> + (let ((commit "3547c7691742c6eaa31f8402e0ccbb81387c1b99")
> + (revision "0"))
> + (package
> + (name "hping")
> + (version (string-append "3.0.0-" revision "-" (string-take commit 7)))
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/antirez/hping")
> + (commit commit)))
> + (file-name (string-append name "-" version "-checkout"))
> + (sha256
> + (base32
> + "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb"))))
> + (build-system gnu-build-system)
> + (arguments
> + `(#:phases
> + (modify-phases %standard-phases
> + (add-before 'configure 'prepare-build
> + (lambda* (#:key inputs #:allow-other-keys)
> + (let ((tcl (assoc-ref inputs "tcl")))
> + ;; Search for bpf.h in the right place.
> + (substitute* '("libpcap_stuff.c" "script.c")
> + (("<net/bpf\\.h>") "<pcap/bpf.h>"))
> + ;; Likewise for TCL.
> + (substitute* "configure"
> + (("/usr/include/tcl.h")
> + (string-append tcl "/include/tcl.h"))
> + (("ls -1 /usr/local/lib")
> + (string-append "ls -1 " tcl "/lib")))
> + ;; Required environment variables.
> + (setenv "CC" "gcc")
> + (setenv "TCLSH" (which "tclsh"))
> + #t)))
> + (add-before 'install 'pre-install
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (sbin (string-append out "/sbin"))
> + (man (string-append out "/share/man")))
> + (mkdir-p sbin)
> + (mkdir-p (string-append man "/man8"))
> + (substitute* "Makefile"
> + (("/usr/sbin") sbin)
> + (("\\$\\{INSTALL_MANPATH\\}") man))

Adding (setenv "MANPATH" man) to 'prepare-build also works, and is
cleaner. There's no $SBINPATH, unfortunately.

Toggle quote (5 lines)
> + ;; Fix references to wrong executable name.
> + (substitute* "docs/hping3.8"
> + (("hping2") "hping3")
> + (("HPING2") "HPING3"))

Erk. I'm sending a quick PR upstream just for that. Simple substitution
isn't ideal: there are references to things like ‘HPING2-HOWTO’ and
‘editing hping2.h’ which — though dubious — shouldn't be changed.

- A question: that HPING2-HOWTO (sic: ‘this HOWTO is not completed and
in some points very silly’) is mentioned several times in the man page
but not installed. Any strong opinions?

- A side note: this package installs ‘hping3’ (the tool), with both
‘hping’ and ‘hping2’ as symlinks. There are no such symlinks to the man
page: users must type ‘man hping3’. I've added it to that PR[0].

Toggle quote (8 lines)
> + #t))))
> + #:tests? #f)) ;no tests
> + (inputs
> + `(("libpcap" ,libpcap)
> + ("tcl" ,tcl)))
> + (home-page "http://www.hping.org/")
> + (synopsis "Network testing tool")

is a tad (too) short. We should at least mention its purpose "to send
(almost) arbitrary packets".

Toggle quote (3 lines)
> + (description
> + "hping is a command-line oriented TCP/IP packet assembler/analyzer.

I don't see the nuance of ‘oriented’, and suggest dropping it. And hping
sends more than TCP/IP.

Toggle quote (3 lines)
> +The interface is inspired by the @command{ping(8)} command, but hping isn't
> +only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP

‘raw IP’.

Toggle quote (3 lines)
> +protocols, has a traceroute mode, the ability to send files between a covered
> +channel, and many other features.")

A misspelling of ‘covert channel’?

WDYTO:

"hping is a command-line IP packet assembler and analyzer.
While its interface is inspired by the @command{ping(8)} command,
hping does
more than just send ICMP echo requests. It supports the TCP, UDP,
ICMP, and
raw IP protocols, has a traceroute mode, the ability to send files
over a covert
channel, and many other features."

Toggle quote (2 lines)
> + (license license:gpl2)))) ;strlcpy.c is BSD-3

There's also display_ipopt.c, which looks like BSD-4.

Kind regards,

T G-R

L
L
Leo Famulari wrote on 13 Feb 2019 01:08
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 28964@debbugs.gnu.org)
20190213000859.GA2464@jasmine.lan
What is the status of this patch?

Can we push it? Or close the bug? It's been a little while...
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlxjYBsACgkQJkb6MLrK
fwgHgg/+Lm490Mm9YHrtkwCS0AHDphRaUgFUrajvRJbvmglrx1A8iFPrqGWPS2g7
l1keVAC4tLUjmB7BEDAnZgPw85kob3PAY05IDSXQk/NpT5rVGS8TkG/DtiItfjDc
//lzZJ8PN+nRVWrGQzg5Fn/AMVJKOu2erMVWk8O0aO9mYn83r/u+oFdUMHFYihqZ
E3SC6FnC/c6u1uoXodAmaKkMMN4hfKdVXKoM+3TlasPBK+mkzAU7ZlzaxDPCWF5p
WEtf/B9TdiOrRGrRBbgBrzlZT1xHLNSX/2hGNgTaY47ixpo9AMrLItXL894i0h4s
7gz/NiQv175koQ2hei8YA5wcstkgi6BO0kn/zYqU0EiL7/He7FnqzZM4O+NA1Wxt
U7lukxxFwVgxDeaLS6gWZ/tHKu2YPb8GRofkUuHcrWL0F16AogQ1xRyDDeXEj4Oa
zt4Ujy9fNrXMV9TKMrpwc80+UWad4uC5pvmtPIt2FsbICl4usyZ7ET4nr5d5BIok
Zpq8jVEUpoDfJYOX6STt6ybRRiJGGOvcY4VGCKTrfIYb+xmxUkWGpwj3IAnFOyLt
5yUWsTBjHEOvSrZ3m06X4WH5fy3RyDOYvdEQ3TqHZfI6Qo2FAAB4O+FNsM5C34FT
Y8h0lc3i+6GA7Xd58Y6RfEW89JFU1HqkgdjLhMdoh3Tac0fkhTo=
=UKg3
-----END PGP SIGNATURE-----


L
L
Leo Famulari wrote on 13 Feb 2019 01:09
(no subject)
(address . control@debbugs.gnu.org)
20190213000927.GA2525@jasmine.lan
tag 28964 moreinfo
J
J
Jakub K?dzio?ka wrote on 25 Feb 2020 20:12
Re: [bug#28964] [PATCH] gnu: Add hping.
(address . 28964@debbugs.gnu.org)
20200225191203.c4t4w3j7qvihka74@gravity
Since upstream has stopped merging PRs *quite* a while ago, I'd suggest
we should adopt the patches being used by other distributions. I took a
brief look at Gentoo, and their patches [1] look reasonable. Thoughts?

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl5VcXgACgkQ4xWnWEYT
FWT7AhAAipcxKtFXSxVH/597IvVWJwlKvJYRY71/TOhFPFULzDz4jB1XmtI8t5l8
9xs3EwqV7tk9NoTbcvyUixF14NwUj1Pb7OVJAE3ovPZylm5Mchm0qu861CseJEVb
wROL+W4BguoSIQdpEzdLk+cz47w5N//H9g0fpNN+RIFslffmiERMTWA5CrHilQiK
pTj9NhmQY1Xfx5u5cqk2JWyzASQbak3UbPpfBl65xLIg7Mwg2QQpCYCwCsoJAAzq
crZRu/05RDSMjMQuFrqgBhaz7Gz8/Bibhl61lrsc2XsADGiA+y8BC4OwrEnDZAeE
Li6l2mW7NiTuxOrHeCyMUMi+XZvEQK7FJ486AMb919k2ZlU8vlVeF1/2/MN/W/O6
b7qwX60XS6oMCkfiYoS9PTRSAloh6j900vp1AyZGf7vR3Ly/FK+Wso4MFPVYrpmX
JuSBh75RF/ihIySn+z0wdGcliZl2v1Gmfam/nVP6M6v/cjPzpU3nJNVw+WvSgpEx
pY0CbTSUFIpgVtI9v3p4XV+vSCPPPCcBhl33EyIZUXIpadTElS3Ej1bum2gCCmX0
VBExUmiYLGofDncRlPOq/iTswdgAkC4IVvh1573arWknBTtpv86VvYtGVs6Uhq/q
p40HNapKNhXN9YrScHU/npK6d1X/JeBNYxJgjcLsJTdXTt5G1lw=
=M3Iu
-----END PGP SIGNATURE-----


L
L
Leo Famulari wrote on 25 Feb 2020 21:15
(name . Jakub K?dzio?ka)(address . kuba@kadziolka.net)(address . 28964@debbugs.gnu.org)
20200225201549.GA409@jasmine.lan
On Tue, Feb 25, 2020 at 08:12:03PM +0100, Jakub K?dzio?ka wrote:
Toggle quote (6 lines)
> Since upstream has stopped merging PRs *quite* a while ago, I'd suggest
> we should adopt the patches being used by other distributions. I took a
> brief look at Gentoo, and their patches [1] look reasonable. Thoughts?
>
> [0]: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-analyzer/hping/files

In general we have always packaged upstream rather than 3rd-party
variants, and tried to push changes upstream, etc. The idea being that
distros are not the right place for package development.

However, in some cases we do package distro variants of programs whose
"canonical" upstreams are defunct, for example w3m, which is now
developed within Debian. It's a matter of judgment.

In this case I think we should drop the patch, since Marius did not
pursue it.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAl5VgG0ACgkQJkb6MLrK
fwhJAw/9HuKtE5F0hvTFFPpeVzCmqdbe1ZAFAHiKEuoWUWFTa7ypTqn6FWRU1w0g
I1fbQjfPnAzpxZYpxaaMPlD8ZH18vUlEAb1EDxT+R86yqOz1rUEJp5I3vXwAW+6t
xbRhkBQT1cv2T8F6rBZishV2gqxgZHz/xsbBJuVBqCmG3eT3bcL5C8MGG/cmSThj
yW9BaWoP5gXg9wpn9asRxJkeaHO/FpbDTgmjerlG8V/31eDapovfjz0Ng5RoYVV2
OQ8Lrkqauv1UyU6lKzp18MZJlS7dp+QiMk0b9NP4ioZLQvDGWmW9/HieGnUS/Xqd
28hD4ZWDYmxRGGwDH5ypyZBi/OLbLUo5eYSnfN+FK3Pgc44Onlv30NnL+Cy4QYrV
h7u239gC6X3tSnApaa2nckscQx0QQ+shVFAl4f0OV6CNm/DaGUWXxNKUyJ/74K8c
WwTZj97JAxz1TPOe3D5g6PALBpSQwYigxW1UNN6PlnMISla0YEkEx1DnHCPD7vw5
cNI91LtttNpagTyF0I68gL6/M9PUT12ljOrarmbL766PWia8f2/CBwLvrrRb5cgf
v1EtXMOU185eZYbiPNzJmuc5wiViU9lu3H5wY6AwSnKutx60Xc92JBpLvX3jLjTM
fijmxfiKz7yt9xumws5gm9kTmUq2JAgAyoH9zUcO0gHw94Ha4MA=
=WwNh
-----END PGP SIGNATURE-----


M
M
Marius Bakke wrote on 26 Feb 2020 21:54
(address . 28964-done@debbugs.gnu.org)
87o8tl2ho2.fsf@devup.no
Leo Famulari <leo@famulari.name> writes:

Toggle quote (3 lines)
> In this case I think we should drop the patch, since Marius did not
> pursue it.

I agree, closing.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl5W2w0ACgkQoqBt8qM6
VPrKtQf+IXMc8BB7TjNy1XYEQnYjmp/0jPMf0lgu7bvN8S0ZbbQQXoLJoiKSei1i
BrGR+kmn/+pqzLmNJp6MmZxFkBQZTiBfQm8I5m/xQpQ3KxLnxZZZ3hpQVVCW4GfQ
90e3x2qUduKX+HM02yhFbLISDva3RCnnTbGpu6P+y53QX2q65Ovm0Tss7izbbEYS
IK7e41Vp6M3nwyvTapQpn6931UJH8vVLR0dt9XpoGtu1pJwlfQIW9ZKaeXJLjv3C
8U0BRqKLYswh8X4ekAN9X9ITTnbZVs00T7PWNfn3lScRpEaR4gUG77r6zZhMdKFL
6R6TXxL4kV0WpMzkqmqggeD2ODQATw==
=YDI8
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 28964@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 28964
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch