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