mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 06:45:27 +00:00
Remove if_enable()
This commit is contained in:
24
common/bpf.c
24
common/bpf.c
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -382,25 +382,3 @@ size_t receive_packet (interface, buf, len, from, hfrom)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
|
||||||
|
20
common/nit.c
20
common/nit.c
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -343,21 +343,3 @@ size_t receive_packet (interface, buf, len, from, hfrom)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -136,14 +136,6 @@ int if_register_socket (info)
|
|||||||
(char *)&flag, sizeof flag) < 0)
|
(char *)&flag, sizeof flag) < 0)
|
||||||
error ("Can't set SO_BROADCAST option on dhcp socket: %m");
|
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. */
|
/* Bind the socket to this interface's IP address. */
|
||||||
if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0)
|
if (bind (sock, (struct sockaddr *)&name, sizeof name) < 0)
|
||||||
error ("Can't bind to dhcp address: %m");
|
error ("Can't bind to dhcp address: %m");
|
||||||
@@ -235,30 +227,3 @@ size_t fallback_discard (interface)
|
|||||||
(struct sockaddr *)&from, &flen);
|
(struct sockaddr *)&from, &flen);
|
||||||
}
|
}
|
||||||
#endif /* USE_SOCKET_RECEIVE */
|
#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
|
|
||||||
|
Reference in New Issue
Block a user