git: 2c9daf663dd7 - main - net-mgmt/dhcp_probe: Update to 1.3.1

Neel Chauhan nc at FreeBSD.org
Sat May 22 17:41:19 UTC 2021


The branch main has been updated by nc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2c9daf663dd7190d1495c2b6120e9dd2bbb8244b

commit 2c9daf663dd7190d1495c2b6120e9dd2bbb8244b
Author:     Kevin Hung <khung at nullaxiom.com>
AuthorDate: 2021-05-22 17:40:42 +0000
Commit:     Neel Chauhan <nc at FreeBSD.org>
CommitDate: 2021-05-22 17:41:20 +0000

    net-mgmt/dhcp_probe: Update to 1.3.1
    
    PR:     256053
---
 net-mgmt/dhcp_probe/Makefile                       |   8 +-
 net-mgmt/dhcp_probe/distinfo                       |   5 +-
 ...f.sample => patch-extras_dhcp__probe.cf.sample} |   8 +-
 net-mgmt/dhcp_probe/files/patch-src_bootp.c        |  27 +----
 net-mgmt/dhcp_probe/files/patch-src_configfile.c   |  23 ++--
 net-mgmt/dhcp_probe/files/patch-src_configfile.h   |   6 +-
 net-mgmt/dhcp_probe/files/patch-src_daemonize.c    |  10 --
 net-mgmt/dhcp_probe/files/patch-src_defs.h         |  20 +++-
 net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.c  | 124 +++++++--------------
 net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.h  |   6 +-
 net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.c |  10 +-
 net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.h |   4 +-
 12 files changed, 99 insertions(+), 152 deletions(-)

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


More information about the dev-commits-ports-all mailing list