svn commit: r380712 - in head/net-mgmt: . dhcp_probe dhcp_probe/files

Thomas Zander riggs at FreeBSD.org
Sat Mar 7 18:33:22 UTC 2015


Author: riggs
Date: Sat Mar  7 18:33:16 2015
New Revision: 380712
URL: https://svnweb.freebsd.org/changeset/ports/380712
QAT: https://qat.redports.org/buildarchive/r380712/

Log:
  Initial import of net-mgmt/dhcp_probe, a tool to
  discover DHCP and BootP servers on a network
  
  PR:		197162
  Submitted by:	khung at nullaxiom.com (maintainer)

Added:
  head/net-mgmt/dhcp_probe/
  head/net-mgmt/dhcp_probe/Makefile   (contents, props changed)
  head/net-mgmt/dhcp_probe/distinfo   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/
  head/net-mgmt/dhcp_probe/files/dhcp_probe.in   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-Makefile.am   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-extras-dhcp__probe.cf.sample   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_bootp.c   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_configfile.c   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_configfile.h   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_daemonize.c   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_defs.h   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.c   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.h   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.c   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.h   (contents, props changed)
  head/net-mgmt/dhcp_probe/files/pkg-message.in   (contents, props changed)
  head/net-mgmt/dhcp_probe/pkg-descr   (contents, props changed)
  head/net-mgmt/dhcp_probe/pkg-plist   (contents, props changed)
Modified:
  head/net-mgmt/Makefile

Modified: head/net-mgmt/Makefile
==============================================================================
--- head/net-mgmt/Makefile	Sat Mar  7 17:53:51 2015	(r380711)
+++ head/net-mgmt/Makefile	Sat Mar  7 18:33:16 2015	(r380712)
@@ -49,6 +49,7 @@
     SUBDIR += devmon
     SUBDIR += devmon-templates
     SUBDIR += dhcdrop
+    SUBDIR += dhcp_probe
     SUBDIR += disco
     SUBDIR += docsis
     SUBDIR += driftnet

Added: head/net-mgmt/dhcp_probe/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/Makefile	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,40 @@
+# Created by: Kevin Hung <khung at nullaxiom.com>
+# $FreeBSD$
+
+PORTNAME=	dhcp_probe
+PORTVERSION=	1.3.0
+CATEGORIES=	net-mgmt
+MASTER_SITES=	https://www.net.princeton.edu/software/dhcp_probe/
+
+MAINTAINER=	khung at nullaxiom.com
+COMMENT=	Attempts to discover DHCP and BootP servers on a network
+
+LICENSE=	GPLv2 addl
+LICENSE_COMB=	multi
+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
+
+LIB_DEPENDS=	libnet.so:${PORTSDIR}/net/libnet
+
+USE_AUTOTOOLS=	aclocal automake
+AUTOMAKE_ARGS=	-a
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-libnet-include=${LOCALBASE}/include/libnet11/ --with-libnet-lib=${LOCALBASE}/lib/libnet11/
+MANPREFIX=	${PREFIX}
+
+USE_RC_SUBR=	dhcp_probe
+
+SUB_FILES=	pkg-message
+
+# Put additional licenses in DOCS
+PORTDOCS=	COPYING*
+
+# Can't use INSTALL_PROGRAM macro as we need to patch Makefile.am and
+# regenerate Makefile.in
+post-install:
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/dhcp_probe
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_MAN} ${WRKSRC}/COPYING* ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>

Added: head/net-mgmt/dhcp_probe/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/distinfo	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,2 @@
+SHA256 (dhcp_probe-1.3.0.tar.gz) = 227cd6a82a7fa4d989994cb076f18092bc2c82592ceaeb31c4fdd09294b9265f
+SIZE (dhcp_probe-1.3.0.tar.gz) = 211613

Added: head/net-mgmt/dhcp_probe/files/dhcp_probe.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/dhcp_probe.in	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: dhcp_probe
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable dhcp_probe:
+#
+# dhcp_probe_enable="YES"
+# dhcp_probe_flags="<interface>"
+
+. /etc/rc.subr
+
+name=dhcp_probe
+desc="Attempts to discover DHCP and BootP servers on a network."
+rcvar=dhcp_probe_enable
+
+load_rc_config $name
+
+: ${dhcp_probe_enable:="NO"}
+: ${dhcp_probe_config="%%PREFIX%%/etc/dhcp_probe.cf"}
+
+command=%%PREFIX%%/sbin/${name}
+
+start_precmd="${name}_prestart"
+
+dhcp_probe_prestart()
+{
+	# The interface (rc_flags) has to go after the config file argument
+	rc_flags="-c ${dhcp_probe_config} ${rc_flags}"
+	return 0
+}
+
+run_rc_command "$1"

