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