From owner-freebsd-bugs Wed Jul 18 17: 0:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 70B3C37B407 for ; Wed, 18 Jul 2001 17:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f6J002a66302; Wed, 18 Jul 2001 17:00:02 -0700 (PDT) (envelope-from gnats) Received: from zorch.sf-bay.org (zorch.dial.idiom.com [216.240.37.73]) by hub.freebsd.org (Postfix) with ESMTP id 4581C37B401 for ; Wed, 18 Jul 2001 16:51:07 -0700 (PDT) (envelope-from scott@zorch.sf-bay.org) Received: (from uucp@localhost) by zorch.sf-bay.org (8.11.1/8.8.2) with UUCP id f6INp5068852 for FreeBSD-gnats-submit@freebsd.org; Wed, 18 Jul 2001 16:51:05 -0700 (PDT) Received: (from scott@localhost) by zorba.sf-bay.org (8.11.3/8.8.8) id f6INmd709715; Wed, 18 Jul 2001 16:48:39 -0700 (PDT) (envelope-from scott) Message-Id: <200107182348.f6INmd709715@zorba.sf-bay.org> Date: Wed, 18 Jul 2001 16:48:39 -0700 (PDT) From: Scott Hazen Mueller Reply-To: scott@zorch.sf-bay.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/29071: a little hack to rwhod Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 29071 >Category: bin >Synopsis: relay patch for rwhod >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jul 18 17:00:02 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Scott Hazen Mueller >Release: FreeBSD 4.3-RELEASE i386 >Organization: >Environment: System: FreeBSD zorba.sf-bay.org 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Wed Jul 18 14:01:18 PDT 2001 scott@zorba.sf-bay.org:/export/obj/export/src/sys/ZORBA i386 >Description: Enclosed please find a small patch to add a '-r' flag (and underlying support) to rwhod. Enabling '-r' turns the daemon into a relay so that it repeats broadcasts it receives on all interfaces. This allows a FreeBSD router to relay rwho packets across multiple subnets w/o using multicast support. Only the relay needs to run the modified rwhod and enable relaying; the leaf nodes need no changes. Please note that this patch writes a byte of foo into the 'wd_pad' area of the whod structure so that it can identify packets that it has already touched and refrain from relaying them again... >How-To-Repeat: First, admit to using rwho. "Hi, my name is Scott, and I use rwho." Second, decide you'd like machines on different nets, tunneled together over PPP tunnels, to exchange rwhod data. Third, find yourself unable to get multicasting and rwhod -m to work. >Fix: *** rwhod.c Wed Jul 18 16:32:56 2001 --- rwhod.c.relay Wed Jul 18 16:28:57 2001 *************** *** 122,127 **** --- 122,128 ---- int multicast_mode = NO_MULTICAST; int multicast_scope; struct sockaddr_in multicast_addr = { sizeof multicast_addr, AF_INET }; + int mode_relay = 0; /* * Alarm interval. Don't forget to change the down time check in ruptime *************** *** 179,184 **** --- 180,186 ---- struct sockaddr_in sin; uid_t unpriv_uid; gid_t unpriv_gid; + struct neighbor *np; if (getuid()) errx(1, "not super user"); *************** *** 204,209 **** --- 206,213 ---- quiet_mode = 1; else if (strcmp(*argv, "-p") == 0) iff_flag = 0; + else if (strcmp(*argv, "-r") == 0) + mode_relay = 1; else usage(); argv++, argc--; *************** *** 296,301 **** --- 300,311 ---- inet_ntoa(from.sin_addr)); continue; } + if ( mode_relay && ( wd.wd_hostname != myname ) && ( wd.wd_pad[1] != 'X' ) ) { + wd.wd_pad[1] = 'X'; + for (np = neighbors; np != NULL; np = np->n_next) + (void) sendto(s, (char *)&wd, cc, 0, + np->n_addr, np->n_addrlen); + } (void) snprintf(path, sizeof path, "whod.%s", wd.wd_hostname); /* * Rather than truncating and growing the file each time, >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message