Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rarpd Fix handling of interface aliases if "rarpd" ...



details:   https://anonhg.NetBSD.org/src/rev/262cbe98d944
branches:  trunk
changeset: 566556:262cbe98d944
user:      tron <tron%NetBSD.org@localhost>
date:      Wed May 12 16:48:44 2004 +0000

description:
Fix handling of interface aliases if "rarpd" is not invoked with "-a".

diffstat:

 usr.sbin/rarpd/rarpd.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 605cb9e96c17 -r 262cbe98d944 usr.sbin/rarpd/rarpd.c
--- a/usr.sbin/rarpd/rarpd.c    Wed May 12 16:38:01 2004 +0000
+++ b/usr.sbin/rarpd/rarpd.c    Wed May 12 16:48:44 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rarpd.c,v 1.50 2004/04/10 17:53:05 darrenr Exp $       */
+/*     $NetBSD: rarpd.c,v 1.51 2004/05/12 16:48:44 tron Exp $  */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -28,7 +28,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: rarpd.c,v 1.50 2004/04/10 17:53:05 darrenr Exp $");
+__RCSID("$NetBSD: rarpd.c,v 1.51 2004/05/12 16:48:44 tron Exp $");
 #endif
 
 
@@ -96,7 +96,7 @@
 u_int32_t choose_ipaddr(u_int32_t **, u_int32_t, u_int32_t);
 void   debug(const char *,...)
        __attribute__((__format__(__printf__, 1, 2)));
-void   init_all(void);
+void   init_some(char *name);
 void   init_one(char *, u_int32_t);
 u_int32_t      ipaddrtonetmask(u_int32_t);
 void   lookup_eaddr(char *, u_char *);
@@ -175,10 +175,10 @@
        }
 
        if (aflag)
-               init_all();
+               init_some(NULL);
        else {
                while (argc--)
-                       init_one(*argv++, INADDR_ANY);
+                       init_some(*argv++);
        }
 
        rarp_loop();
@@ -239,7 +239,7 @@
  * point to point.
  */
 void
-init_all(void)
+init_some(char *name)
 {
        struct ifaddrs *ifap, *ifa, *p;
 
@@ -253,6 +253,8 @@
 #define SIN(s) ((struct sockaddr_in *) (s))
                if (ifa->ifa_addr->sa_family != AF_INET)
                        continue;
+               if (name && strcmp(name, ifa->ifa_name))
+                       continue;
                if (p && !strcmp(p->ifa_name, ifa->ifa_name) &&
                    SIN(p->ifa_addr)->sin_addr.s_addr == SIN(ifa->ifa_addr)->sin_addr.s_addr)
                        continue;



Home | Main Index | Thread Index | Old Index