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.\" $FreeBSD$ 34.\" 35.Dd December 11, 1993 36.Dt RWHOD 8 37.Os BSD 4.2 38.Sh NAME 39.Nm rwhod 40.Nd system status server 41.Sh SYNOPSIS 42.Nm rwhod 43.Op Fl i 44.Op Fl p 45.Op Fl l 46.Op Fl m Op Ar ttl 47.Sh DESCRIPTION 48.Nm Rwhod 49is the server which maintains the database used by the 50.Xr rwho 1 51and 52.Xr ruptime 1 53programs. Its operation is predicated on the ability to 54.Em broadcast 55or 56.Em multicast 57messages on a network. 58.Pp 59.Nm Rwhod 60operates as both a producer and consumer of status information, 61unless the 62.Fl l 63(listen mode) option is specified, in which case 64it acts as a consumer only. 65As a producer of information it periodically 66queries the state of the system and constructs 67status messages which are broadcasted or multicasted on a network. 68As a consumer of information, it listens for other 69.Nm 70servers' status messages, validating them, then recording 71them in a collection of files located in the directory 72.Pa /var/rwho . 73.Pp 74The 75.Fl i 76option enables insecure mode, which causes 77.Nm 78to ignore the source port on incoming packets. 79.Pp 80The 81.Fl p 82option tells 83.Nm 84to ignore all 85.Dv POINTOPOINT 86interfaces. This is useful if you do not wish to keep dial on demand 87interfaces permanently active. 88.Pp 89The 90.Fl l 91option enables listen mode, which causes 92.Nm 93to not broadcast any information. 94This allows you to monitor other machines' 95.Nm 96information, without broadcasting your own. 97.Pp 98The 99.Fl m 100option causes 101.Nm 102to use IP multicast (instead of 103broadcast) on all interfaces that have 104the IFF_MULTICAST flag set in their "ifnet" structs 105(excluding the loopback interface). The multicast 106reports are sent with a time-to-live of 1, to prevent 107forwarding beyond the directly-connected subnet(s). 108.Pp 109If the optional 110.Ar ttl 111argument is supplied with the 112.Fl m 113flag, 114.Nm 115will send IP multicast datagrams with a 116time-to-live of 117.Ar ttl , 118via a SINGLE interface rather 119than all interfaces. 120.Ar ttl 121must be between 0 and 12232 (or MAX_MULTICAST_SCOPE). Note that 123.Fl m Ar 1 124is different than 125.Fl m , 126in that 127.Fl m Ar 1 128specifies transmission on one interface only. 129.Pp 130When 131.Fl m 132is used without a 133.Ar ttl 134argument, the program accepts multicast 135.Nm 136reports from all multicast-capable interfaces. If a 137.Ar ttl 138argument is given, it accepts multicast reports from only one interface, the 139one on which reports are sent (which may be controlled via the host's routing 140table). Regardless of the 141.Fl m 142option, the program accepts broadcast or 143unicast reports from all interfaces. Thus, this program will hear the 144reports of old, non-multicasting 145.Nm rwhod Ns s , 146but, if multicasting is used, 147those old 148.Nm rwhod Ns s 149won't hear the reports generated by this program. 150.Pp 151The server transmits and receives messages at the port indicated 152in the ``who'' service specification; see 153.Xr services 5 . 154The messages sent and received, are of the form: 155.Bd -literal -offset indent 156struct outmp { 157 char out_line[8]; /* tty name */ 158 char out_name[8]; /* user id */ 159 long out_time; /* time on */ 160}; 161 162struct whod { 163 char wd_vers; 164 char wd_type; 165 char wd_fill[2]; 166 int wd_sendtime; 167 int wd_recvtime; 168 char wd_hostname[32]; 169 int wd_loadav[3]; 170 int wd_boottime; 171 struct whoent { 172 struct outmp we_utmp; 173 int we_idle; 174 } wd_we[1024 / sizeof (struct whoent)]; 175}; 176.Ed 177.Pp 178All fields are converted to network byte order prior to 179transmission. The 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. The 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. This information 189includes the contents of the 190.Xr utmp 5 191entry for 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. In addition, if the host's name, as specified 201in the message, contains any unprintable 202.Tn ASCII 203characters, the 204message is discarded. Valid 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.Nm Rwhod 216performs an 217.Xr nlist 3 218on 219.Pa /kernel 220every 30 minutes to guard against 221the possibility that this file is not the system 222image currently operating. 223.Sh SEE ALSO 224.Xr ruptime 1 , 225.Xr rwho 1 226.Sh BUGS 227Status information should be sent only upon request rather than continuously. 228People often interpret the server dying 229or network communication failures 230as a machine going down. 231.Sh HISTORY 232The 233.Nm 234command appeared in 235.Bx 4.2 . 236