Added: head/net-mgmt/dhcp_probe/files/patch-Makefile.am
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-Makefile.am	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,9 @@
+--- Makefile.am.orig	2015-01-28 01:27:58.000000000 -0500
++++ Makefile.am	2015-01-28 01:38:40.000000000 -0500
+@@ -25,3 +25,6 @@
+ 	extras/README
+ 
+ ACLOCAL_AMFLAGS = -I m4
++
++## Copy sample configuration file to PREFIX/etc/
++sysconf_DATA=	extras/dhcp_probe.cf.sample

Added: head/net-mgmt/dhcp_probe/files/patch-extras-dhcp__probe.cf.sample
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-extras-dhcp__probe.cf.sample	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +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
+@@ -124,7 +124,7 @@
+ # Syntax:
+ #    cycle_time num_seconds
+
+-# cycle_wait_time 300
++# cycle_time 300
+
+ # ----------------------------------------------------------------------------------
+ #

Added: head/net-mgmt/dhcp_probe/files/patch-src_bootp.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_bootp.c	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,51 @@
+--- 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 @@
+ 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;
+-unsigned char vendor_option_clientid[1 + 1 + 1 + sizeof(struct ether_addr)]; /* option code, length byte,  htype byte, ether_addr */
++unsigned char vendor_option_clientid[1 + 1 + 1 + sizeof(struct libnet_ether_addr)]; /* option code, length byte,  htype byte, ether_addr */
+ 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 @@
+ 	packet->bootp_hlen = HLEN_ETHER;
+ 	packet->bootp_xid = BOOTP_XID;
+ 	packet->bootp_op = BOOTREQUEST;
+-	bcopy(GetChaddr(), &packet->bootp_chaddr, sizeof(struct ether_addr));
++	bcopy(GetChaddr(), &packet->bootp_chaddr, sizeof(struct libnet_ether_addr));
+ 
+ 	/* 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 @@
+ 	vendor_option_clientid[0] = VENDOR_OPTION_CLIENTID;
+ 
+ 	/* length byte */
+-	vendor_option_clientid[1] = 1 + sizeof(struct ether_addr);
++	vendor_option_clientid[1] = 1 + sizeof(struct libnet_ether_addr);
+ 
+ 	/* fill in clientid value: htype code followed by enet addr */
+ 	vendor_option_clientid[2] = 0x01;
+-	bcopy(GetChaddr(), vendor_option_clientid+3, sizeof(struct ether_addr));
++	bcopy(GetChaddr(), vendor_option_clientid+3, sizeof(struct libnet_ether_addr));
+ 
+ 	return;
+ }

Added: head/net-mgmt/dhcp_probe/files/patch-src_configfile.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_configfile.c	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,88 @@
+--- 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 @@
+ 
+ /* chaddr to use for bootp header 'chaddr' and to construct ClientID option */
+ /* optionally specified by user; if unspecified, GetChaddr() returns my_eaddr */
+-struct ether_addr chaddr; 
++struct libnet_ether_addr chaddr; 
+ int is_chaddr_specified; /* flag */
+ 
+-/* 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 */
+-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 @@
+ int num_legal_servers;
+ 
+ /* array of legal DHCP servers' ethersrc addresses, and number elems in array */
+-struct ether_addr legal_server_ethersrcs[MAX_LEGAL_SERVER_ETHERSRCS];
++struct libnet_ether_addr legal_server_ethersrcs[MAX_LEGAL_SERVER_ETHERSRCS];
+ int num_legal_server_ethersrcs;
+ 
+ /* parallel arrays of "lease networks of concern" (address & mask), and number of elems in arrays.
+@@ -85,7 +85,7 @@
+ 	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;
+ 	
+ 	/* init all values to defaults */
+@@ -420,14 +420,14 @@
+ }
+ 
+ 
+-struct ether_addr *
++struct libnet_ether_addr *
+ GetChaddr (void)
+ {
+ /* Return copy of chaddr (if specified) else my_eaddr.
+    Not re-entrant; we use static storage to hold the value address we return.
+    Should not be called until global 'my_eaddr' has been init'd.
+ */
+-	static struct ether_addr chaddr_copy;
++	static struct libnet_ether_addr chaddr_copy;
+ 
+ 	/* 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 @@
+ }
+ 
+ 
+-struct ether_addr *
++struct libnet_ether_addr *
+ GetEther_src (void)
+ {
+ /* Return copy of ether_src (if specified) else my_eaddr.
+    Not re-entrant; we use static storage to hold the value address we return.
+    Should not be called until global 'my_eaddr' has been init'd.
+ */
+-	static struct ether_addr ether_src_copy;
++	static struct libnet_ether_addr ether_src_copy;
+ 
+ 	/* 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 @@
+ }
+ 
+ int
+-isLegalServerEthersrcsMember(struct ether_addr *eaddr)
++isLegalServerEthersrcsMember(struct libnet_ether_addr *eaddr)
+ {
+ /* If eaddr is a member of legal_server_ethersrcs[], return true.
+    If legal_server_ethersrcs[] is empty, also return true.
+@@ -576,7 +576,7 @@
+ 		return 1;
+ 
+ 	for (i = 0; i < num_legal_server_ethersrcs; i++) {
+-		if (!bcmp(eaddr, &legal_server_ethersrcs[i], sizeof(struct ether_addr))) 
++		if (!bcmp(eaddr, &legal_server_ethersrcs[i], sizeof(struct libnet_ether_addr))) 
+ 			return 1; /* found */
+ 	}
+ 	return 0; /* not found */

