View | Details | Raw Unified | Return to bug 256053
Collapse All | Expand All

(-)b/net-mgmt/dhcp_probe/Makefile (-3 / +5 lines)
Lines 1-8 Link Here
1
# Created by: Kevin Hung <khung@nullaxiom.com>
1
# Created by: Kevin Hung <khung@nullaxiom.com>
2
2
3
PORTNAME=	dhcp_probe
3
PORTNAME=	dhcp_probe
4
PORTVERSION=	1.3.0
4
PORTVERSION=	1.3.1
5
PORTREVISION=	1
5
PORTREVISION=	0
6
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
7
MASTER_SITES=	https://www.net.princeton.edu/software/dhcp_probe/
7
MASTER_SITES=	https://www.net.princeton.edu/software/dhcp_probe/
8
8
Lines 11-19 COMMENT= Attempts to discover DHCP and BootP servers on a network Link Here
11
11
12
LICENSE=	GPLv2 LGPL20 addl
12
LICENSE=	GPLv2 LGPL20 addl
13
LICENSE_COMB=	multi
13
LICENSE_COMB=	multi
14
LICENSE_NAME_addl=Additional legal notices for copyrighted code
14
LICENSE_FILE_GPLv2=${WRKSRC}/COPYING.GPL
15
LICENSE_FILE_GPLv2=${WRKSRC}/COPYING.GPL
15
LICENSE_FILE_LGPL20=${WRKSRC}/COPYING.LIB
16
LICENSE_FILE_LGPL20=${WRKSRC}/COPYING.LIB
16
LICENSE_NAME_addl=Additional legal notices for copyrighted code
17
LICENSE_FILE_addl=${WRKSRC}/COPYING
17
LICENSE_FILE_addl=${WRKSRC}/COPYING
18
LICENSE_PERMS_addl=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
18
LICENSE_PERMS_addl=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
19
19
Lines 26-31 USE_RC_SUBR= dhcp_probe Link Here
26
26
27
SUB_FILES=	pkg-message
27
SUB_FILES=	pkg-message
28
28
29
post-patch:
30
	@${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/src/defaults.h
29
post-install:
31
post-install:
30
	${INSTALL_DATA} ${WRKSRC}/extras/dhcp_probe.cf.sample \
32
	${INSTALL_DATA} ${WRKSRC}/extras/dhcp_probe.cf.sample \
31
		${STAGEDIR}${PREFIX}/etc
33
		${STAGEDIR}${PREFIX}/etc
(-)b/net-mgmt/dhcp_probe/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (dhcp_probe-1.3.0.tar.gz) = 227cd6a82a7fa4d989994cb076f18092bc2c82592ceaeb31c4fdd09294b9265f
1
TIMESTAMP = 1621520916
2
SIZE (dhcp_probe-1.3.0.tar.gz) = 211613
2
SHA256 (dhcp_probe-1.3.1.tar.gz) = cfd5b560348bc1cb6de835c13f3e9d9c102a7f1d08a38233d1a5942a31f0fc20
3
SIZE (dhcp_probe-1.3.1.tar.gz) = 246238
(-)b/net-mgmt/dhcp_probe/files/patch-extras_dhcp__probe.cf.sample (-4 / +4 lines)
Lines 1-11 Link Here
1
--- extras/dhcp_probe.cf.sample.orig   2015-02-01 16:55:58.000000000 -0500
1
--- extras/dhcp_probe.cf.sample.orig	2011-12-06 23:40:55 UTC
2
+++ extras/dhcp_probe.cf.sample        2015-02-01 16:56:16.000000000 -0500
2
+++ extras/dhcp_probe.cf.sample
3
@@ -124,7 +124,7 @@
3
@@ -124,7 +124,7 @@
4
 # Syntax:
4
 # Syntax:
5
 #    cycle_time num_seconds
5
 #    cycle_time num_seconds
6
6
 
7
-# cycle_wait_time 300
7
-# cycle_wait_time 300
8
+# cycle_time 300
8
+# cycle_time 300
9
9
 
10
 # ----------------------------------------------------------------------------------
10
 # ----------------------------------------------------------------------------------
11
 #
11
 #
(-)b/net-mgmt/dhcp_probe/files/patch-src_bootp.c (-22 / +5 lines)
Lines 1-14 Link Here
1
--- src/bootp.c.orig	2015-01-03 11:14:43.000000000 -0500
1
--- src/bootp.c.orig	2021-01-18 19:18:24 UTC
2
+++ src/bootp.c	2015-01-16 00:27:42.000000000 -0500
2
+++ src/bootp.c
3
@@ -11,6 +11,7 @@
3
@@ -21,7 +21,7 @@ unsigned char vendor_option_vm_cookie_rfc1048[] = VEND
4
 #include "bootp.h"
5
 #include "configfile.h"
6
 #include "report.h"
7
+#include "utils.h"
8
 
9
 
10
 
11
@@ -20,7 +21,7 @@
12
 unsigned char vendor_option_end[] = VENDOR_OPTION_END;
4
 unsigned char vendor_option_end[] = VENDOR_OPTION_END;
13
 unsigned char vendor_option_dhcpmessagetype_dhcpdiscover[] = VENDOR_OPTION_DHCPDISCOVER;
5
 unsigned char vendor_option_dhcpmessagetype_dhcpdiscover[] = VENDOR_OPTION_DHCPDISCOVER;
14
 unsigned char vendor_option_dhcpmessagetype_dhcprequest[]  = VENDOR_OPTION_DHCPREQUEST;
6
 unsigned char vendor_option_dhcpmessagetype_dhcprequest[]  = VENDOR_OPTION_DHCPREQUEST;
Lines 17-32 Link Here
17
 unsigned char vendor_option_serverid[1 + 1 + 4]; /* option code, length byte, ip_addr */
9
 unsigned char vendor_option_serverid[1 + 1 + 4]; /* option code, length byte, ip_addr */
18
 unsigned char vendor_option_requestedipaddr[1 + 1 + 4]; /* option code, length byte, ip_addr */
10
 unsigned char vendor_option_requestedipaddr[1 + 1 + 4]; /* option code, length byte, ip_addr */
19
 
11
 
20
@@ -73,7 +74,7 @@
12
@@ -125,7 +125,7 @@ build_dhcp_packet(enum dhcp_flavor_t flavor)
21
 		char label[NUM_FLAVORS_MAXSTRING];
22
 		snprintf(label, sizeof(label)-1, "%d", i);
23
 		if (libnet_cq_add(l, label) == -1) {
24
-			report(LOG_ERR, "init_libnet_context_queue: libnet_cq_add: error adding libnet context '%s' to queue: %s", label, libnet_errbuf);
25
+			report(LOG_ERR, "init_libnet_context_queue: libnet_cq_add: error adding libnet context '%s' to queue: %s", label, libnet_geterror(l));
26
 			return(0);
27
 		}
28
 	}
