| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bpf.c,v 1.3 2014/07/12 12:09:37 spz Exp $ */ | | 1 | /* $NetBSD: bpf.c,v 1.3.2.1 2018/06/06 15:31:58 martin Exp $ */ |
2 | /* bpf.c | | 2 | /* bpf.c |
3 | | | 3 | |
4 | BPF socket interface code, originally contributed by Archie Cobbs. */ | | 4 | BPF socket interface code, originally contributed by Archie Cobbs. */ |
5 | | | 5 | |
6 | /* | | 6 | /* |
7 | * Copyright (c) 2009,2012-2014 by Internet Systems Consortium, Inc. ("ISC") | | 7 | * Copyright (c) 2009,2012-2014 by Internet Systems Consortium, Inc. ("ISC") |
8 | * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") | | 8 | * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") |
9 | * Copyright (c) 1996-2003 by Internet Software Consortium | | 9 | * Copyright (c) 1996-2003 by Internet Software Consortium |
10 | * | | 10 | * |
11 | * Permission to use, copy, modify, and distribute this software for any | | 11 | * Permission to use, copy, modify, and distribute this software for any |
12 | * purpose with or without fee is hereby granted, provided that the above | | 12 | * purpose with or without fee is hereby granted, provided that the above |
13 | * copyright notice and this permission notice appear in all copies. | | 13 | * copyright notice and this permission notice appear in all copies. |
14 | * | | 14 | * |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * Redwood City, CA 94063 | | 25 | * Redwood City, CA 94063 |
26 | * <info@isc.org> | | 26 | * <info@isc.org> |
27 | * https://www.isc.org/ | | 27 | * https://www.isc.org/ |
28 | * | | 28 | * |
29 | * This software was contributed to Internet Systems Consortium | | 29 | * This software was contributed to Internet Systems Consortium |
30 | * by Archie Cobbs. | | 30 | * by Archie Cobbs. |
31 | * | | 31 | * |
32 | * Patches for FDDI support on Digital Unix were written by Bill | | 32 | * Patches for FDDI support on Digital Unix were written by Bill |
33 | * Stapleton, and maintained for a while by Mike Meredith before he | | 33 | * Stapleton, and maintained for a while by Mike Meredith before he |
34 | * managed to get me to integrate them. | | 34 | * managed to get me to integrate them. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __RCSID("$NetBSD: bpf.c,v 1.3 2014/07/12 12:09:37 spz Exp $"); | | 38 | __RCSID("$NetBSD: bpf.c,v 1.3.2.1 2018/06/06 15:31:58 martin Exp $"); |
39 | | | 39 | |
40 | #include "dhcpd.h" | | 40 | #include "dhcpd.h" |
41 | #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) \ | | 41 | #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) \ |
42 | || defined (USE_LPF_RECEIVE) | | 42 | || defined (USE_LPF_RECEIVE) |
43 | # if defined (USE_LPF_RECEIVE) | | 43 | # if defined (USE_LPF_RECEIVE) |
44 | # include <asm/types.h> | | 44 | # include <asm/types.h> |
45 | # include <linux/filter.h> | | 45 | # include <linux/filter.h> |
46 | # define bpf_insn sock_filter /* Linux: dare to be gratuitously different. */ | | 46 | # define bpf_insn sock_filter /* Linux: dare to be gratuitously different. */ |
47 | # else | | 47 | # else |
48 | # include <sys/ioctl.h> | | 48 | # include <sys/ioctl.h> |
49 | # include <sys/uio.h> | | 49 | # include <sys/uio.h> |
50 | # include <net/bpf.h> | | 50 | # include <net/bpf.h> |
51 | # if defined (NEED_OSF_PFILT_HACKS) | | 51 | # if defined (NEED_OSF_PFILT_HACKS) |
| @@ -613,26 +613,29 @@ get_hw_addr(const char *name, struct har | | | @@ -613,26 +613,29 @@ get_hw_addr(const char *name, struct har |
613 | break; | | 613 | break; |
614 | } | | 614 | } |
615 | } | | 615 | } |
616 | if (sa == NULL) { | | 616 | if (sa == NULL) { |
617 | log_fatal("No interface called '%s'", name); | | 617 | log_fatal("No interface called '%s'", name); |
618 | } | | 618 | } |
619 | close(s); | | 619 | close(s); |
620 | | | 620 | |
621 | /* | | 621 | /* |
622 | * Pull out the appropriate information. | | 622 | * Pull out the appropriate information. |
623 | */ | | 623 | */ |
624 | switch (sa->sdl_type) { | | 624 | switch (sa->sdl_type) { |
625 | case IFT_ETHER: | | 625 | case IFT_ETHER: |
| | | 626 | #ifdef IFT_CARP |
| | | 627 | case IFT_CARP: |
| | | 628 | #endif |
626 | hw->hlen = sa->sdl_alen + 1; | | 629 | hw->hlen = sa->sdl_alen + 1; |
627 | hw->hbuf[0] = HTYPE_ETHER; | | 630 | hw->hbuf[0] = HTYPE_ETHER; |
628 | memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); | | 631 | memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); |
629 | break; | | 632 | break; |
630 | case IFT_ISO88023: | | 633 | case IFT_ISO88023: |
631 | case IFT_ISO88024: /* "token ring" */ | | 634 | case IFT_ISO88024: /* "token ring" */ |
632 | case IFT_ISO88025: | | 635 | case IFT_ISO88025: |
633 | case IFT_ISO88026: | | 636 | case IFT_ISO88026: |
634 | hw->hlen = sa->sdl_alen + 1; | | 637 | hw->hlen = sa->sdl_alen + 1; |
635 | hw->hbuf[0] = HTYPE_IEEE802; | | 638 | hw->hbuf[0] = HTYPE_IEEE802; |
636 | memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); | | 639 | memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); |
637 | break; | | 640 | break; |
638 | #ifdef IFT_FDDI | | 641 | #ifdef IFT_FDDI |