LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: prevent rwhod broadcast on external interface

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: prevent rwhod broadcast on external interface
From: Alois Treindl <alois@xxxxxxxx>
Date: Tue, 06 Jul 2004 00:57:04 +0200

You could fix rwhod so you can control where it sends its packets out.


I patched rwhod, adding an option
-n INTERFACE
so that: rhowd -n eth1
prevents all broadcasts to interface eth1.

my simple patch allows only for one interface to be blocked.

--- netkit-rwho-0.17/rwhod/rwhod.c
+++ netkit-rwho-0.17.modified/rwhod/rwhod.c
@@ -118,6 +118,7 @@
 static int use_broadcast = 0;
 static int need_init = 1;
 static int child_pid = 0;
+static char *ifname_nb = NULL; /* name of no-broadcast interface */

 #define WHDRSIZE       (((caddr_t) &((struct whod *) 0)->wd_we) \
                        - ((caddr_t) 0))
@@ -143,7 +144,7 @@
                exit(1);
        }

-       while ((opt = getopt(argc, argv, "bpau:")) != EOF) {
+       while ((opt = getopt(argc, argv, "bpaun:")) != EOF) {
            switch (opt) {
              case 'b':
                  use_broadcast = 1;
@@ -158,6 +159,9 @@
              case 'u':
                  user = optarg;
                  break;
+             case 'n':
+                 ifname_nb = optarg;
+                 break;
              case '?':
              default:
                  fprintf(stderr, "usage: rwhod [-bpa] [-u user]\n");
@@ -609,6 +613,9 @@
                if (np != NULL)
                        continue;
                ifreq = *ifr;
+ if (ifname_nb != NULL && strcmp(ifname_nb, ifr->ifr_name) == 0){
+                  continue;
+               }
                np = (struct neighbor *)malloc(sizeof (*np));
                if (np == NULL)
                        continue;
<Prev in Thread] Current Thread [Next in Thread>