summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2000-07-18 16:52:27 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2000-07-18 16:52:27 +0000
commitf928d1a2f232410390bb160c70e920f5890ec505 (patch)
tree1e57cf807bdef118cbaade98796e94b75448b412
parente2f7ff26d30587198f750c983caadf2ba11af6e8 (diff)
Notes
-rw-r--r--usr.sbin/nghook/main.c15
-rw-r--r--usr.sbin/nghook/nghook.84
2 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/nghook/main.c b/usr.sbin/nghook/main.c
index 8027dc658c8d..93ba6cd5cccf 100644
--- a/usr.sbin/nghook/main.c
+++ b/usr.sbin/nghook/main.c
@@ -71,16 +71,20 @@ main(int ac, char *av[])
char *path = NULL, *hook = DEFAULT_HOOKNAME;
int csock, dsock;
int asciiFlag = 0;
+ int loopFlag = 0;
int ch;
/* Parse flags */
- while ((ch = getopt(ac, av, "da")) != EOF) {
+ while ((ch = getopt(ac, av, "adl")) != EOF) {
switch (ch) {
+ case 'a':
+ asciiFlag = 1;
+ break;
case 'd':
NgSetDebug(NgSetDebug(-1) + 1);
break;
- case 'a':
- asciiFlag = 1;
+ case 'l':
+ loopFlag = 1;
break;
case '?':
default:
@@ -152,6 +156,11 @@ main(int ac, char *av[])
rl, wl);
}
}
+ /* Loopback */
+ if (loopFlag) {
+ if (NgSendData(dsock, NG_SOCK_HOOK_NAME, buf, rl) < 0)
+ err(EX_OSERR, "write(hook)");
+ }
}
/* Check data from stdin */
diff --git a/usr.sbin/nghook/nghook.8 b/usr.sbin/nghook/nghook.8
index 0a64c87bb78f..746095169778 100644
--- a/usr.sbin/nghook/nghook.8
+++ b/usr.sbin/nghook/nghook.8
@@ -45,6 +45,7 @@ node
.Nm
.Op Fl a
.Op Fl d
+.Op Fl l
.Ar path
.Op Ar hookname
.Sh DESCRIPTION
@@ -73,6 +74,9 @@ Output each read packet in
.Tn ASCII .
.It Fl d
Increase the debugging verbosity level.
+.It Fl l
+Loops all received data back to the hook in addition to writing it
+to standard output.
.El
.Sh BUGS
Although all input is read in unbuffered mode,