nghook8
Connect to a netgraph node
Usage
nghook [-adlnSs]
[-m
msg]
path
[hookname]
nghook -e
[-n]
[-m
msg]
path
hookname
program
[args ...]
Overview
The nghook utility creates a ng_socket(4) socket type node and connects it to hook hookname of the node found at path. If hookname is omitted, “debug” is assumed.
If the -e option is given, the third argument is interpreted as the path to a program, and this program is executed with the remaining arguments as its arguments. Before executing, the program Netgraph messages (specified by the -m option) are sent to the node. The program is executed with its standard input (unless closed by -n) and output connected to the hook.
If the -e option is not given, all data written to standard input is sent to the node, and all data received from the node is relayed to standard output. Messages specified with -m are sent to the node before the loop is entered. The nghook utility exits when EOF is detected on standard input in this case.
The options are as follows:
-
-a -
Output each packet read in human-readable decoded ASCII form instead of raw binary.
-
-d -
Increase the debugging verbosity level.
-
-e -
Execute the program specified by the third argument.
-
-l -
Loops all received data back to the hook in addition to writing it to standard output.
-
-m msg -
Before executing the program (in
-emode) send the given ASCII control message to the node. This option may be given more than once. -
-n -
Do not attempt to read any data from standard input. The
nghookutility will continue reading from the node until stopped by a signal. -
-S -
Use file descriptor 0 for output instead of the default 1.
-
-s -
Use file descriptor 1 for input instead of the default 0.
Releases
73 releases since FreeBSD 3.4-RELEASE; the text changed 41 times.
- 3.4
- 3.5–3.5.1
- 4.0–4.2
- 4.3
- 4.4–4.11
- 5.0–5.1
- 5.2–5.2.1
- 5.3–5.5
- 6.0–6.3
- 6.4
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 9.0
- 9.1
- 9.2
- 9.3
- 10.0
- 10.1
- 10.2
- 10.3
- 10.4
- 11.0
- 11.1
- 11.2
- 11.3
- 11.4
- 12.0
- 12.1
- 12.2
- 12.3
- 12.4
- 13.0–13.2
- 13.3–15.1
- 16.0
-S since FreeBSD 5.2-RELEASE;
-e since FreeBSD 5.2-RELEASE;
-l since FreeBSD 5.0-RELEASE;
-m since FreeBSD 5.2-RELEASE;
-n since FreeBSD 5.0-RELEASE;
-s since FreeBSD 5.2-RELEASE.