]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Move tests for constants defined in O.S. headers into osdep.h - test
authorTed Lemon <source@isc.org>
Fri, 19 Feb 1999 18:17:34 +0000 (18:17 +0000)
committerTed Lemon <source@isc.org>
Fri, 19 Feb 1999 18:17:34 +0000 (18:17 +0000)
  for HAVE_whatever in .c files.   Define relevant HAVE_whatevers in
  linux.h, so that versions of linux that define these constants as
  enums will still work.

common/dispatch.c
common/socket.c
includes/cf/linux.h
includes/osdep.h

index 775bada37571cd8d5d67981d232c479faf910202..11a25f57ff3356914dc1c1316e93a0a28bf4e031 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dispatch.c,v 1.47.2.10 1999/02/13 19:17:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dispatch.c,v 1.47.2.11 1999/02/19 18:17:33 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -140,7 +140,7 @@ void discover_interfaces (state)
                   except don't skip down interfaces if we're trying to
                   get a list of configurable interfaces. */
                if ((ifr.ifr_flags & IFF_LOOPBACK) ||
-#ifdef IFF_POINTOPOINT
+#ifdef HAVE_IFF_POINTOPOINT
                    (ifr.ifr_flags & IFF_POINTOPOINT) ||
 #endif
                    (!(ifr.ifr_flags & IFF_UP) &&
@@ -168,7 +168,7 @@ void discover_interfaces (state)
 
                /* If we have the capability, extract link information
                   and record it in a linked list. */
-#ifdef AF_LINK
+#ifdef HAVE_AF_LINK
                if (ifp -> ifr_addr.sa_family == AF_LINK) {
                        struct sockaddr_dl *foo = ((struct sockaddr_dl *)
                                                   (&ifp -> ifr_addr));
@@ -328,7 +328,7 @@ void discover_interfaces (state)
 
        /* Now cycle through all the interfaces we found, looking for
           hardware addresses. */
-#if defined (SIOCGIFHWADDR) && !defined (AF_LINK)
+#if defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK)
        for (tmp = interfaces; tmp; tmp = tmp -> next) {
                struct ifreq ifr;
                struct sockaddr sa;
@@ -352,7 +352,11 @@ void discover_interfaces (state)
                sa = *(struct sockaddr *)&ifr.ifr_hwaddr;
                
                switch (sa.sa_family) {
-#ifdef ARPHRD_LOOPBACK
+#ifdef HAVE_ARPHRD_TUNNEL
+                     case ARPHRD_TUNNEL:
+                       /* ignore tunnel interfaces. */
+#endif
+#ifdef HAVE_ARPHRD_LOOPBACK
                      case ARPHRD_LOOPBACK:
                        /* ignore loopback interface */
                        break;
@@ -382,7 +386,7 @@ void discover_interfaces (state)
                        memcpy (tmp -> hw_address.haddr, sa.sa_data, 16);
                        break;
 
-#ifdef ARPHRD_METRICOM
+#ifdef HAVE_ARPHRD_METRICOM
                      case ARPHRD_METRICOM:
                        tmp -> hw_address.hlen = 6;
                        tmp -> hw_address.htype = ARPHRD_METRICOM;
@@ -395,7 +399,7 @@ void discover_interfaces (state)
                               ifr.ifr_name, sa.sa_family);
                }
        }
-#endif /* defined (SIOCGIFHWADDR) && !defined (AF_LINK) */
+#endif /* defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK) */
 
        /* If we're just trying to get a list of interfaces that we might
           be able to configure, we can quit now. */
index 62d61d63aadca51a902cde5b2db169969b94ad8a..f1c3dc4af98f3e9e6d832ba3177d1b9689ab9e12 100644 (file)
@@ -50,7 +50,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.26.2.7 1999/02/13 19:20:07 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.26.2.8 1999/02/19 18:17:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -102,7 +102,7 @@ int if_register_socket (info)
        int sock;
        int flag;
 
-#if !defined (SO_BINDTODEVICE) && !defined (USE_FALLBACK)
+#if !defined (HAVE_SO_BINDTODEVICE) && !defined (USE_FALLBACK)
        /* Make sure only one interface is registered. */
        if (once)
                error ("The standard socket API can only support %s",
@@ -136,7 +136,7 @@ int if_register_socket (info)
        if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0)
                error ("Can't bind to dhcp address: %m");
 
-#if defined (SO_BINDTODEVICE)
+#if defined (HAVE_SO_BINDTODEVICE)
        /* Bind this socket to this interface. */
        if (info -> ifp &&
            setsockopt (sock, SOL_SOCKET, SO_BINDTODEVICE,
index 13523b93d02d630752557a0b536d6453877f14ea..84bcd3f308441b1f0c40b85a0d09239d5c3198d8 100644 (file)
@@ -111,6 +111,7 @@ extern int h_errno;
 #  define USE_LPF
 #  define LINUX_SLASHPROC_DISCOVERY
 #  define PROCDEV_DEVICE "/proc/net/dev"
+#  define HAVE_ARPHRD_TUNNEL
 # else
 #  define USE_SOCKETS
 #  define IGNORE_HOSTUNREACH
@@ -119,3 +120,8 @@ extern int h_errno;
 
 #define ALIAS_NAMES_PERMUTED
 #define SKIP_DUMMY_INTERFACES
+#define HAVE_ARPHRD_METRICOM
+#define HAVE_ARPHRD_IEEE802
+#define HAVE_ARPHRD_LOOPBACK
+#define HAVE_SO_BINDTODEVICE
+#define HAVE_SIOCGIFHWADDR
index 8583999241f70b806f77dff039f63d8f5a8442fa..5c7025d300c798f80c6c98f8cf6921c31c6df26e 100644 (file)
 #ifndef BPF_FORMAT
 # define BPF_FORMAT "/dev/bpf%d"
 #endif
+
+#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
+# define HAVE_IFF_POINTOPOINT
+#endif
+
+#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
+# define HAVE_AF_LINK
+#endif
+
+#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL)
+# define HAVE_ARPHRD_TUNNEL
+#endif
+
+#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK)
+# define HAVE_ARPHRD_LOOPBACK
+#endif
+
+#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
+# define HAVE_ARPHRD_METRICOM
+#endif
+
+#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
+# define HAVE_SO_BINDTODEVICE
+#endif
+
+#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR)
+# define HAVE_SIOCGIFHWADDR
+#endif
+
+#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
+# define HAVE_AF_LINK
+#endif
+