Implement the -l commandline option which turns off broadcast of

information, but still allows you to monitor other machines.

PR:		9301
Submitted by:	Matthew Fuller <fullermd@futuresouth.com>
This commit is contained in:
Steve Price 1999-01-11 05:27:37 +00:00
parent e9f2a6a839
commit 213581530a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42508
2 changed files with 24 additions and 5 deletions

View File

@ -40,6 +40,7 @@
.Sh SYNOPSIS
.Nm rwhod
.Op Fl i
.Op Fl l
.Op Fl m Op Ar ttl
.Sh DESCRIPTION
.Nm Rwhod
@ -54,7 +55,11 @@ or
messages on a network.
.Pp
.Nm Rwhod
operates as both a producer and consumer of status information.
operates as both a producer and consumer of status information,
unless the
.Fl l
(listen mode) option is specified, in which case
it acts as a consumer only.
As a producer of information it periodically
queries the state of the system and constructs
status messages which are broadcasted or multicasted on a network.
@ -71,6 +76,15 @@ option enables insecure mode, which causes
to ignore the source port on incoming packets.
.Pp
The
.Fl l
option enables listen mode, which causes
.Nm
to not broadcast any information.
This allows you to monitor other machines'
.Nm
information, without broadcasting your own.
.Pp
The
.Fl m
option causes
.Nm

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: rwhod.c,v 1.7 1997/10/13 11:27:55 charnier Exp $";
"$Id: rwhod.c,v 1.8 1998/12/17 11:05:57 des Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -116,6 +116,7 @@ static const char rcsid[] =
/* (belongs in protocols/rwhod.h) */
int insecure_mode;
int quiet_mode;
int multicast_mode = NO_MULTICAST;
int multicast_scope;
struct sockaddr_in multicast_addr = { sizeof multicast_addr, AF_INET };
@ -196,7 +197,9 @@ main(argc, argv)
else multicast_mode = PER_INTERFACE_MULTICAST;
}
else if (strcmp(*argv, "-i") == 0)
insecure_mode = 1;
insecure_mode = 1;
else if (strcmp(*argv, "-l") == 0)
quiet_mode = 1;
else
usage();
argv++, argc--;
@ -255,8 +258,10 @@ main(argc, argv)
setuid(unpriv_uid);
if (!configure(s))
exit(1);
signal(SIGALRM, onalrm);
onalrm(0);
if (!quiet_mode) {
signal(SIGALRM, onalrm);
onalrm(0);
}
for (;;) {
struct whod wd;
int cc, whod, len = sizeof(from);