From: Ted Lemon Date: Sun, 24 Oct 1999 23:23:41 +0000 (+0000) Subject: Fix Linux compile. X-Git-Tag: BCTEL_SPECIAL_19991124~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1b705e544f3e80354d783875640d6e45b4f5113;p=thirdparty%2Fdhcp.git Fix Linux compile. --- diff --git a/common/socket.c b/common/socket.c index 1b54614b4..bb8050996 100644 --- a/common/socket.c +++ b/common/socket.c @@ -30,16 +30,17 @@ #ifndef lint static char copyright[] = -"$Id: socket.c,v 1.41 1999/10/24 17:17:51 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: socket.c,v 1.42 1999/10/24 23:23:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" #ifdef USE_SOCKET_FALLBACK -# define USE_SOCKET_SEND +# if !defined (USE_SOCKET_SEND) # define if_register_send if_register_fallback # define send_packet send_fallback # define if_reinitialize_send if_reinitialize_fallback +# endif #endif static int once = 0; @@ -47,7 +48,7 @@ static int once = 0; /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) void if_reinitialize_send (info) struct interface_info *info; { @@ -73,7 +74,9 @@ void if_reinitialize_receive (info) } #endif -#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) +#if defined (USE_SOCKET_SEND) || \ + defined (USE_SOCKET_RECEIVE) || \ + defined (USE_SOCKET_FALLBACK) /* Generic interface registration routine... */ int if_register_socket (info) struct interface_info *info; @@ -127,9 +130,9 @@ int if_register_socket (info) return sock; } -#endif /* USE_SOCKET_SEND || USE_SOCKET_RECEIVE */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_RECEIVE || USE_SOCKET_FALLBACK */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) void if_register_send (info) struct interface_info *info; { @@ -150,7 +153,7 @@ void if_register_send (info) (info -> shared_network ? info -> shared_network -> name : "")); } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_FALLBACK */ #ifdef USE_SOCKET_RECEIVE void if_register_receive (info) @@ -168,7 +171,7 @@ void if_register_receive (info) } #endif /* USE_SOCKET_RECEIVE */ -#ifdef USE_SOCKET_SEND +#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK) ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct interface_info *interface; struct packet *packet; @@ -195,12 +198,12 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) if (result < 0) { log_error ("send_packet: %m"); if (errno == ENETUNREACH) - log_error ("send_packet: please consult README file %s", - "regarding broadcast address."); + log_error ("send_packet: please consult README file%s", + " regarding broadcast address."); } return result; } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_SEND || USE_SOCKET_FALLBACK */ #ifdef USE_SOCKET_RECEIVE ssize_t receive_packet (interface, buf, len, from, hfrom) @@ -253,20 +256,23 @@ isc_result_t fallback_discard (object) } return ISC_R_SUCCESS; } -#endif /* USE_SOCKET_SEND */ +#endif /* USE_SOCKET_FALLBACK */ -#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK) +#if defined (USE_SOCKET_SEND) int can_unicast_without_arp (ip) struct interface_info *ip; { return 0; } -/* On many stacks, we should return 1 here. */ int can_receive_unicast_unconfigured (ip) struct interface_info *ip; { +#if defined (SOCKET_CAN_RECEIVE_UNICAST_UNCONFIGURED) + return 1; +#else return 0; +#endif } /* If we have SO_BINDTODEVICE, set up a fallback interface; otherwise, @@ -274,7 +280,7 @@ int can_receive_unicast_unconfigured (ip) void maybe_setup_fallback () { -#if defined (SO_BINDTODEVICE) +#if defined (USE_SOCKET_FALLBACK) isc_result_t status; struct interface_info *fbi; fbi = setup_fallback (); @@ -291,4 +297,4 @@ void maybe_setup_fallback () } #endif } -#endif /* USE_SOCKET_SEND && !USE_SOCKET_FALLBACK */ +#endif /* USE_SOCKET_SEND */