29
@@ -124,7 +125,7 @@
30
 	packet->bootp_hlen = HLEN_ETHER;
13
 	packet->bootp_hlen = HLEN_ETHER;
31
 	packet->bootp_xid = BOOTP_XID;
14
 	packet->bootp_xid = BOOTP_XID;
32
 	packet->bootp_op = BOOTREQUEST;
15
 	packet->bootp_op = BOOTREQUEST;
Lines 35-41 Link Here
35
 
18
 
36
 	/* add RFC1048 cookie to options field */
19
 	/* add RFC1048 cookie to options field */
37
 	insert_option(&next_vendor_option, vendor_option_vm_cookie_rfc1048, sizeof(vendor_option_vm_cookie_rfc1048));
20
 	insert_option(&next_vendor_option, vendor_option_vm_cookie_rfc1048, sizeof(vendor_option_vm_cookie_rfc1048));
38
@@ -311,11 +312,11 @@
21
@@ -312,11 +312,11 @@ init_option_clientid(void)
39
 	vendor_option_clientid[0] = VENDOR_OPTION_CLIENTID;
22
 	vendor_option_clientid[0] = VENDOR_OPTION_CLIENTID;
40
 
23
 
41
 	/* length byte */
24
 	/* length byte */
(-)b/net-mgmt/dhcp_probe/files/patch-src_configfile.c (-11 / +12 lines)
Lines 1-9 Link Here
1
--- src/configfile.c.orig	2015-01-03 11:29:45.000000000 -0500
1
--- src/configfile.c.orig	2021-01-18 19:18:05 UTC
2
+++ src/configfile.c	2015-01-03 11:54:18.000000000 -0500
2
+++ src/configfile.c
3
@@ -20,12 +20,12 @@
3
@@ -21,13 +21,13 @@
4
 
5
 /* chaddr to use for bootp header 'chaddr' and to construct ClientID option */
4
 /* chaddr to use for bootp header 'chaddr' and to construct ClientID option */
6
 /* optionally specified by user; if unspecified, GetChaddr() returns my_eaddr */
5
 /* optionally specified by user; if unspecified, GetChaddr() returns my_eaddr */
6
 /* Is required if do_not_lookup_enet_and_ip_addresses is also specifed. */
7
-struct ether_addr chaddr; 
7
-struct ether_addr chaddr; 
8
+struct libnet_ether_addr chaddr; 
8
+struct libnet_ether_addr chaddr; 
9
 int is_chaddr_specified; /* flag */
