Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2001 16:48:39 -0700 (PDT)
From:      Scott Hazen Mueller <scott@zorch.sf-bay.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/29071: a little hack to rwhod
Message-ID:  <200107182348.f6INmd709715@zorba.sf-bay.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107182348.f6INmd709715>