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