9
 int is_chaddr_specified; /* flag */
Lines 11-22 Link Here
11
-/* ether_addr to use for ethernet frame src */
11
-/* ether_addr to use for ethernet frame src */
12
+/* libnet_ether_addr to use for ethernet frame src */
12
+/* libnet_ether_addr to use for ethernet frame src */
13
 /* optionally specified by user; if unspecified, GetEther_src() returns my_eaddr */
13
 /* optionally specified by user; if unspecified, GetEther_src() returns my_eaddr */
14
 /* Is required if do_not_lookup_enet_and_ip_addresses is also specifed. */
14
-struct ether_addr ether_src; 
15
-struct ether_addr ether_src; 
15
+struct libnet_ether_addr ether_src; 
16
+struct libnet_ether_addr ether_src; 
16
 int is_ether_src_specified; /* flag */
17
 int is_ether_src_specified; /* flag */
17
 
18
 
18
 /* An ipaddr to use for "Server Identifer" option  (when this is needed)
19
 /* An ipaddr to use for "Server Identifer" option  (when this is needed)
19
@@ -50,7 +50,7 @@
20
@@ -52,7 +52,7 @@ struct in_addr legal_servers[MAX_LEGAL_SERVERS];
20
 int num_legal_servers;
21
 int num_legal_servers;
21
 
22
 
22
 /* array of legal DHCP servers' ethersrc addresses, and number elems in array */
23
 /* array of legal DHCP servers' ethersrc addresses, and number elems in array */
Lines 25-40 Link Here
25
 int num_legal_server_ethersrcs;
26
 int num_legal_server_ethersrcs;
26
 
27
 
27
 /* parallel arrays of "lease networks of concern" (address & mask), and number of elems in arrays.
28
 /* parallel arrays of "lease networks of concern" (address & mask), and number of elems in arrays.
28
@@ -85,7 +85,7 @@
29
@@ -95,7 +95,7 @@ read_configfile(const char *fname)
29
 	int tokens; /* number of tokens successfully read by sscanf */
30
 	int tokens; /* number of tokens successfully read by sscanf */
30
 	int tmpint;
31
 	int tmpint;
31
 	unsigned int tmpuint;
32
 	unsigned int tmpuint;
32
-	struct ether_addr *enet;
33
-	struct ether_addr *enet;
33
+	struct libnet_ether_addr *enet;
34
+	struct libnet_ether_addr *enet;
34
 	struct in_addr inaddr, inaddr2;
35
 	struct in_addr inaddr, inaddr2;
36
 	int is_fatal_error;
35
 	
37
 	
36
 	/* init all values to defaults */
38
@@ -459,14 +459,14 @@ read_configfile(const char *fname)
37
@@ -420,14 +420,14 @@
38
 }
39
 }
39
 
40
 
40
 
41
 
Lines 51-57 Link Here
51
 
52
 
52
 	/* we re-init the static copy on each call, since we don't know if the
53
 	/* we re-init the static copy on each call, since we don't know if the
53
 	   	caller has written into it. */
54
 	   	caller has written into it. */
54
@@ -442,14 +442,14 @@
55
@@ -481,14 +481,14 @@ GetChaddr (void)
55
 }
56
 }
56
 
57
 
57
 
58
 
Lines 68-74 Link Here
68
 
69
 
69
 	/* we re-init the static copy on each call, since we don't know if the
70
 	/* we re-init the static copy on each call, since we don't know if the
70
 	   	caller has written into it. */
71
 	   	caller has written into it. */
71
@@ -555,7 +555,7 @@
72
@@ -594,7 +594,7 @@ isInLeaseNetworksOfConcern(struct in_addr *ipaddr)
72
 }
73
 }
73
 
74
 
74
 int
75
 int
