xref: /freebsd/usr.sbin/rwhod/rwhod.8 (revision b9f654b163bce26de79705e77b872427c9f2afa1)
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.\" $FreeBSD$
30.\"
31.Dd August 8, 2017
32.Dt RWHOD 8
33.Os
34.Sh NAME
35.Nm rwhod
36.Nd system status server
37.Sh SYNOPSIS
38.Nm
39.Op Fl i
40.Op Fl p
41.Op Fl l
42.Op Fl m Op Ar ttl
43.Sh DESCRIPTION
44The
45.Nm
46utility is the server which maintains the database used by the
47.Xr rwho 1
48and
49.Xr ruptime 1
50programs.
51Its operation is predicated on the ability to
52.Em broadcast
53or
54.Em multicast
55messages on a network.
56.Pp
57The
58.Nm
59utility operates as both a producer and consumer of status information,
60unless the
61.Fl l
62(listen mode) option is specified, in which case
63it acts as a consumer only.
64As a producer of information it periodically
65queries the state of the system and constructs
66status messages which are broadcasted or multicasted on a network.
67As a consumer of information, it listens for other
68.Nm
69servers' status messages, validating them, then recording
70them in a collection of files located in the directory
71.Pa /var/rwho .
72.Pp
73The following options are available:
74.Bl -tag -width indent
75.It Fl i
76Enable insecure mode, which causes
77.Nm
78to ignore the source port on incoming packets.
79.It Fl p
80Ignore all
81.Dv POINTOPOINT
82interfaces.
83This is useful if you do not wish to keep dial on demand
84interfaces permanently active.
85.It Fl l
86Enable listen mode, which causes
87.Nm
88to not broadcast any information.
89This allows you to monitor other machines'
90.Nm
91information, without broadcasting your own.
92.It Fl m Op Ar ttl
93Cause
94.Nm
95to use IP multicast (instead of
96broadcast) on all interfaces that have
97the IFF_MULTICAST flag set in their "ifnet" structs
98(excluding the loopback interface).
99The multicast
100reports are sent with a time-to-live of 1, to prevent
101forwarding beyond the directly-connected subnet(s).
102.Pp
103If the optional
104.Ar ttl
105argument is supplied with the
106.Fl m
107flag,
108.Nm
109will send IP multicast datagrams with a
110time-to-live of
111.Ar ttl ,
112via a SINGLE interface rather
113than all interfaces.
114.Ar ttl
115must be between 0 and
11632 (or MAX_MULTICAST_SCOPE).
117Note that
118.Fl m Ar 1
119is different from
120.Fl m ,
121in that
122.Fl m Ar 1
123specifies transmission on one interface only.
124.Pp
125When
126.Fl m
127is used without a
128.Ar ttl
129argument, the program accepts multicast
130.Nm
131reports from all multicast-capable interfaces.
132If a
133.Ar ttl
134argument is given, it accepts multicast reports from only one interface, the
135one on which reports are sent (which may be controlled via the host's routing
136table).
137Regardless of the
138.Fl m
139option, the program accepts broadcast or
140unicast reports from all interfaces.
141Thus, this program will hear the
142reports of old, non-multicasting
143.Nm Ns s ,
144but, if multicasting is used,
145those old
146.Nm Ns s
147will not hear the reports generated by this program.
148.El
149.Pp
150The server transmits and receives messages at the port indicated
151in the ``who'' service specification; see
152.Xr services 5 .
153The messages sent and received, are of the form:
154.Bd -literal -offset indent
155struct	outmp {
156	char	out_line[8];		/* tty name */
157	char	out_name[8];		/* user id */
158	long	out_time;		/* time on */
159};
160
161struct	whod {
162	char	wd_vers;
163	char	wd_type;
164	char	wd_fill[2];
165	int	wd_sendtime;
166	int	wd_recvtime;
167	char	wd_hostname[32];
168	int	wd_loadav[3];
169	int	wd_boottime;
170	struct	whoent {
171		struct	outmp we_utmp;
172		int	we_idle;
173	} wd_we[1024 / sizeof (struct whoent)];
174};
175.Ed
176.Pp
177All fields are converted to network byte order prior to
178transmission.
179The load averages are as calculated by the
180.Xr w 1
181program, and represent load averages over the 5, 10, and 15 minute
182intervals prior to a server's transmission; they are multiplied by 100
183for representation in an integer.
184The host name
185included is that returned by the
186.Xr gethostname 3
187system call, with any trailing domain name omitted.
188The array at the end of the message contains information about
189the users logged in to the sending machine.
190This information
191includes the contents of the entry from the user accounting database
192for each non-idle terminal line and a value indicating the
193time in seconds since a character was last received on the terminal line.
194.Pp
195Messages received by the
196.Nm rwho
197server are discarded unless they originated at an
198.Nm rwho
199server's port or the
200.Fl i
201option was specified.
202In addition, if the host's name, as specified
203in the message, contains any unprintable
204.Tn ASCII
205characters, the
206message is discarded.
207Valid messages received by
208.Nm
209are placed in files named
210.Pa whod.hostname
211in the directory
212.Pa /var/rwho .
213These files contain only the most recent message, in the
214format described above.
215.Pp
216Status messages are generated approximately once every
2173 minutes.
218The
219.Nm
220utility performs an
221.Xr nlist 3
222on
223.Pa /boot/kernel/kernel
224every 30 minutes to guard against
225the possibility that this file is not the system
226image currently operating.
227.Sh SEE ALSO
228.Xr ruptime 1 ,
229.Xr rwho 1
230.Sh HISTORY
231The
232.Nm
233utility appeared in
234.Bx 4.2 .
235.Sh BUGS
236Status information should be sent only upon request rather than continuously.
237People often interpret the server dying
238or network communication failures
239as a machine going down.
240