Added: head/net-mgmt/dhcp_probe/files/patch-src_configfile.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_configfile.h	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,20 @@
+--- src/configfile.h.orig	2015-01-03 11:29:51.000000000 -0500
++++ src/configfile.h	2015-01-03 11:40:09.000000000 -0500
+@@ -6,14 +6,14 @@
+ int read_configfile(const char *fname);
+ 
+ /* accessor functions for all the configuration file data */
+-struct ether_addr * GetChaddr (void);
+-struct ether_addr * GetEther_src (void);
++struct libnet_ether_addr * GetChaddr (void);
++struct libnet_ether_addr * GetEther_src (void);
+ struct in_addr * GetClient_ip_address(void);
+ struct in_addr * GetServer_id(void);
+ unsigned GetCycle_time(void);
+ int GetResponse_wait_time(void);
+ int isLegalServersMember(struct in_addr *ipaddr);
+-int isLegalServerEthersrcsMember(struct ether_addr *eaddr);
++int isLegalServerEthersrcsMember(struct libnet_ether_addr *eaddr);
+ int isInLeaseNetworksOfConcern(struct in_addr *ipaddr);
+ 
+ char * GetAlert_program_name(void);

Added: head/net-mgmt/dhcp_probe/files/patch-src_daemonize.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_daemonize.c	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,10 @@
+--- 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");

Added: head/net-mgmt/dhcp_probe/files/patch-src_defs.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_defs.h	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,28 @@
+--- 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 @@
+ 
+ /* Prototypes for these routines are missing from some systems. */
+ #if !HAVE_DECL_ETHER_NTOA
+-extern char *ether_ntoa (const struct ether_addr *e);
++extern char *ether_ntoa (const struct libnet_ether_addr *e);
+ #endif
+ #if !HAVE_DECL_ETHER_ATON
+-extern struct ether_addr *ether_aton(const char *hostname);
++extern struct libnet_ether_addr *ether_aton(const char *hostname);
+ #endif
+ #if !HAVE_DECL_ETHER_NTOHOST
+-extern int ether_ntohost (char *hostname, const struct ether_addr *e);
++extern int ether_ntohost (char *hostname, const struct libnet_ether_addr *e);
+ #endif
+ #if !HAVE_DECL_ETHER_HOSTTON
+-extern int ether_hostton (const char *hostname, struct ether_addr *e);
++extern int ether_hostton (const char *hostname, struct libnet_ether_addr *e);
+ #endif
+ 
++/* 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
++#endif
+ 
+ #endif /* not DEFS_H */

