#ifndef lint
static char copyright[] =
-"$Id: bpf.c,v 1.16 1997/02/19 10:49:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bpf.c,v 1.17 1997/02/26 05:20:52 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
return 0;
}
#endif
-
-#if defined (USE_BPF_SEND)
-void if_enable (interface)
- struct interface_info *interface;
-{
- struct ifreq ifr;
- int sock;
-
- if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
- error ("Can't create addrlist socket");
-
- /* Bring the interface down and then up again to clear
- * all its routes. */
- strncpy(ifr.ifr_name, interface -> name, IFNAMSIZ);
- if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0)
- error ("SIOCGIFFLAGS %s: %m", interface -> name);
-
- ifr.ifr_flags |= (IFF_UP|IFF_RUNNING);
- if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
- error ("SIOCSIFFLAGS %s: %m", interface -> name);
-}
-#endif
#ifndef lint
static char copyright[] =
-"$Id: nit.c,v 1.12 1997/02/19 10:49:20 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: nit.c,v 1.13 1997/02/26 05:20:53 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
return length;
}
#endif
-
-#if defined (USE_NIT_SEND)
-void if_enable (interface)
- struct interface_info *interface;
-{
- struct ifreq ifr;
-
- /* Bring the interface down and then up again to clear
- * all its routes. */
- strncpy(ifr.ifr_name, interface -> name, IFNAMSIZ);
- if (ioctl(interface -> rfdesc, SIOCGIFFLAGS, &ifr) < 0)
- error ("SIOCGIFFLAGS %s: %m", interface -> name);
-
- ifr.ifr_flags |= (IFF_UP|IFF_RUNNING);
- if (ioctl(interface -> rfdesc, SIOCSIFFLAGS, &ifr) == -1)
- error ("SIOCSIFFLAGS %s: %m", interface -> name);
-}
-#endif
#ifndef lint
static char copyright[] =
-"$Id: socket.c,v 1.19 1997/02/19 10:49:19 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: socket.c,v 1.20 1997/02/26 05:20:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
(char *)&flag, sizeof flag) < 0)
error ("Can't set SO_BROADCAST option on dhcp socket: %m");
-#ifndef USE_SOCKET_FALLBACK
- /* The following will make all-ones broadcasts go out this interface
- * on those platforms which use the standard sockets API (assuming
- * the OS-specific routines called by enable_sending() are present
- * for this platform). */
- if_enable (info);
-#endif
-
/* Bind the socket to this interface's IP address. */
if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0)
error ("Can't bind to dhcp address: %m");
(struct sockaddr *)&from, &flen);
}
#endif /* USE_SOCKET_RECEIVE */
-
-#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK)
-/* If we're using the standard socket API without SO_BINDTODEVICE,
- * we need this kludge to force DHCP broadcasts to go out
- * this interface, even though it's not available for general
- * use until we get a lease!
- * This should work _OK_, but it will cause ALL all-ones
- * broadcasts on this host to go out this interface--it
- * could interfere with other interfaces. And God help you
- * if you run this on multiple interfaces simultaneously.
- * SO_BINDTODEVICE really is better! */
-void if_enable (interface)
- struct interface_info *interface;
-{
-#ifndef SO_BINDTODEVICE
- struct in_addr broad_addr;
- broad_addr.s_addr = htonl(INADDR_BROADCAST);
-
- /* Delete old routes for broadcast address. */
- remove_routes(NULL, &broad_addr);
-
- /* Add a route for broadcast address to this interface. */
- /* POTENTIAL PROBLEM: Don't do this to more than one interface! */
- add_route_direct(interface, &broad_addr);
-#endif
-}
-#endif