xref: /freebsd/usr.sbin/rwhod/rwhod.8 (revision 1843dfb05ed80149f5a412180af882e3cb8f451b)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)rwhod.8	8.2 (Berkeley) 12/11/93
29.\"
30.Dd August 8, 2017
31.Dt RWHOD 8
32.Os
33.Sh NAME
34.Nm rwhod
35.Nd system status server
36.Sh SYNOPSIS
37.Nm
38.Op Fl i
39.Op Fl p
40.Op Fl l
41.Op Fl m Op Ar ttl
42.Sh DESCRIPTION
43The
44.Nm
45utility is the server which maintains the database used by the
46.Xr rwho 1
47and
48.Xr ruptime 1
49programs.
50Its operation is predicated on the ability to
51.Em broadcast
52or
53.Em multicast
54messages on a network.
55.Pp
56The
57.Nm
58utility operates as both a producer and consumer of status information,
59unless the
60.Fl l
61(listen mode) option is specified, in which case
62it acts as a consumer only.
63As a producer of information it periodically
64queries the state of the system and constructs
65status messages which are broadcasted or multicasted on a network.
66As a consumer of information, it listens for other
67.Nm
68servers' status messages, validating them, then recording
69them in a collection of files located in the directory
70.Pa /var/rwho .
71.Pp
72The following options are available:
73.Bl -tag -width indent
74.It Fl i
75Enable insecure mode, which causes
76.Nm
77to ignore the source port on incoming packets.
78.It Fl p
79Ignore all
80.Dv POINTOPOINT
81interfaces.
82This is useful if you do not wish to keep dial on demand
83interfaces permanently active.
84.It Fl l
85Enable listen mode, which causes
86.Nm
87to not broadcast any information.
88This allows you to monitor other machines'
89.Nm
90information, without broadcasting your own.
91.It Fl m Op Ar ttl
92Cause
93.Nm
94to use IP multicast (instead of
95broadcast) on all interfaces that have
96the IFF_MULTICAST flag set in their "ifnet" structs
97(excluding the loopback interface).
98The multicast
99reports are sent with a time-to-live of 1, to prevent
100forwarding beyond the directly-connected subnet(s).
101.Pp
102If the optional
103.Ar ttl
104argument is supplied with the
105.Fl m
106flag,
107.Nm
108will send IP multicast datagrams with a
109time-to-live of
110.Ar ttl ,
111via a SINGLE interface rather
112than all interfaces.
113.Ar ttl
114must be between 0 and
11532 (or MAX_MULTICAST_SCOPE).
116Note that
117.Fl m Ar 1
118is different from
119.Fl m ,
120in that
121.Fl m Ar 1
122specifies transmission on one interface only.
123.Pp
124When
125.Fl m
126is used without a
127.Ar ttl
128argument, the program accepts multicast
129.Nm
130reports from all multicast-capable interfaces.
131If a
132.Ar ttl
133argument is given, it accepts multicast reports from only one interface, the
134one on which reports are sent (which may be controlled via the host's routing
135table).
136Regardless of the
137.Fl m
138option, the program accepts broadcast or
139unicast reports from all interfaces.
140Thus, this program will hear the
141reports of old, non-multicasting
142.Nm Ns s ,
143but, if multicasting is used,
144those old
145.Nm Ns s
146will not hear the reports generated by this program.
147.El
148.Pp
149The server transmits and receives messages at the port indicated
150in the ``who'' service specification; see
151.Xr services 5 .
152The messages sent and received, are of the form:
153.Bd -literal -offset indent
154struct	outmp {
155	char	out_line[8];		/* tty name */
156	char	out_name[8];		/* user id */
157	long	out_time;		/* time on */
158};
159
160struct	whod {
161	char	wd_vers;
162	char	wd_type;
163	char	wd_fill[2];
164	int	wd_sendtime;
165	int	wd_recvtime;
166	char	wd_hostname[32];
167	int	wd_loadav[3];
168	int	wd_boottime;
169	struct	whoent {
170		struct	outmp we_utmp;
171		int	we_idle;
172	} wd_we[1024 / sizeof (struct whoent)];
173};
174.Ed
175.Pp
176All fields are converted to network byte order prior to
177transmission.
178The load averages are as calculated by the
179.Xr w 1
180program, and represent load averages over the 5, 10, and 15 minute
181intervals prior to a server's transmission; they are multiplied by 100
182for representation in an integer.
183The host name
184included is that returned by the
185.Xr gethostname 3
186system call, with any trailing domain name omitted.
187The array at the end of the message contains information about
188the users logged in to the sending machine.
189This information
190includes the contents of the entry from the user accounting database
191for each non-idle terminal line and a value indicating the
192time in seconds since a character was last received on the terminal line.
193.Pp
194Messages received by the
195.Nm rwho
196server are discarded unless they originated at an
197.Nm rwho
198server's port or the
199.Fl i
200option was specified.
201In addition, if the host's name, as specified
202in the message, contains any unprintable
203.Tn ASCII
204characters, the
205message is discarded.
206Valid messages received by
207.Nm
208are placed in files named
209.Pa whod.hostname
210in the directory
211.Pa /var/rwho .
212These files contain only the most recent message, in the
213format described above.
214.Pp
215Status messages are generated approximately once every
2163 minutes.
217.Sh SEE ALSO
218.Xr ruptime 1 ,
219.Xr rwho 1
220.Sh HISTORY
221The
222.Nm
223utility appeared in
224.Bx 4.2 .
225.Sh BUGS
226Status information should be sent only upon request rather than continuously.
227People often interpret the server dying
228or network communication failures
229as a machine going down.
230