Lines 77-83 Link Here
77
 {
78
 {
78
 /* If eaddr is a member of legal_server_ethersrcs[], return true.
79
 /* If eaddr is a member of legal_server_ethersrcs[], return true.
79
    If legal_server_ethersrcs[] is empty, also return true.
80
    If legal_server_ethersrcs[] is empty, also return true.
80
@@ -576,7 +576,7 @@
81
@@ -615,7 +615,7 @@ isLegalServerEthersrcsMember(struct ether_addr *eaddr)
81
 		return 1;
82
 		return 1;
82
 
83
 
83
 	for (i = 0; i < num_legal_server_ethersrcs; i++) {
84
 	for (i = 0; i < num_legal_server_ethersrcs; i++) {
(-)b/net-mgmt/dhcp_probe/files/patch-src_configfile.h (-3 / +3 lines)
Lines 1-5 Link Here
1
--- src/configfile.h.orig	2015-01-03 11:29:51.000000000 -0500
1
--- src/configfile.h.orig	2021-01-18 19:16:10 UTC
2
+++ src/configfile.h	2015-01-03 11:40:09.000000000 -0500
2
+++ src/configfile.h
3
@@ -6,14 +6,14 @@
3
@@ -6,14 +6,14 @@
4
 int read_configfile(const char *fname);
4
 int read_configfile(const char *fname);
5
 
5
 
Lines 16-20 Link Here
16
-int isLegalServerEthersrcsMember(struct ether_addr *eaddr);
16
-int isLegalServerEthersrcsMember(struct ether_addr *eaddr);
17
+int isLegalServerEthersrcsMember(struct libnet_ether_addr *eaddr);
17
+int isLegalServerEthersrcsMember(struct libnet_ether_addr *eaddr);
18
 int isInLeaseNetworksOfConcern(struct in_addr *ipaddr);
18
 int isInLeaseNetworksOfConcern(struct in_addr *ipaddr);
19
 int GetDo_not_lookup_enet_and_ip_addresses(void);
19
 
20
 
20
 char * GetAlert_program_name(void);
(-)b/net-mgmt/dhcp_probe/files/patch-src_defs.h (-3 / +17 lines)
Lines 1-6 Link Here
1
--- src/defs.h.orig	2015-01-03 11:21:50.000000000 -0500
1
--- src/defs.h.orig	2021-01-18 19:16:10 UTC
2
+++ src/defs.h	2015-01-03 11:50:57.000000000 -0500
2
+++ src/defs.h
3
@@ -154,17 +154,21 @@
3
@@ -154,16 +154,16 @@ extern int inet_aton(const char *, struct in_addr *);
4
 
4
 
5
 /* Prototypes for these routines are missing from some systems. */
5
 /* Prototypes for these routines are missing from some systems. */
6
 #if !HAVE_DECL_ETHER_NTOA
6
 #if !HAVE_DECL_ETHER_NTOA
Lines 20-25 Link Here
20
+extern int ether_hostton (const char *hostname, struct libnet_ether_addr *e);
20
+extern int ether_hostton (const char *hostname, struct libnet_ether_addr *e);
21
 #endif
21
 #endif
22
 
22
 
23
 #ifndef ETHERTYPE_IP
24
@@ -179,11 +179,16 @@ extern int ether_hostton (const char *hostname, struct
25
    We'll have to rely on our own definition.
26
 */
27
 typedef struct my_ether_vlan_header {
28
-	struct ether_addr	ether_dhost;
29
-	struct ether_addr	ether_shost;
30
+	struct libnet_ether_addr	ether_dhost;
31
+	struct libnet_ether_addr	ether_shost;
32
 	uint16_t			ether_tpid; /* == 0x8100 == ETHERTYPE_VLAN */
33
 	uint16_t			ether_tci;  /* user_pri, cfi, vid */
34
 	uint16_t			ether_type;
35
 } my_ether_vlan_header_t;
36
+
23
+/* libnet 1.1.3+ has ether_addr_octet in struct libnet_ether_addr{} */
37
+/* libnet 1.1.3+ has ether_addr_octet in struct libnet_ether_addr{} */
24
+#ifndef STRUCT_ETHER_ADDR_HAS_ETHER_ADDR_OCTET
38
+#ifndef STRUCT_ETHER_ADDR_HAS_ETHER_ADDR_OCTET
25
+#define STRUCT_ETHER_ADDR_HAS_ETHER_ADDR_OCTET 1
39
+#define STRUCT_ETHER_ADDR_HAS_ETHER_ADDR_OCTET 1
(-)b/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.c (-84 / +40 lines)
Lines 1-6 Link Here
1
--- src/dhcp_probe.c.orig	2015-01-03 11:16:23.000000000 -0500
1
--- src/dhcp_probe.c.orig	2021-01-18 19:17:29 UTC
2
+++ src/dhcp_probe.c	2015-01-17 11:44:33.000000000 -0500
2
+++ src/dhcp_probe.c
3
@@ -69,7 +69,7 @@
3
@@ -70,7 +70,7 @@ pcap_dumper_t *pcap_dump_d = NULL;	/* libpcap - dump d
4
 enum dhcp_flavor_t packet_flavors[] = {BOOTP, DHCP_INIT, DHCP_SELECTING, DHCP_INIT_REBOOT, DHCP_REBINDING};
4
 enum dhcp_flavor_t packet_flavors[] = {BOOTP, DHCP_INIT, DHCP_SELECTING, DHCP_INIT_REBOOT, DHCP_REBINDING};
5
 
5
 
6
 char *ifname;
6
 char *ifname;
Lines 9-54 Link Here
9
 
9
 
10
 int use_8021q = 0;
10
 int use_8021q = 0;
11
 int vlan_id = 0;
11
 int vlan_id = 0;
12
@@ -96,7 +96,7 @@
12
@@ -95,7 +95,7 @@ main(int argc, char **argv)
13
 	bpf_u_int32 netnumber,  netmask;
13
 	/* for libpcap */
14
 	struct bpf_program bpf_code;
14
 	struct bpf_program bpf_code;
15
 	int linktype;
15
 	int linktype;
16
-	char pcap_errbuf[PCAP_ERRBUF_SIZE], pcap_errbuf2[PCAP_ERRBUF_SIZE];
16
-	char pcap_errbuf[PCAP_ERRBUF_SIZE], pcap_errbuf2[PCAP_ERRBUF_SIZE];
17
+	char pcap_errbuf[PCAP_ERRBUF_SIZE];
17
+	char pcap_errbuf[PCAP_ERRBUF_SIZE];
18
 
18
 
19
 	/* for libnet */
19
 	/* get progname = last component of argv[0] */
20
 	char libnet_errbuf[LIBNET_ERRBUF_SIZE];
20
 	prog = strrchr(argv[0], '/');
21
@@ -228,6 +228,7 @@
21
@@ -416,7 +416,7 @@ main(int argc, char **argv)
22
 		/* ignore SIGHUP */
23
 		sigemptyset(&sa.sa_mask);
24
 		sa.sa_handler = SIG_IGN;
25
+		sa.sa_flags = 0;
26
 		if (sigaction(SIGHUP, &sa, NULL) < 0) {
27
 			report(LOG_ERR, "sigaction: %s", get_errmsg());
28
 			my_exit(1, 0, 1);
29
@@ -236,6 +237,7 @@
30
 	/* ignore SIGUSR1 */
31
 	sigemptyset(&sa.sa_mask);
32
 	sa.sa_handler = SIG_IGN;
33
+	sa.sa_flags = 0;
34
 	if (sigaction(SIGUSR1, &sa, NULL) < 0) {
35
 		report(LOG_ERR, "sigaction: %s", get_errmsg());
36
 		my_exit(1, 0, 1);
37
@@ -243,12 +245,12 @@
38
 	/* ignore SIGUSR2 */
39
 	sigemptyset(&sa.sa_mask);
40
 	sa.sa_handler = SIG_IGN;
41
+	sa.sa_flags = 0;
42
 	if (sigaction(SIGUSR2, &sa, NULL) < 0) {
43
 		report(LOG_ERR, "sigaction: %s", get_errmsg());
44
 		my_exit(1, 0, 1);
45
 	}
46
 
47
-
48
 	/* write pid file as soon as possible after (possibly) forking */
49
 	if ((pid_fp = open_for_writing(pid_file)) == NULL) {
50
 		report(LOG_ERR, "could not open pid file %s for writing", pid_file);
51
@@ -401,7 +403,7 @@
52
 		*/
22
 		*/
53
 		pcap_errbuf[0] = '\0'; /* so we can tell if a warning was produced on success */
23
 		pcap_errbuf[0] = '\0'; /* so we can tell if a warning was produced on success */
54
 		if ((pd_template = pcap_open_live(ifname, snaplen, 0, 1, pcap_errbuf)) == NULL) {
24
 		if ((pd_template = pcap_open_live(ifname, snaplen, 0, 1, pcap_errbuf)) == NULL) {
Lines 57-63 Link Here
57
 			my_exit(1, 1, 1);
27
 			my_exit(1, 1, 1);
58
 		}
28
 		}
59
 		if (pcap_errbuf[0] != '\0')
29
 		if (pcap_errbuf[0] != '\0')
60
@@ -470,8 +472,8 @@
30
@@ -485,8 +485,8 @@ main(int argc, char **argv)
61
 		   it's possible there's a server out there that does it wrong, and might therefore mistakenly
31
 		   it's possible there's a server out there that does it wrong, and might therefore mistakenly
62
 		   send responses to ether_src.  So lets also listen promiscuously if ether_src != my_eaddr.
32
 		   send responses to ether_src.  So lets also listen promiscuously if ether_src != my_eaddr.
63
 		*/
33
 		*/
Lines 68-99 Link Here
68
 			promiscuous = 1;
38
 			promiscuous = 1;
69
 		else
39
 		else
70
 			promiscuous = 0;
40
 			promiscuous = 0;
71
@@ -699,8 +701,8 @@
41
@@ -775,9 +775,9 @@ process_response(u_char *user, const struct pcap_pkthd
72
    When we return, control returns to pcap_dispatch() so it can continue capturing packets.
42
    When we return, control returns to pcap_dispatch() so it can continue capturing packets.
73
 */
43
 */
74
 
44
 
75
-	struct ether_header *ether_header; /* access ethernet header */
45
-	struct ether_header *ether_header; /* access ethernet header */
76
-	struct ip *ip_header;				/* access ip header */
77
+	struct libnet_ethernet_hdr *ether_header; /* access ethernet header */
46
+	struct libnet_ethernet_hdr *ether_header; /* access ethernet header */
47
 	struct my_ether_vlan_header *my_ether_vlan_header; /* possibly access ethernet 802.1Q header */
48
-	struct ip *ip_header;				/* access ip header */
78
+	struct libnet_ipv4_hdr *ip_header;				/* access ip header */
49
+	struct libnet_ipv4_hdr *ip_header;				/* access ip header */
79
 	bpf_u_int32 ether_len;		/* bpf_u_int32 from pcap.h */
50
 	bpf_u_int32 ether_len;		/* bpf_u_int32 from pcap.h */
80
 	struct udphdr *udp_header; /* access UDP header */
51
 	struct udphdr *udp_header; /* access UDP header */
81
 	struct bootp *bootp_pkt; /* access bootp/dhcp packet */
52
 	struct bootp *bootp_pkt; /* access bootp/dhcp packet */
82
@@ -710,7 +712,7 @@
53
@@ -787,10 +787,10 @@ process_response(u_char *user, const struct pcap_pkthd
83
 	int isLegalServer;			/* boolean */
54
 	int isLegalServer;			/* boolean */
84
 
55
 
85
 	/* fields parsed out from packet*/
56
 	/* fields parsed out from packet*/
86
-	struct ether_addr ether_dhost, ether_shost;
57
-	struct ether_addr ether_dhost, ether_shost;
87
+	struct libnet_ether_addr ether_dhost, ether_shost;
58
+	struct libnet_ether_addr ether_dhost, ether_shost;
59
 	uint16_t ether_type, ether_type_inner;
60
 	uint16_t ether_vid;
61
-	size_t ether_or_vlan_header_len; 	/* = sizeof(struct ether_header) or sizeof(struct my_ether_vlan_header) depending on response packet */
62
+	size_t ether_or_vlan_header_len; 	/* = sizeof(struct libnet_ethernet_hdr) or sizeof(struct my_ether_vlan_header) depending on response packet */
88
 	struct in_addr ip_src, ip_dst, yiaddr;
63
 	struct in_addr ip_src, ip_dst, yiaddr;
89
 	/* string versions of same */
64
 	/* string versions of same */
90
 	char ether_dhost_str[MAX_ETHER_ADDR_STR], ether_shost_str[MAX_ETHER_ADDR_STR];
65
 	char ether_dhost_str[MAX_ETHER_ADDR_STR], ether_shost_str[MAX_ETHER_ADDR_STR];
91
@@ -729,13 +731,13 @@
66
@@ -810,13 +810,13 @@ process_response(u_char *user, const struct pcap_pkthd
92
 		return;
67
 		return;
93
 	}
68
 	}
94
 
69
 
95
-	if ((ether_len < sizeof(sizeof(struct ether_header))) && (debug > 1)) {
70
-	if ((ether_len < sizeof(struct ether_header)) && (debug > 1)) {
96
+	if ((ether_len < sizeof(sizeof(struct libnet_ethernet_hdr))) && (debug > 1)) {
71
+	if ((ether_len < sizeof(struct libnet_ethernet_hdr)) && (debug > 1)) {
97
 		report(LOG_WARNING, "interface %s, short packet (got %d bytes, smaller than an Ethernet header)", ifname, ether_len);
72
 		report(LOG_WARNING, "interface %s, short packet (got %d bytes, smaller than an Ethernet header)", ifname, ether_len);
98
 		return;
73
 		return;
99
 	}
74
 	}
Lines 102-154 Link Here
102
-	ether_header = (struct ether_header *) packet;
77
-	ether_header = (struct ether_header *) packet;
103
+	ether_header = (struct libnet_ethernet_hdr *) packet;
78
+	ether_header = (struct libnet_ethernet_hdr *) packet;
104
 
79
 
105
 	/* parse fields out of ethernet header for easier access */
80
     /* we may use my_ether_vlan_header to access the Ethernet 801.Q header */
106
 	bcopy(&(ether_header->ether_dhost), &ether_dhost, sizeof(ether_dhost));
81
     my_ether_vlan_header = (struct my_ether_vlan_header *) packet;
107
@@ -747,13 +749,13 @@
82
@@ -835,7 +835,7 @@ process_response(u_char *user, const struct pcap_pkthd
108
 	if (debug > 10)
83
 		report(LOG_DEBUG, "     interface %s, from ether %s to %s type %s", ifname, ether_shost_str, ether_dhost_str, ether_type_str);
109
 		report(LOG_DEBUG, "     interface %s, from ether %s to %s", ifname, ether_shost_str, ether_dhost_str);
110
 
84
 
111
-	if (ether_len < sizeof(sizeof(struct ether_header)) + sizeof(struct ip)) {
85
 	if (ether_type == ETHERTYPE_IP) {
112
+	if (ether_len < sizeof(sizeof(struct libnet_ethernet_hdr)) + sizeof(struct libnet_ipv4_hdr)) {
86
-		ether_or_vlan_header_len = sizeof(struct ether_header);
113
 		report(LOG_WARNING, "interface %s, ether src %s: short packet (got %d bytes, smaller than IP header in Ethernet)", ifname, ether_shost_str, ether_len);
87
+		ether_or_vlan_header_len = sizeof(struct libnet_ethernet_hdr);
114
 		return;
115
 	}	
116
 
88
 
117
 	/* we use ip_header to access the IP header */
89
 	} else if (ether_type == ETHERTYPE_VLAN) {
118
-	ip_header = (struct ip *) (packet + sizeof(struct ether_header));
119
+	ip_header = (struct libnet_ipv4_hdr *) (packet + sizeof(struct libnet_ethernet_hdr));
120
 
90
 
121
 	/* parse fields out of ip header for easier access */
91
@@ -880,13 +880,13 @@ process_response(u_char *user, const struct pcap_pkthd
122
 	bcopy(&(ip_header->ip_src), &ip_src, sizeof(ip_header->ip_src));
92
 	   Else if the frame is tagged, ether_or_vlan_header_len is now set to the length of the ethernet VLAN header.
123
@@ -768,15 +770,15 @@
93
 	*/
124
 	ip_header_len_bytes = ip_header->ip_hl << 2;
125
 
94
 
126
 	/* Repeat the packet size check (through IP header), but taking into account ip_header_len_bytes */
95
-	if (ether_len < ether_or_vlan_header_len + sizeof(struct ip)) {
127
-	if (ether_len < sizeof(sizeof(struct ether_header)) + ip_header_len_bytes) {
96
+	if (ether_len < ether_or_vlan_header_len + sizeof(struct libnet_ipv4_hdr)) {
128
+	if (ether_len < sizeof(sizeof(struct libnet_ethernet_hdr)) + ip_header_len_bytes) {
97
 		report(LOG_WARNING, "interface %s, ether src %s type %s: short packet (got %d bytes, smaller than IP header in Ethernet)", ifname, ether_shost_str, ether_type_str, ether_len);
129
 		report(LOG_WARNING, "interface %s, short packet (got %d bytes, smaller than IP header in Ethernet)", ifname, ether_len);
130
 		return;
98
 		return;
131
 	}	
99
 	}	
132
 
100
 
133
 	/* we use udp_header to access the UDP header */
101
 	/* we use ip_header to access the IP header */
134
-	udp_header = (struct udphdr *) (packet + sizeof(struct ether_header) + ip_header_len_bytes);
102
-	ip_header = (struct ip *) (packet + ether_or_vlan_header_len);
135
+	udp_header = (struct udphdr *) (packet + sizeof(struct libnet_ethernet_hdr) + ip_header_len_bytes);
103
+	ip_header = (struct libnet_ipv4_hdr *) (packet + ether_or_vlan_header_len);
136
 
137
-	if (ether_len <  sizeof(sizeof(struct ether_header)) + ip_header_len_bytes + sizeof(struct udphdr)) {
138
+	if (ether_len <  sizeof(sizeof(struct libnet_ethernet_hdr)) + ip_header_len_bytes + sizeof(struct udphdr)) {
139
 		report(LOG_WARNING, "interface %s ether src %s: short packet (got %d bytes, smaller than UDP/IP header in Ethernet)", ifname, ether_shost_str, ether_len);
140
 		return;
141
 	}	
142
@@ -800,7 +802,7 @@
143
 	}
144
 
145
 	/* we use bootp_pkt to access the bootp/dhcp packet */
146
-	bootp_pkt = (struct bootp *) (packet + sizeof(struct ether_header) + ip_header_len_bytes + sizeof(struct udphdr));
147
+	bootp_pkt = (struct bootp *) (packet + sizeof(struct libnet_ethernet_hdr) + ip_header_len_bytes + sizeof(struct udphdr));
148
 
104
 
149
 	/* Make sure the packet is in response to our query, otherwise ignore it.
105
 	/* parse fields out of ip header for easier access */
150
 	   Our query had bootp_htype=HTYPE_ETHER, bootp_hlen=HLEN_ETHER, and bootp_chaddr=GetChaddr().
106
 	bcopy(&(ip_header->ip_src), &ip_src, sizeof(ip_header->ip_src));
151
@@ -820,7 +822,7 @@
107
@@ -953,7 +953,7 @@ process_response(u_char *user, const struct pcap_pkthd
152
 
108
 
153
 	if (bcmp(bootp_pkt->bootp_chaddr, GetChaddr(), HLEN_ETHER)) {
109
 	if (bcmp(bootp_pkt->bootp_chaddr, GetChaddr(), HLEN_ETHER)) {
154
 		if (debug > 10) {
110
 		if (debug > 10) {
(-)b/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.h (-3 / +3 lines)
Lines 1-6 Link Here
1
--- src/dhcp_probe.h.orig	2015-01-03 11:43:49.000000000 -0500
1
--- src/dhcp_probe.h.orig	2021-01-18 19:16:27 UTC
2
+++ src/dhcp_probe.h	2015-01-03 11:44:11.000000000 -0500
2
+++ src/dhcp_probe.h
3
@@ -18,7 +18,7 @@
3
@@ -18,7 +18,7 @@ extern int vlan_id;
4
 
4
 
5
 extern int sockfd; /* general purpose datagram socket fd for temp use throughout */
5
 extern int sockfd; /* general purpose datagram socket fd for temp use throughout */
6
 
6
 
(-)b/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.c (-5 / +5 lines)
Lines 1-5 Link Here
1
--- src/get_myeaddr.c.orig	2015-01-03 11:44:45.000000000 -0500
1
--- src/get_myeaddr.c.orig	2021-01-18 19:16:15 UTC
2
+++ src/get_myeaddr.c	2015-01-03 11:45:40.000000000 -0500
2
+++ src/get_myeaddr.c
3
@@ -55,7 +55,7 @@
3
@@ -55,7 +55,7 @@
4
 
4
 
5
 
5
 
Lines 9-15 Link Here
9
 {
9
 {
10
 /* If SIOCGIFHWADDR is defined, 
10
 /* If SIOCGIFHWADDR is defined, 
11
      We use the SIOCGIFHWADDR ioctl to do our work as follows:
11
      We use the SIOCGIFHWADDR ioctl to do our work as follows:
12
@@ -92,7 +92,7 @@
12
@@ -92,7 +92,7 @@ get_myeaddr(int sockfd, struct in_addr *my_ipaddr, str
13
 		return(-1);
13
 		return(-1);
14
 	}
14
 	}
15
 
15
 
Lines 18-24 Link Here
18
 
18
 
19
 #elif defined SIOCGARP /* not SIOCGIFHWADDR */
19
 #elif defined SIOCGARP /* not SIOCGIFHWADDR */
20
 
20
 
21
@@ -154,7 +154,7 @@
21
@@ -154,7 +154,7 @@ get_myeaddr(int sockfd, struct in_addr *my_ipaddr, str
22
 		return(-1);
22
 		return(-1);
23
 	}
23
 	}
24
 
24
 
Lines 27-33 Link Here
27
 
27
 
28
 #elif defined HAVE_GETIFADDRS /* not SIOCGARP */
28
 #elif defined HAVE_GETIFADDRS /* not SIOCGARP */
29
 
29
 
30
@@ -180,7 +180,7 @@
30
@@ -180,7 +180,7 @@ get_myeaddr(int sockfd, struct in_addr *my_ipaddr, str
31
 				found = 1;
31
 				found = 1;
32
 				/* copy the result to my_eaddr */
32
 				/* copy the result to my_eaddr */
33
 				sdl = (struct sockaddr_dl *) ifp->ifa_addr;
33
 				sdl = (struct sockaddr_dl *) ifp->ifa_addr;
(-)b/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.h (-2 / +2 lines)
Lines 1-5 Link Here
1
--- src/get_myeaddr.h.orig	2015-01-03 11:44:55.000000000 -0500
1
--- src/get_myeaddr.h.orig	2004-10-28 17:34:27 UTC
2
+++ src/get_myeaddr.h	2015-01-03 11:45:52.000000000 -0500
2
+++ src/get_myeaddr.h
3
@@ -1,6 +1,6 @@
3
@@ -1,6 +1,6 @@
4
 #ifndef GET_MYEADDR_H
4
 #ifndef GET_MYEADDR_H
5
 #define GET_MYEADDR_H
5
 #define GET_MYEADDR_H

Return to bug 256053