Fix compile on BSD.

This commit is contained in:
Roy Marples 2008-03-24 01:45:37 +00:00
parent a9819bfb1f
commit 5c7da81448
5 changed files with 11 additions and 5 deletions

3
bpf.c
View File

@ -47,9 +47,10 @@
#include "config.h"
#include "dhcp.h"
#include "interface.h"
#include "if.h"
#include "logger.h"
#include "socket.h"
#include "bpf-filter.h"
void
setup_packet_filters(void)

View File

@ -48,7 +48,7 @@
#include "config.h"
#include "common.h"
#include "dhcp.h"
#include "interface.h"
#include "if.h"
#include "logger.h"
/* Darwin doesn't define this for some very odd reason */
@ -164,7 +164,7 @@ if_route(const char *ifname, struct in_addr destination,
rtm.hdr.rtm_flags |= RTF_HOST;
hwaddr = xmalloc(sizeof(unsigned char) * HWADDR_LEN);
_do_interface(ifname, hwaddr, &hwlen, NULL, false, false);
do_interface(ifname, hwaddr, &hwlen, NULL, false, false);
memset(&su, 0, sizeof(su));
su.sdl.sdl_len = sizeof(su.sdl);
su.sdl.sdl_family = AF_LINK;

5
if.c
View File

@ -29,6 +29,9 @@
#include <sys/ioctl.h>
#include <arpa/inet.h>
#ifdef AF_LINK
# include <net/if_dl.h>
#endif
#include <ctype.h>
#include <errno.h>
@ -150,7 +153,7 @@ hwaddr_aton(unsigned char *buffer, const char *addr)
return len;
}
static int
int
do_interface(const char *ifname,
_unused unsigned char *hwaddr, _unused size_t *hwlen,
struct in_addr *addr, bool flush, bool get)

2
if.h
View File

@ -147,6 +147,8 @@ void log_route(struct in_addr, struct in_addr, struct in_addr, int, int, int);
int inet_ntocidr(struct in_addr);
int inet_cidrtoaddr(int, struct in_addr *);
int do_interface(const char *, unsigned char *, size_t *, struct in_addr *,
bool, bool);
int if_address(const char *, struct in_addr, struct in_addr, struct in_addr,
int del);
int if_route(const char *, struct in_addr, struct in_addr, struct in_addr,

View File

@ -2,6 +2,6 @@
# Copyright 2008 Roy Marples <roy@marples.name>
_UNAME_S_SH= case `uname -s` in *BSD|DragonFly) echo "BSD";; *) uname -s;; esac
_UNAME_S!= ${_UNAME_SH}
_UNAME_S!= ${_UNAME_S_SH}
UNAME_S= ${_UNAME_S}$(shell ${_UNAME_S_SH})
include ${MK}/os-${UNAME_S}.mk