unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice <me@tobias.gr>
To: mbakke@fastmail.com, 28964@debbugs.gnu.org
Subject: [bug#28964] [PATCH] gnu: Add hping.
Date: Tue, 24 Oct 2017 16:39:00 +0200	[thread overview]
Message-ID: <a53350b1-1742-dfcc-3c1c-827e53246dff@tobias.gr> (raw)
In-Reply-To: <20171024060636.30232-1-mbakke@fastmail.com>

Marius,

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

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

> 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.

> +                 ;; 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].

> +                 #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".

> +      (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.

> +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’.

> +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."

> +      (license license:gpl2))))         ;strlcpy.c is BSD-3

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

Kind regards,

T G-R

[0]: https://github.com/antirez/hping/pull/32

  reply	other threads:[~2017-10-24 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  6:06 [bug#28964] [PATCH] gnu: Add hping Marius Bakke
2017-10-24 14:39 ` Tobias Geerinckx-Rice [this message]
2019-02-13  0:08 ` Leo Famulari
2020-02-25 19:12 ` Jakub Kądziołka
2020-02-25 20:15   ` Leo Famulari
2020-02-26 20:54     ` bug#28964: " Marius Bakke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a53350b1-1742-dfcc-3c1c-827e53246dff@tobias.gr \
    --to=me@tobias.gr \
    --cc=28964@debbugs.gnu.org \
    --cc=mbakke@fastmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).