Added: head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.c	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,159 @@
+--- 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 @@
+ enum dhcp_flavor_t packet_flavors[] = {BOOTP, DHCP_INIT, DHCP_SELECTING, DHCP_INIT_REBOOT, DHCP_REBINDING};
+ 
+ char *ifname;
+-struct ether_addr my_eaddr;
++struct libnet_ether_addr my_eaddr;
+ 
+ int use_8021q = 0;
+ int vlan_id = 0;
+@@ -96,7 +96,7 @@
+ 	bpf_u_int32 netnumber,  netmask;
+ 	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 @@
+ 		*/
+ 		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) {
+-			report(LOG_ERR, "pcap_open_live %s: %s", ifname, pcap_errbuf2);
++			report(LOG_ERR, "pcap_open_live %s: %s", ifname, pcap_errbuf);
+ 			my_exit(1, 1, 1);
+ 		}
+ 		if (pcap_errbuf[0] != '\0')
+@@ -470,8 +472,8 @@
+ 		   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.
+ 		*/
+-		if (bcmp(GetChaddr(), &my_eaddr, sizeof(struct ether_addr)) ||
+-		    bcmp(GetEther_src(), &my_eaddr, sizeof(struct ether_addr)))
++		if (bcmp(GetChaddr(), &my_eaddr, sizeof(struct libnet_ether_addr)) ||
++		    bcmp(GetEther_src(), &my_eaddr, sizeof(struct libnet_ether_addr)))
+ 			promiscuous = 1;
+ 		else
+ 			promiscuous = 0;
+@@ -699,8 +701,8 @@
+    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 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 @@
+ 	int isLegalServer;			/* boolean */
+ 
+ 	/* fields parsed out from packet*/
+-	struct ether_addr ether_dhost, ether_shost;
++	struct libnet_ether_addr ether_dhost, ether_shost;
+ 	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 @@
+ 		return;
+ 	}
+ 
+-	if ((ether_len < sizeof(sizeof(struct ether_header))) && (debug > 1)) {
++	if ((ether_len < sizeof(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;
+ 	}
+ 
+ 	/* we use ether_header to access the Ethernet header */
+-	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);
+ 
+-	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;
+ 	}	
+ 
+ 	/* 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));
+ 
+ 	/* 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;
+ 
+ 	/* 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);
+ 		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));
+ 
+ 	/* 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 @@
+ 
+ 	if (bcmp(bootp_pkt->bootp_chaddr, GetChaddr(), HLEN_ETHER)) {
+ 		if (debug > 10) {
+-			struct ether_addr ether_tmp;
++			struct libnet_ether_addr ether_tmp;
+ 			char ether_tmp_str[MAX_ETHER_ADDR_STR];
+ 
+ 			/* create printable version of bootp_pkt->bootp_chaddr */

Added: head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_dhcp__probe.h	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,11 @@
+--- 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 @@
+ 
+ extern int sockfd; /* general purpose datagram socket fd for temp use throughout */
+ 
+-extern struct ether_addr my_eaddr;
++extern struct libnet_ether_addr my_eaddr;
+ 
+ 
+ 

Added: head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.c	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,38 @@
+--- 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
+@@ -55,7 +55,7 @@
+ 
+ 
+ int
+-get_myeaddr(int sockfd, struct in_addr *my_ipaddr, struct ether_addr *my_eaddr, const char *ifname)
++get_myeaddr(int sockfd, struct in_addr *my_ipaddr, struct libnet_ether_addr *my_eaddr, const char *ifname)
+ {
+ /* If SIOCGIFHWADDR is defined, 
+      We use the SIOCGIFHWADDR ioctl to do our work as follows:
+@@ -92,7 +92,7 @@
+ 		return(-1);
+ 	}
+ 
+-	bcopy(ifr.ifr_hwaddr.sa_data, my_eaddr, sizeof (struct ether_addr));
++	bcopy(ifr.ifr_hwaddr.sa_data, my_eaddr, sizeof (struct libnet_ether_addr));
+ 
+ #elif defined SIOCGARP /* not SIOCGIFHWADDR */
+ 
+@@ -154,7 +154,7 @@
+ 		return(-1);
+ 	}
+ 
+-	bcopy(arpreq.arp_ha.sa_data, my_eaddr, sizeof (struct ether_addr));
++	bcopy(arpreq.arp_ha.sa_data, my_eaddr, sizeof (struct libnet_ether_addr));
+ 
+ #elif defined HAVE_GETIFADDRS /* not SIOCGARP */
+ 
+@@ -180,7 +180,7 @@
+ 				found = 1;
+ 				/* copy the result to my_eaddr */
+ 				sdl = (struct sockaddr_dl *) ifp->ifa_addr;
+-				bcopy((const void *)LLADDR(sdl), my_eaddr, sizeof (struct ether_addr));
++				bcopy((const void *)LLADDR(sdl), my_eaddr, sizeof (struct libnet_ether_addr));
+ 
+ 			}
+ 		}

Added: head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/patch-src_get__myeaddr.h	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,10 @@
+--- 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
+@@ -1,6 +1,6 @@
+ #ifndef GET_MYEADDR_H
+ #define GET_MYEADDR_H
+ 
+-int get_myeaddr(int sockfd, struct in_addr *my_ipaddr, struct ether_addr *my_eaddr, const char *ifname);
++int get_myeaddr(int sockfd, struct in_addr *my_ipaddr, struct libnet_ether_addr *my_eaddr, const char *ifname);
+ 
+ #endif /* not GET_MYEADDR_H */

Added: head/net-mgmt/dhcp_probe/files/pkg-message.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/files/pkg-message.in	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,2 @@
+Now it is time to configure this package.
+Update %%PREFIX%%/etc/dhcp_probe.cf with desired configuration.

Added: head/net-mgmt/dhcp_probe/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/pkg-descr	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,3 @@
+Attempts to discover DHCP and BootP servers on a network
+
+WWW: https://www.net.princeton.edu/software/dhcp_probe/

Added: head/net-mgmt/dhcp_probe/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/dhcp_probe/pkg-plist	Sat Mar  7 18:33:16 2015	(r380712)
@@ -0,0 +1,4 @@
+man/man5/dhcp_probe.cf.5.gz
+man/man8/dhcp_probe.8.gz
+sbin/dhcp_probe
+ at sample etc/dhcp_probe.cf.sample


More information about the svn-ports-head mailing list