PSARC 2012/202 libdnet 1.12
authorRich Burridge <rich.burridge@oracle.com>
Tue, 06 Nov 2012 16:27:21 -0800
changeset 1043 585b09419d1c
parent 1042 31d26adcf615
child 1044 ab6b15638457
PSARC 2012/202 libdnet 1.12 15793281 SUNBT7170755 Include latest libdnet in Userland
components/libdnet/Makefile
components/libdnet/libdnet.license
components/libdnet/libdnet.p5m
components/libdnet/patches/dnet.3.patch
components/libdnet/patches/dnet.8.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libdnet/Makefile	Tue Nov 06 16:27:21 2012 -0800
@@ -0,0 +1,69 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libdnet
+COMPONENT_VERSION=	1.12
+COMPONENT_PROJECT_URL=	http://code.google.com/p/libdnet/
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tgz
+COMPONENT_ARCHIVE_HASH=	\
+    sha256:83b33039787cf99990e977cef7f18a5d5e7aaffc4505548a83d31bd3515eb026
+COMPONENT_ARCHIVE_URL=	http://libdnet.googlecode.com/files/$(COMPONENT_ARCHIVE)
+
+include ../../make-rules/prep.mk
+include ../../make-rules/configure.mk
+include ../../make-rules/ips.mk
+
+# Needed to generate libraries with a .so extension.
+COMPONENT_PREP_ACTION = \
+	(cd $(@D) ; libtoolize --automake --copy ; \
+		aclocal -I config ; \
+		autoheader ; \
+		automake --add-missing --copy ; \
+		autoconf)
+
+# Set -m32 or -m64 correctly for 32 and 64 bit versions.
+CC +=	$(CC_BITS)
+
+# Remove Linux specific functionality.
+CONFIGURE_OPTIONS += ac_cv_dnet_linux_pf_packet=no
+
+# Uncomment if you have the Check unit testing framework installed.
+#CONFIGURE_OPTIONS +=	--with-check=/usr
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+# Tests for libdnet are not enabled by default as they use the Check unit
+# testing framework which is currently not present on Solaris. See:
+# http://check.sourceforge.net/ for more details.
+# If you do have Check on your system, then uncomment the TEST_32 line.
+test:		$(NO_TESTS)
+#test:		$(TEST_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+include ../../make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libdnet/libdnet.license	Tue Nov 06 16:27:21 2012 -0800
@@ -0,0 +1,36 @@
+----------------
+- libdnet 1.12 -
+----------------
+
+Oracle Internal Tracking Number 9402
+
+Copyright (c) 2000-2006 Dug Song <[email protected]>
+All rights reserved, all wrongs reversed.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions 
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+  
+2. Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following
+   disclaimer in the documentation and/or other materials provided
+   with the distribution.
+
+3. The names of the authors and copyright holders may not be used 
+   to endorse or promote products derived from this software 
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libdnet/libdnet.p5m	Tue Nov 06 16:27:21 2012 -0800
@@ -0,0 +1,73 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
+set name=pkg.fmri \
+    value=pkg:/system/library/libdnet@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="a simplified, portable interface to several low-level networking routines"
+set name=info.classification \
+    value="org.opensolaris.category.2008:System/Libraries"
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2012/202
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+dir  path=usr
+dir  path=usr/bin
+dir  path=usr/bin/$(MACH64)
+file path=usr/bin/$(MACH64)/dnet-config
+file path=usr/bin/dnet-config
+dir  path=usr/include
+dir  path=usr/include/dnet
+file path=usr/include/dnet.h
+file path=usr/include/dnet/addr.h
+file path=usr/include/dnet/arp.h
+file path=usr/include/dnet/blob.h
+file path=usr/include/dnet/eth.h
+file path=usr/include/dnet/fw.h
+file path=usr/include/dnet/icmp.h
+file path=usr/include/dnet/intf.h
+file path=usr/include/dnet/ip.h
+file path=usr/include/dnet/ip6.h
+file path=usr/include/dnet/os.h
+file path=usr/include/dnet/rand.h
+file path=usr/include/dnet/route.h
+file path=usr/include/dnet/tcp.h
+file path=usr/include/dnet/tun.h
+file path=usr/include/dnet/udp.h
+dir  path=usr/lib
+dir  path=usr/lib/$(MACH64)
+link path=usr/lib/$(MACH64)/libdnet.so target=libdnet.so.1.0.1
+link path=usr/lib/$(MACH64)/libdnet.so.1 target=libdnet.so.1.0.1
+file path=usr/lib/$(MACH64)/libdnet.so.1.0.1
+link path=usr/lib/libdnet.so target=libdnet.so.1.0.1
+link path=usr/lib/libdnet.so.1 target=libdnet.so.1.0.1
+file path=usr/lib/libdnet.so.1.0.1
+dir  path=usr/sbin
+file usr/sbin/$(MACH64)/dnet path=usr/sbin/dnet
+dir  path=usr/share
+dir  path=usr/share/man
+dir  path=usr/share/man/man1m
+file usr/share/man/man8/dnet.8 path=usr/share/man/man8/dnet.1m
+dir  path=usr/share/man/man3
+file path=usr/share/man/man3/dnet.3
+license libdnet.license license="libdnet license"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libdnet/patches/dnet.3.patch	Tue Nov 06 16:27:21 2012 -0800
@@ -0,0 +1,1489 @@
+--- libdnet-1.12/man/dnet.3.orig	2012-05-23 08:31:15.785689693 -0700
++++ libdnet-1.12/man/dnet.3	2012-05-23 08:46:23.327040849 -0700
+@@ -1,206 +1,296 @@
+-.\"
++.\"    
+ .\" Copyright (c) 2000 Dug Song <[email protected]>
+-.\"
++.\"    
+ .\" $Id: dnet.3 604 2005-02-25 22:59:04Z dugsong $
+ .\"
+-.Dd August 21, 2001
+-.Dt DNET 3
+-.Os
+-.Sh NAME
+-.Nm dnet
+-.Nd dumb networking library
+-.Sh SYNOPSIS
+-.Fd #include <dnet.h>
+-.Ss Network addressing
+-.Ft int
+-.Fn addr_cmp "const struct addr *a" "const struct addr *b"
+-.Ft int
+-.Fn addr_bcast "const struct addr *a" "struct addr *b"
+-.Ft int
+-.Fn addr_net "const struct addr *a" "struct addr *b"
+-.Ft char *
+-.Fn addr_ntop "const struct addr *src" "char *dst" "size_t size"
+-.Ft int
+-.Fn addr_pton "const char *src" "struct addr *dst"
+-.Ft char *
+-.Fn addr_ntoa "const struct addr *a"
+-.Ft int
+-.Fn addr_aton "const char *src" "struct addr *dst"
+-.Ft int
+-.Fn addr_ntos "const struct addr *a" "struct sockaddr *sa"
+-.Ft int
+-.Fn addr_ston "const struct sockaddr *sa" "struct addr *a"
+-.Ft int
+-.Fn addr_btos "uint16_t bits" "struct sockaddr *sa"
+-.Ft int
+-.Fn addr_stob "const struct sockaddr *sa" "uint16_t *bits"
+-.Ft int
+-.Fn addr_btom "uint16_t bits" "void *mask" "size_t size"
+-.Ft int
+-.Fn addr_mtob "const void *mask" "size_t size" "uint16_t *bits"
+-.Ss Address Resolution Protocol
+-.Pp
+-.Li typedef Ar int Fn (*arp_handler) "const struct arp_entry *entry" "void *arg"
+-.Ft arp_t *
+-.Fn arp_open "void"
+-.Ft int
+-.Fn arp_add "arp_t *a" "const struct arp_entry *entry"
+-.Ft int
+-.Fn arp_delete "arp_t *a" "const struct arp_entry *entry"
+-.Ft int
+-.Fn arp_get "arp_t *a" "struct arp_entry *entry"
+-.Ft int
+-.Fn arp_loop "arp_t *a" "arp_handler callback" "void *arg"
+-.Ft arp_t *
+-.Fn arp_close "arp_t *a"
+-.Ss Binary buffers
+-.Ft blob_t *
+-.Fn blob_new "void"
+-.Ft int
+-.Fn blob_read "blob_t *b" "void *buf" "int len"
+-.Ft int
+-.Fn blob_write "blob_t *b" "const void *buf" "int len"
+-.Ft int
+-.Fn blob_seek "blob_t *b" "int off" "int whence"
+-.Ft int
+-.Fn blob_index "blob_t *b" "const void *buf" "int len"
+-.Ft int
+-.Fn blob_rindex "blob_t *b" "const void *buf" "int len"
+-.Ft int
+-.Fn blob_pack "blob_t *b" "const void *fmt" "..."
+-.Ft int
+-.Fn blob_unpack "blob_t *b" "const void *fmt" "..."
+-.Ft int
+-.Fn blob_print "blob_t *b" "char *style" "int len"
+-.Ft blob_t *
+-.Fn blob_free "blob_t *b"
+-.Ss Ethernet
+-.Ft eth_t *
+-.Fn eth_open "const char *device"
+-.Ft int
+-.Fn eth_get "eth_t *e" "eth_addr_t *ea"
+-.Ft int
+-.Fn eth_set "eth_t *e" "const eth_addr_t *ea"
+-.Ft ssize_t
+-.Fn eth_send "eth_t *e" "const void *buf" "size_t len"
+-.Ft eth_t *
+-.Fn eth_close "eth_t *e"
+-.Ss Firewalling
+-.Pp
+-.Li typedef Ar int Fn (*fw_handler) "const struct fw_rule *rule" "void *arg"
+-.Ft fw_t *
+-.Fn fw_open "void"
+-.Ft int
+-.Fn fw_add "fw_t *f" "const struct fw_rule *rule"
+-.Ft int
+-.Fn fw_delete "fw_t *f" "const struct fw_rule *rule"
+-.Ft int
+-.Fn fw_loop "fw_t *f" "fw_handler callback" "void *arg"
+-.Ft fw_t *
+-.Fn fw_close "fw_t *f"
+-.Ss Network interfaces
+-.Pp
+-.Li typedef Ar int Fn (*intf_handler) "const struct intf_entry *entry" "void *arg"
+-.Ft intf_t *
+-.Fn intf_open "void"
+-.Ft int
+-.Fn intf_get "intf_t *i" "struct intf_entry *entry"
+-.Ft int
+-.Fn intf_get_src "intf_t *i" "struct intf_entry *entry" "struct addr *src"
+-.Ft int
+-.Fn intf_get_dst "intf_t *i" "struct intf_entry *entry" "struct addr *dst"
+-.Ft int
+-.Fn intf_set "intf_t *i" "const struct intf_entry *entry"
+-.Ft int
+-.Fn intf_loop "intf_t *i" "intf_handler callback" "void *arg"
+-.Ft intf_t *
+-.Fn intf_close "intf_t *i"
+-.Ss Internet Protocol
+-.Ft ip_t *
+-.Fn ip_open "void"
+-.Ft ssize_t
+-.Fn ip_add_option "void *buf" "size_t len" "int proto" "const void *optbuf" "size_t optlen"
+-.Ft void
+-.Fn ip_checksum "void *buf" "size_t len"
+-.Ft ssize_t
+-.Fn ip_send "ip_t *i" "const void *buf" "size_t len"
+-.Ft ip_t *
+-.Fn ip_close "ip_t *i"
+-.Ss Internet Protocol Version 6
+-.Ft void
+-.Fn ip6_checksum "void *buf" "size_t len"
+-.Ss Random number generation
+-.Pp
+-.Ft rand_t *
+-.Fn rand_open "void"
+-.Ft int
+-.Fn rand_get "rand_t *r" "void *buf" "size_t len"
+-.Ft int
+-.Fn rand_set "rand_t *r" "const void *seed" "size_t len"
+-.Ft int
+-.Fn rand_add "rand_t *r" "const void *buf" "size_t len"
+-.Ft uint8_t
+-.Fn rand_uint8 "rand_t *r"
+-.Ft uint16_t
+-.Fn rand_uint16 "rand_t *r"
+-.Ft uint32_t
+-.Fn rand_uint32 "rand_t *r"
+-.Ft int
+-.Fn rand_shuffle "rand_t *r" "void *base" "size_t nmemb" "size_t size"
+-.Ft rand_t *
+-.Fn rand_close "rand_t *r"
+-.Ss Routing
+-.Pp
+-.Li typedef Ar int Fn (*route_handler) "const struct route_entry *entry" "void *arg"
+-.Ft route_t *
+-.Fn route_open "void"
+-.Ft int
+-.Fn route_add "route_t *r" "const struct route_entry *entry"
+-.Ft int
+-.Fn route_delete "route_t *r" "const struct route_entry *entry"
+-.Ft int
+-.Fn route_get "route_t *r" "struct route_entry *entry"
+-.Ft int
+-.Fn route_loop "route_t *r" "route_handler callback" "void *arg"
+-.Ft route_t *
+-.Fn route_close "route_t *r"
+-.Ss Tunnel interface
+-.Pp
+-.Ft tun_t *
+-.Fn tun_open "struct addr *src" "struct addr *dst" "int mtu"
+-.Ft int
+-.Fn tun_fileno "tun_t *t"
+-.Ft const char *
+-.Fn tun_name "tun_t *t"
+-.Ft ssize_t
+-.Fn tun_send "tun_t *t" "const void *buf" "size_t size"
+-.Ft ssize_t
+-.Fn tun_recv "tun_t *t" "void *buf" "size_t size"
+-.Ft tun_t *
+-.Fn tun_close "tun_t *t"
+-.Pp
+-.Sh DESCRIPTION
+-.Nm
++.TH "DNET" "3" "August 21, 2001" "SunOS 5.11" "Library Functions Manual"
++.SH "NAME"
++\fBdnet\fP
++\- dumb networking library
++.SH "SYNOPSIS"
++#include <dnet.h>
++.SS "Network addressing"
++.LP
++.nf
++int
++addr_cmp(const struct addr *a, const struct addr *b);
++
++int
++addr_bcast(const struct addr *a, struct addr *b);
++
++int
++addr_net(const struct addr *a, struct addr *b);
++
++char *
++addr_ntop(const struct addr *src, char *dst size_t size);
++
++int
++addr_pton(const char *src, struct addr *dst);
++
++char *
++addr_ntoa(const struct addr *a);
++
++int
++addr_aton(const char *src, struct addr *dst);
++
++int
++addr_ntos(const struct addr *a, struct sockaddr *sa);
++
++int
++addr_ston(const struct sockaddr *sa, struct addr *a);
++
++int
++addr_btos(uint16_t bits, struct sockaddr *sa);
++
++int
++addr_stob(const struct sockaddr *sa, uint16_t *bits);
++
++int
++addr_btom(uint16_t bits, void *mask, size_t size);
++
++int
++addr_mtob(const void *mask, size_t size, uint16_t *bits);
++.fi
++.SS "Address Resolution Protocol"
++.LP
++.nf
++typedef int (*arp_handler)(const struct arp_entry *entry, void *arg);
++
++arp_t *
++arp_open(void);
++
++int
++arp_add(arp_t *a, const struct arp_entry *entry);
++
++int
++arp_delete(arp_t *a, const struct arp_entry *entry);
++
++int
++arp_get(arp_t *a, struct arp_entry *entry);
++
++int
++arp_loop(arp_t *a, arp_handler callback, void *arg);
++
++arp_t *
++arp_close(arp_t *a);
++.fi
++.SS "Binary buffers"
++.LP
++.nf
++blob_t *
++blob_new(void);
++
++int
++blob_read(blob_t *b, void *buf, int len);
++
++int
++blob_write(blob_t *b, const void *buf, int len);
++
++int
++blob_seek(blob_t *b, int off, int whence);
++
++int
++blob_index(blob_t *b, const void *buf, int len);
++
++int
++blob_rindex(blob_t *b, const void *buf, int len);
++
++int
++blob_pack(blob_t *b, const void *fmt, ...);
++
++int
++blob_unpack(blob_t *b, const void *fmt, ...);
++
++int
++blob_print(blob_t *b, char *style, int len);
++
++blob_t *
++blob_free(blob_t *b);
++.fi
++.SS "Ethernet"
++.LP
++.nf
++eth_t *
++eth_open(const char *device);
++
++int
++eth_get(eth_t *e, eth_addr_t *ea);
++
++int
++eth_set(eth_t *e, const eth_addr_t *ea);
++
++ssize_t
++eth_send(eth_t *e, const void *buf, size_t len);
++
++eth_t *
++eth_close(eth_t *e);
++.fi
++.SS "Firewalling"
++.LP
++.nf
++typedef int (*fw_handler)(const struct fw_rule *rule, void *arg);
++
++fw_t *
++fw_open void
++
++int
++fw_add(fw_t *f, const struct fw_rule *rule);
++
++int
++fw_delete(fw_t *f, const struct fw_rule *rule);
++
++int
++fw_loop(fw_t *f, fw_handler callback, void *arg);
++
++fw_t *
++fw_close(fw_t *f);
++.fi
++.SS "Network interfaces"
++.LP
++.nf
++typedef int (*intf_handler)(const struct intf_entry *entry void *arg);
++
++intf_t *
++intf_open(void);
++
++int
++intf_get(intf_t *i, struct intf_entry *entry);
++
++int
++intf_get_src(intf_t *i, struct intf_entry *entry, struct addr *src);
++
++int
++intf_get_dst(intf_t *i, struct intf_entry *entry, struct addr *dst);
++
++int
++intf_set(intf_t *i, const struct intf_entry *entry);
++
++int
++intf_loop(intf_t *i, intf_handler callback, void *arg);
++
++intf_t *
++intf_close(intf_t *i);
++.fi
++.SS "Internet Protocol"
++.LP
++.nf
++ip_t *
++ip_open(void);
++
++ssize_t
++ip_add_option(void *buf, size_t len, int proto, const void *optbuf, size_t optlen);
++
++void
++ip_checksum(void *buf, size_t len);
++
++ssize_t
++ip_send(ip_t *i, const void *buf, size_t len);
++
++ip_t *
++ip_close(ip_t *i);
++.fi
++.SS "Internet Protocol Version 6"
++.LP
++.nf
++void
++ip6_checksum(void *buf, size_t len);
++.fi
++.SS "Random number generation"
++.LP
++.nf
++rand_t *
++rand_open(void);
++
++int
++rand_get(rand_t *r, void *buf, size_t len);
++
++int
++rand_set(rand_t *r, const void *seed, size_t len);
++
++int
++rand_add(rand_t *r, const void *buf, size_t len);
++
++uint8_t
++rand_uint8(rand_t *r);
++
++uint16_t
++rand_uint16(rand_t *r);
++
++uint32_t
++rand_uint32(rand_t *r);
++
++int
++rand_shuffle(rand_t *r, void *base, size_t nmemb, size_t size);
++
++rand_t *
++rand_close(rand_t *r);
++.fi
++.SS "Routing"
++.LP
++.nf
++typedef int (*route_handler)(const struct route_entry *entry void *arg);
++
++route_t *
++route_open(void);
++
++int
++route_add(route_t *r, const struct route_entry *entry);
++
++int
++route_delete(route_t *r, const struct route_entry *entry);
++
++int
++route_get(route_t *r, struct route_entry *entry);
++
++int
++route_loop(route_t *r, route_handler callback, void *arg);
++
++route_t *
++route_close(route_t *r);
++.fi
++.SS "Tunnel interface"
++.LP
++.nf
++tun_t *
++tun_open(struct addr *src, struct addr *dst, int mtu);
++
++int
++tun_fileno(tun_t *t);
++
++const char *
++tun_name(tun_t *t);
++
++ssize_t
++tun_send(tun_t *t, const void *buf, size_t size);
++
++ssize_t
++tun_recv(tun_t *t, void *buf, size_t size);
++
++tun_t *
++tun_close(tun_t *t);
++.fi
++.SH "DESCRIPTION"
++\fBdnet\fP
+ provides a simplified, portable interface to several low-level
+ networking routines, including network address manipulation, kernel
+-.Xr arp 4
+-cache and 
+-.Xr route 4
++arp(4)
++cache and
++route(4)
+ table lookup and manipulation, network firewalling, network interface
+ lookup and manipulation, and raw IP packet and Ethernet frame
+ transmission. It is intended to complement the functionality provided
+ by
+-.Xr pcap 3 .
+-.Pp
+-In addition, 
+-.Nm
++pcap(3).
++.PP
++In addition,
++\fBdnet\fP
+ also provides platform-independent definitions of various network
+ protocol formats and values for portable low-level network
+ programming, as well as a simple binary buffer handling API.
+-.Pp
+-.Ss Network addressing
++.PP
++.SS "Network addressing"
+ Network addresses are described by the following structure:
+-.Bd -literal
++.nf
+ struct addr {
+ 	uint16_t		addr_type;
+ 	uint16_t		addr_bits;
+@@ -208,7 +298,7 @@
+ 		eth_addr_t	__eth;
+ 		ip_addr_t	__ip;
+ 		ip6_addr_t	__ip6;
+-		
++
+ 		uint8_t		__data8[16];
+ 		uint16_t	__data16[8];
+ 		uint32_t	__data32[4];
+@@ -220,279 +310,281 @@
+ #define addr_data8	__addr_u.__data8
+ #define addr_data16	__addr_u.__data16
+ #define addr_data32	__addr_u.__data32
+-.Ed
+-.Pp
++.fi
++.PP
+ The following values are defined for
+-.Ar addr_type :
+-.Bd -literal
++\fIaddr_type\fP:
++.nf
+ #define ADDR_TYPE_NONE		0	/* No address set */
+ #define	ADDR_TYPE_ETH		1	/* Ethernet */
+ #define	ADDR_TYPE_IP		2	/* Internet Protocol v4 */
+ #define	ADDR_TYPE_IP6		3	/* Internet Protocol v6 */
+-.Ed
+-.Pp
++.fi
++.PP
+ The field
+-.Ar addr_bits
++\fIaddr_bits\fP
+ denotes the length of the network mask in bits.
+-.Pp
+-.Fn addr_cmp
++.PP
++addr_cmp
+ compares network addresses
+-.Fa a
++a
+ and
+-.Fa b ,
++b,
+ returning an integer less than, equal to, or greater than zero if
+-.Fa a
++a
+ is found, respectively, to be less than, equal to, or greater than
+-.Fa b .
++b.
+ Both addresses must be of the same address type.
+-.Pp
+-.Fn addr_bcast
++.PP
++addr_bcast
+ computes the broadcast address for the network specified in
+-.Fa a
++a
+ and writes it into
+-.Fa b .
+-.Pp
+-.Fn addr_net
++b.
++.PP
++addr_net
+ computes the network address for the network specified in
+-.Fa a
++a
+ and writes it into
+-.Fa b .
+-.Pp
+-.Fn addr_ntop
++b.
++.PP
++addr_ntop
+ converts an address from network format to a string.
+-.Pp
+-.Fn addr_pton
++.PP
++addr_pton
+ converts an address (or hostname) from a string to network format.
+-.Pp
+-.Fn addr_ntoa
++.PP
++addr_ntoa
+ converts an address from network format to a string, returning a
+ pointer to the result in static memory.
+-.Pp
+-.Fn addr_aton
++.PP
++addr_aton
+ is a synonym for
+-.Fn addr_pton .
+-.Pp
+-.Fn addr_ntos
++addr_pton.
++.PP
++addr_ntos
+ converts an address from network format to the appropriate struct
+ sockaddr.
+-.Pp
+-.Fn addr_ston
++.PP
++addr_ston
+ converts an address from a struct sockaddr to network format.
+-.Pp
+-.Fn addr_btos
++.PP
++addr_btos
+ converts a network mask length to a network mask specified as a struct
+ sockaddr.
+-.Pp
+-.Fn addr_stob
++.PP
++addr_stob
+ converts a network mask specified in a struct sockaddr to a network
+ mask length.
+-.Pp
+-.Fn addr_btom
++.PP
++addr_btom
+ converts a network mask length to a network mask in network byte
+ order.
+-.Pp
+-.Fn addr_mtob
++.PP
++addr_mtob
+ converts a network mask in network byte order to a network mask length.
+-.Ss Address Resolution Protocol
++.SS "Address Resolution Protocol"
+ ARP cache entries are described by the following structure:
+-.Bd -literal
++.nf
+ struct arp_entry {
+ 	struct addr	arp_pa;		/* protocol address */
+ 	struct addr	arp_ha;		/* hardware address */
+ };
+-.Ed
+-.Pp
+-.Fn arp_open
++.fi
++.PP
++arp_open
+ is used to obtain a handle to access the kernel
+-.Xr arp 4
++arp(4)
+ cache.
+-.Pp
+-.Fn arp_add
++.PP
++arp_add
+ adds a new ARP
+-.Fa entry .
+-.Pp
+-.Fn arp_delete
++entry.
++.PP
++arp_delete
+ deletes the ARP
+-.Fa entry
++entry
+ for the protocol address specified by
+-.Fa arp_pa .
+-.Pp
+-.Fn arp_get
++arp_pa.
++.PP
++arp_get
+ retrieves the ARP
+-.Fa entry
++entry
+ for the protocol address specified by
+-.Fa arp_pa .
+-.Pp
+-.Fn arp_loop
++arp_pa.
++.PP
++arp_loop
+ iterates over the kernel
+-.Xr arp 4
++arp(4)
+ cache, invoking the specified
+-.Fa callback
++callback
+ with each
+-.Fa entry
++entry
+ and the context
+-.Fa arg
++arg
+ passed to
+-.Fn arp_loop .
+-.Pp
+-.Fn arp_close
++arp_loop.
++.PP
++arp_close
+ closes the specified handle.
+-.Pp
+-.Ss Binary buffers
++.SS "Binary buffers"
+ Binary buffers are described by the following structure:
+-.Bd -literal
++.nf
+ typedef struct blob {
+ 	u_char		*base;		/* start of data */
+ 	int		 off;		/* offset into data */
+ 	int		 end;		/* end of data */
+ 	int		 size;		/* size of allocation */
+ } blob_t;
+-.Ed
+-.Pp
+-.Fn blob_new
++.fi
++.PP
++blob_new
+ is used to allocate a new dynamic binary buffer, returning NULL on failure.
+-.Pp
+-.Fn blob_read
+-reads 
+-.Fa len
++.PP
++blob_read
++reads
++len
+ bytes from the current offset in blob
+-.Fa b 
++b
+ into
+-.Fa buf ,
++buf,
+ returning the total number of bytes read, or -1 on failure.
+-.Pp
+-.Fn blob_write
++.PP
++blob_write
+ writes
+-.Fa len
++len
+ bytes from
+-.Fa buf
++buf
+ to blob
+-.Fa b ,
++b,
+ advancing the current offset. It returns the number of bytes written,
+ or -1 on failure.
+-.Pp
+-.Fn blob_seek
++.PP
++blob_seek
+ repositions the offset within blob
+-.Fa b
+-to 
+-.Fa off ,
++b
++to
++off,
+ according to the directive
+-.Fa whence
++whence
+ (see
+-.Xr lseek 2
++lseek(2)
+ for details), returning the new absolute offset, or -1 on failure.
+-.Pp
+-.Fn blob_index
+-returns the offset of the first occurence in blob 
+-.Fa b
++.PP
++blob_index
++returns the offset of the first occurence in blob
++b
+ of the specified
+-.Fa buf
++buf
+ of length
+-.Fa len ,
++len,
+ or -1 on failure.
+-.Pp
+-.Fn blob_rindex
+-returns the offset of the last occurence in blob 
+-.Fa b
++.PP
++blob_rindex
++returns the offset of the last occurence in blob
++b
+ of the specified
+-.Fa buf
++buf
+ of length
+-.Fa len ,
++len,
+ or -1 on failure.
+-.Pp
+-.Fn blob_pack
++.PP
++blob_pack
+ converts and writes, and
+-.Fn blob_unpack
++blob_unpack
+ reads and converts data in blob
+-.Fa b
++b
+ according to the given format
+-.Fa fmt
++fmt
+ as described below, returning 0 on success, and -1 on failure.
+-.Pp
++.PP
+ The format string is composed of zero or more directives: ordinary
+ characters (not
+-.Cm %
++\fB%\fP
+ ),
+ which are copied to / read from the blob, and conversion
+ specifications, each of which results in reading / writing zero or
+ more subsequent arguments.
+-.Pp
++.PP
+ Each conversion specification is introduced by the character
+-.Cm % ,
++\fB%\fP,
+ and may be prefixed by length specifier. The arguments must correspond
+ properly (after type promotion) with the length and conversion specifiers.
+-.Pp
++.PP
+ The length specifier is either a a decimal digit string specifying the
+ length of the following argument, or the literal character
+-.Cm *
++\fB*\fP
+ indicating that the length should be read from an integer argument for
+ the argument following it.
+-.Pp
++.PP
+ The conversion specifiers and their meanings are:
+-.Bl -tag -width indent
+-.It Cm D
++.TP indent
++\fBD\fP
+ An unsigned 32-bit integer in network byte order.
+-.It Cm H
++.TP indent
++\fBH\fP
+ An unsigned 16-bit integer in network byte order.
+-.It Cm b
++.TP indent
++\fBb\fP
+ A binary buffer (length specifier required).
+-.It Cm c
++.TP indent
++\fBc\fP
+ An unsigned character.
+-.It Cm d
++.TP indent
++\fBd\fP
+ An unsigned 32-bit integer in host byte order.
+-.It Cm h
++.TP indent
++\fBh\fP
+ An unsigned 16-bit integer in host byte order.
+-.It Cm s
++.TP indent
++\fBs\fP
+ A C-style null-terminated string, whose maximum length must be
+ specified when unpacking.
+-.El
+-.Pp
++.PP
+ Custom conversion routines and their specifiers may be registered via
+-.Fn blob_register_pack ,
++blob_register_pack,
+ currently undocumented.
+-.Pp
+-.Fn blob_print
+-prints 
+-.Fa len
++.PP
++blob_print
++prints
++len
+ bytes of the contents of blob
+-.Fa b
++b
+ from the current offset in the specified
+-.Fa style ;
++style;
+ currently only
+-.Dq hexl 
++``hexl''
+ is available.
+-.Pp
+-.Fn blob_free
++.PP
++blob_free
+ deallocates the memory associated with blob
+-.Fa b 
++b
+ and returns NULL.
+-.Pp
+-.Ss Ethernet
+-.Fn eth_open
++.SS "Ethernet"
++eth_open
+ is used to obtain a handle to transmit raw Ethernet frames via the
+ specified network
+-.Fa device .
+-.Pp
+-.Fn eth_get
++device.
++.PP
++eth_get
+ retrieves the hardware MAC address for the interface specified by
+-.Ar e .
+-.Pp
+-.Fn eth_set
++\fIe\fP.
++.PP
++eth_set
+ configures the hardware MAC address for the interface specified by
+-.Ar e .
+-.Pp
+-.Fn eth_send
+-transmits 
+-.Fa len
++\fIe\fP.
++.PP
++eth_send
++transmits
++len
+ bytes of the Ethernet frame pointed to by
+-.Fa buf .
+-.Pp
+-.Fn eth_close
++buf.
++.PP
++eth_close
+ closes the specified handle.
+-.Pp
+-.Ss Firewalling
++.SS "Firewalling"
+ Firewall rules are described by the following structure:
+-.Bd -literal
++.nf
+ struct fw_rule {
+ 	char		fw_device[INTF_NAME_LEN]; /* interface name */
+ 	uint8_t		fw_op;			  /* operation */
+@@ -503,51 +595,50 @@
+ 	uint16_t	fw_sport[2];		  /* range / ICMP type */
+ 	uint16_t	fw_dport[2];		  /* range / ICMP code */
+ };
+-.Ed
+-.Pp
+-The following values are defined for 
+-.Ar fw_op :
+-.Bd -literal
++.fi
++.PP
++The following values are defined for
++\fIfw_op\fP:
++.nf
+ #define FW_OP_ALLOW	1
+ #define FW_OP_BLOCK	2
+-.Ed
+-.Pp
++.fi
++.PP
+ The following values are defined for
+-.Ar fw_dir :
+-.Bd -literal
++\fIfw_dir\fP:
++.nf
+ #define FW_DIR_IN	1
+ #define FW_DIR_OUT	2
+-.Ed
+-.Pp
+-.Fn fw_open
++.fi
++.PP
++fw_open
+ is used to obtain a handle to access the local network firewall
+ configuration.
+-.Pp
+-.Fn fw_add
++.PP
++fw_add
+ adds the specified firewall
+-.Fa rule .
+-.Pp
+-.Fn fw_delete
++rule.
++.PP
++fw_delete
+ deletes the specified firewall
+-.Fa rule .
+-.Pp
+-.Fn fw_loop
++rule.
++.PP
++fw_loop
+ iterates over the active firewall ruleset, invoking
+-the specified 
+-.Fa callback
+-with each 
+-.Fa rule
++the specified
++callback
++with each
++rule
+ and the context
+-.Fa arg
+-passed to 
+-.Fn fw_loop .
+-.Pp
+-.Fn fw_close
++arg
++passed to
++fw_loop.
++.PP
++fw_close
+ closes the specified handle.
+-.Pp 
+-.Ss Network interfaces
++.SS "Network interfaces"
+ Network interface information is described by the following structure:
+-.Bd -literal
++.nf
+ #define INTF_NAME_LEN	16
+ 
+ struct intf_entry {
+@@ -562,292 +653,286 @@
+ 	u_int		intf_alias_num;		    /* number of aliases */
+ 	struct addr	intf_alias_addrs __flexarr; /* array of aliases */
+ };
+-.Ed
+-.Pp
++.fi
++.PP
+ The following bitmask values are defined for
+-.Ar intf_type :
+-.Bd -literal
++\fIintf_type\fP:
++.nf
+ #define INTF_TYPE_OTHER		1	/* other */
+ #define INTF_TYPE_ETH		6	/* Ethernet */
+ #define INTF_TYPE_LOOPBACK	24	/* software loopback */
+ #define INTF_TYPE_TUN		53	/* proprietary virtual/internal */
+-.Ed
+-.Pp
++.fi
++.PP
+ The following bitmask values are defined for
+-.Ar intf_flags :
+-.Bd -literal
++\fIintf_flags\fP:
++.nf
+ #define INTF_FLAG_UP		0x01	/* enable interface */
+ #define INTF_FLAG_LOOPBACK	0x02	/* is a loopback net (r/o) */
+ #define INTF_FLAG_POINTOPOINT	0x04	/* point-to-point link (r/o) */
+ #define INTF_FLAG_NOARP		0x08	/* disable ARP */
+ #define INTF_FLAG_BROADCAST	0x10	/* supports broadcast (r/o) */
+ #define INTF_FLAG_MULTICAST	0x20	/* supports multicast (r/o) */
+-.Ed
+-.Pp
+-.Fn intf_open
++.fi
++.PP
++intf_open
+ is used to obtain a handle to access the network interface
+ configuration.
+-.Pp
+-.Fn intf_get
++.PP
++intf_get
+ retrieves an interface configuration
+-.Fa entry ,
++entry,
+ keyed on
+-.Fa intf_name .
+-For all 
+-.Fn intf_get
+-functions, 
+-.Fa intf_len
++intf_name.
++For all
++intf_get
++functions,
++intf_len
+ should be set to the size of the buffer pointed to by
+-.Fa entry 
++entry
+ (usually sizeof(struct intf_entry), but should be larger to accomodate
+ any interface alias addresses.
+-.Pp
+-.Fn intf_get_src
++.PP
++intf_get_src
+ retrieves the configuration for the interface whose primary address
+ matches the specified
+-.Fa src .
+-.Pp
+-.Fn intf_get_dst
++src.
++.PP
++intf_get_dst
+ retrieves the configuration for the best interface with which to reach
+ the specified
+-.Fa dst .
+-.Pp
+-.Fn intf_set
++dst.
++.PP
++intf_set
+ sets the interface configuration
+-.Fa entry .
+-.Pp
+-.Fn intf_loop
+-iterates over all network interfaces, invoking the specified 
+-.Fa callback
++entry.
++.PP
++intf_loop
++iterates over all network interfaces, invoking the specified
++callback
+ with each interface configuration
+-.Fa entry 
++entry
+ and the context
+-.Fa arg
++arg
+ passed to
+-.Fn intf_loop .
+-.Pp
+-.Fn intf_close
++intf_loop.
++.PP
++intf_close
+ closes the specified handle.
+-.Pp
+-.Ss Internet Protocol
+-.Fn ip_open
++.SS "Internet Protocol"
++ip_open
+ is used to obtain a handle to transmit raw IP packets, routed by the
+ kernel.
+-.Pp
+-.Fn ip_add_option
++.PP
++ip_add_option
+ adds the header option for the protocol
+-.Fa proto
++proto
+ specified by
+-.Fa optbuf
++optbuf
+ of length
+-.Fa optlen
++optlen
+ and appends it to the appropriate header of the IP packet contained in
+-.Fa buf
++buf
+ of size
+-.Fa len ,
++len,
+ shifting any existing payload and adding NOPs to pad the option to
+ a word boundary if necessary.
+-.Pp
+-.Fn ip_checksum
++.PP
++ip_checksum
+ sets the IP checksum and any appropriate transport protocol checksum
+ for the IP packet pointed to by
+-.Fa buf 
++buf
+ of length
+-.Fa len .
+-.Pp
+-.Fn ip_send
++len.
++.PP
++ip_send
+ transmits
+-.Fa len
++len
+ bytes of the IP packet pointed to by
+-.Fa buf .
+-.Pp
+-.Fn ip_close
++buf.
++.PP
++ip_close
+ closes the specified handle.
+-.Pp
+-.Ss Internet Protocol Version 6
+-.Fn ip6_checksum
++.SS "Internet Protocol Version 6"
++ip6_checksum
+ sets the appropriate transport protocol checksum for the IPv6 packet
+ pointed to by
+-.Fa buf
++buf
+ of length
+-.Fa len .
+-.Pp
+-.Ss Random number generation
+-.Fn rand_open
++len.
++.SS "Random number generation"
++rand_open
+ is used to obtain a handle for fast, cryptographically strong
+ pseudo-random number generation. The starting seed is derived from the
+ system random data source device (if one exists), or from the current
+ time and random stack contents.
+-.Pp
+-.Fn rand_set
+-re-initializes the PRNG to start from a known 
+-.Fa seed
++.PP
++rand_set
++re-initializes the PRNG to start from a known
++seed
+ value, useful in generating repeatable sequences.
+-.Pp
+-.Fn rand_get
+-writes 
+-.Fa len
++.PP
++rand_get
++writes
++len
+ random bytes into
+-.Fa buf .
+-.Pp
+-.Fn rand_add
++buf.
++.PP
++rand_add
+ adds
+-.Fa len
++len
+ bytes of entropy data from
+-.Fa buf
++buf
+ into the random mix.
+-.Pp
+-.Fn rand_uint8 ,
+-.Fn rand_uint16 ,
++.PP
++rand_uint8,
++rand_uint16,
+ and
+-.Fn rand_uint32
++rand_uint32
+ return 8, 16, and 32-bit unsigned random values, respectively.
+-.Pp
+-.Fn rand_shuffle
++.PP
++rand_shuffle
+ randomly shuffles an array of
+-.Fa nmemb
+-elements of 
+-.Fa size
++nmemb
++elements of
++size
+ bytes, starting at
+-.Fa base .
+-.Pp
+-.Fn rand_close
++base.
++.PP
++rand_close
+ closes the specified handle.
+-.Pp
+-.Ss Routing
++.SS "Routing"
+ Routing table entries are described by the following structure:
+-.Bd -literal
++.nf
+ struct route_entry {
+ 	struct addr	route_dst;	/* destination address */
+ 	struct addr	route_gw;	/* gateway address */
+ };
+-.Ed
+-.Pp
+-.Fn route_open
++.fi
++.PP
++route_open
+ is used to obtain a handle to access the kernel
+-.Xr route 4
++route(4)
+ table.
+-.Pp
+-.Fn route_add
++.PP
++route_add
+ adds a new routing table
+-.Fa entry .
+-.Pp
+-.Fn route_delete
++entry.
++.PP
++route_delete
+ deletes the routing table
+-.Fa entry
++entry
+ for the destination prefix specified by
+-.Fa route_dst .
+-.Pp
+-.Fn route_get
++route_dst.
++.PP
++route_get
+ retrieves the routing table
+-.Fa entry
++entry
+ for the destination prefix specified by
+-.Fa route_dst .
+-.Pp
+-.Fn route_loop
++route_dst.
++.PP
++route_loop
+ iterates over the kernel
+-.Xr route 4
++route(4)
+ table, invoking the specified
+-.Fa callback
++callback
+ with each
+-.Fa entry
++entry
+ and the context
+-.Fa arg
++arg
+ passed to
+-.Fn route_loop .
+-.Pp
+-.Fn route_close
++route_loop.
++.PP
++route_close
+ closes the specified handle.
+-.Pp
+-.Ss Tunnel interface
+-.Fn tun_open
++.SS "Tunnel interface"
++tun_open
+ is used to obtain a handle to a network tunnel interface, to which
+-IP packets destined for 
+-.Fa dst
++IP packets destined for
++dst
+ are delivered (with source addresses rewritten to
+-.Fa src
++src
+ ), where they may be read by a userland process and processed as
+ desired. IP packets written back to the handle are injected into the
+ kernel networking subsystem.
+-.Pp
+-.Fn tun_fileno
++.PP
++tun_fileno
+ returns a file descriptor associated with the tunnel handle, suitable
+-for 
+-.Xr select 2 .
+-.Pp
+-.Fn tun_name
++for
++select(2).
++.PP
++tun_name
+ returns a pointer to the tunnel interface name.
+-.Pp
+-.Fn tun_send
++.PP
++tun_send
+ submits a packet to the kernel networking subsystem for delivery.
+-.Pp
+-.Fn tun_recv
++.PP
++tun_recv
+ reads the next packet delivered to the tunnel interface.
+-.Pp
+-.Fn tun_close
++.PP
++tun_close
+ closes the specified handle.
+-.Pp
+-.Sh RETURN VALUES
+-.Fn addr_ntop
++.SH "RETURN VALUES"
++addr_ntop
+ returns a pointer to the
+-.Fa dst
++dst
+ argument, or NULL on failure.
+-.Pp
+-.Fn addr_ntoa
++.PP
++addr_ntoa
+ returns a pointer to a static memory area containing the printable
+ address, or NULL on failure.
+-.Pp
+-.Fn arp_open ,
+-.Fn eth_open ,
+-.Fn fw_open ,
+-.Fn intf_open ,
+-.Fn ip_open ,
+-.Fn rand_open ,
++.PP
++arp_open,
++eth_open,
++fw_open,
++intf_open,
++ip_open,
++rand_open,
+ and
+-.Fn route_open
++route_open
+ return a valid handle on success, or NULL on failure.
+-.Pp
+-.Fn arp_close ,
+-.Fn eth_close ,
+-.Fn fw_close ,
+-.Fn intf_close ,
+-.Fn ip_close ,
+-.Fn rand_close ,
++.PP
++arp_close,
++eth_close,
++fw_close,
++intf_close,
++ip_close,
++rand_close,
+ and
+-.Fn route_close
++route_close
+ always return NULL.
+-.Pp
+-.Fn eth_send
++.PP
++eth_send
+ and
+-.Fn ip_send
++ip_send
+ return the length of the datagram successfully sent, or -1 on failure.
+-.Pp
+-.Fn arp_loop ,
+-.Fn fw_loop ,
+-.Fn intf_loop ,
++.PP
++arp_loop,
++fw_loop,
++intf_loop,
+ and
+-.Fn route_loop
++route_loop
+ return the status of their
+-.Fa callback
+-routines. Any non-zero return from a 
+-.Fa callback
++callback
++routines. Any non-zero return from a
++callback
+ will cause the loop to exit immediately.
+-.Pp
+-.Fn ip_add_option
++.PP
++ip_add_option
+ returns the length of the inserted option (which may have been padded
+ with NOPs for memory alignment) or -1 on failure.
+-.Pp
+-.Fn rand_uint8 ,
+-.Fn rand_uint16 ,
++.PP
++rand_uint8,
++rand_uint16,
+ and
+-.Fn rand_uint32
++rand_uint32
+ return 8, 16, and 32-bit unsigned random values, respectively.
+-.Pp
+-All other 
+-.Nm
++.PP
++All other
++\fBdnet\fP
+ routines return 0 on success, or -1 on failure.
+-.Sh SEE ALSO
+-.Xr pcap 3
+-.Sh AUTHORS
++.SH "SEE ALSO"
++pcap(3)
++.SH "AUTHORS"
+ Dug Song
+-.Aq [email protected]
++<[email protected]>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libdnet/patches/dnet.8.patch	Tue Nov 06 16:27:21 2012 -0800
@@ -0,0 +1,416 @@
+--- libdnet-1.12/test/dnet/dnet.8.orig	2012-05-23 08:30:25.629791399 -0700
++++ libdnet-1.12/test/dnet/dnet.8	2012-05-23 08:47:33.464415318 -0700
+@@ -2,240 +2,235 @@
+ .\"
+ .\" Copyright (c) 2001 Dug Song <[email protected]>
+ .\"
+-.Dd October 17, 2001
+-.Dt DNET 8
+-.Os
+-.Sh NAME
+-.Nm dnet
+-.Nd dumb networking library test program
+-.Sh SYNOPSIS
+-.Nm dnet Ar command Ar args Op ...
+-.Sh DESCRIPTION
+-.Nm
+-is a simple test program for the 
+-.Xr dnet 3
++.TH "DNET" "1M" "October 17, 2001" "SunOS 5.11" "System Manager's Manual"
++.SH "NAME"
++\fBdnet\fP
++\- dumb networking library test program
++.SH "SYNOPSIS"
++\fBdnet \fIcommand\fP \fIargs\fP [...]\fP
++.SH "DESCRIPTION"
++\fBdnet\fP
++is a simple test program for the
++dnet(3)
+ library. It can be used to compose and transmit network datagrams as a
+ Unix-style filter (e.g. reading from or writing to files and pipes) or
+ modify the local system network configuration (including the ARP
+ cache, firewall ruleset, network interfaces, and routing table).
+-.Pp
+-.Ss Payload generation commands
+-.Bl -tag -width "foo"
+-.It Nm addr Ar address Op ...
+-Convert the 
+-.Ar address
++.PP
++.SS "Payload generation commands"
++.TP foo
++\fBaddr\fP \fIaddress\fP [...]
++Convert the
++\fIaddress\fP
+ (specified as a hostname, IP address, or MAC address)
+ into its binary representation on standard output.
+-.It Nm hex Ar string Op ...
++.TP foo
++\fBhex\fP \fIstring\fP [...]
+ Convert the C-style escaped
+-.Ar string
+-(shellcode, for instance) into its binary representation on standard output. 
+-.It Nm rand Ar len
++\fIstring\fP
++(shellcode, for instance) into its binary representation on standard output.
++.TP foo
++\fBrand\fP \fIlen\fP
+ Write
+-.Ar len
++\fIlen\fP
+ random bytes to standard output.
+-.El
+-.Ss Packet encapsulation commands
+-.Bl -tag -width "foo"
+-.It Xo
+-.Nm eth
+-.Op Nm type Ar type 
+-.Op Nm src Ar mac
+-.Op Nm dst Ar mac
+-.Xc
++.SS "Packet encapsulation commands"
++.TP foo
++\fBeth\fP
++[\fBtype\fP \fItype\fP]
++[\fBsrc\fP \fImac\fP]
++[\fBdst\fP \fImac\fP]
+ Prepend the data read from standard input with an Ethernet header on
+ standard output. The Ethernet
+-.Ar type
++\fItype\fP
+ may be specified as
+-.Ql arp ,
+-.Ql ip ,
++`arp',
++`ip',
+ or as a hex, octal, or decimal number.
+-.It Xo
+-.Nm arp
+-.Op Nm op Ar op
+-.Op Nm sha Ar mac
+-.Op Nm spa Ar host
+-.Op Nm tha Ar mac
+-.Op Nm tpa Ar host
+-.Xc
++.TP foo
++\fBarp\fP
++[\fBop\fP \fIop\fP]
++[\fBsha\fP \fImac\fP]
++[\fBspa\fP \fIhost\fP]
++[\fBtha\fP \fImac\fP]
++[\fBtpa\fP \fIhost\fP]
+ Prepend the data read from standard input with an ARP header on
+ standard output. The ARP
+-.Ar op
++\fIop\fP
+ may be specified as
+-.Ql req ,
+-.Ql rep ,
+-.Ql revreq ,
+-.Ql revrep ,
++`req',
++`rep',
++`revreq',
++`revrep',
+ or as a hex, octal, or decimal number.
+-.It Xo
+-.Nm ip
+-.Op Nm tos Ar num
+-.Op Nm id Ar num
+-.Op Nm off Ar offset
+-.Op Nm ttl Ar num
+-.Op Nm proto Ar protocol
+-.Op Nm src Ar host
+-.Bk -words
+-.Op Nm dst Ar dst
+-.Ek
+-.Xc
++.TP foo
++\fBip\fP
++[\fBtos\fP \fInum\fP]
++[\fBid\fP \fInum\fP]
++[\fBoff\fP \fIoffset\fP]
++[\fBttl\fP \fInum\fP]
++[\fBproto\fP \fIprotocol\fP]
++[\fBsrc\fP \fIhost\fP]
++[\fBdst\fP \fIdst\fP]
+ Prepend the data read from standard input with an IP header on
+ standard output. The fragmentation
+-.Ar offset
+-may be specified as a decimal number (optionally concatenated with 
+-.Ql +
+-to indicate more fragments) or as a hex number. The 
+-.Ar protocol
++\fIoffset\fP
++may be specified as a decimal number (optionally concatenated with
++`+'
++to indicate more fragments) or as a hex number. The
++\fIprotocol\fP
+ may be specified by name, or as a hex, octal, or decimal number.
+-.It Xo
+-.Nm icmp
+-.Op Nm type Ar num
+-.Op Nm code Ar num
+-.Xc
++.TP foo
++\fBicmp\fP
++[\fBtype\fP \fInum\fP]
++[\fBcode\fP \fInum\fP]
+ Prepend the data read from standard input with an ICMP header on
+ standard output.
+-.It Xo
+-.Nm tcp
+-.Op Nm sport Ar port
+-.Op Nm dport Ar port
+-.Op Nm flags Ar flags
+-.Op Nm seq Ar num
+-.Op Nm ack Ar num
+-.Op Nm win Ar num
+-.Op Nm urp Ar num
+-.Xc
++.TP foo
++\fBtcp\fP
++[\fBsport\fP \fIport\fP]
++[\fBdport\fP \fIport\fP]
++[\fBflags\fP \fIflags\fP]
++[\fBseq\fP \fInum\fP]
++[\fBack\fP \fInum\fP]
++[\fBwin\fP \fInum\fP]
++[\fBurp\fP \fInum\fP]
+ Prepend the data read from standard input with a TCP header on
+ standard output. A
+-.Ar port
+-may be specified by name or hex, octal, or decimal number. The TCP 
+-.Ar flags
++\fIport\fP
++may be specified by name or hex, octal, or decimal number. The TCP
++\fIflags\fP
+ may be specified as some combination of the characters in the set
+-.Ql SAFRPU
++`SAFRPU'
+ or as a hex number.
+-.It Xo
+-.Nm udp
+-.Op Nm sport Ar port
+-.Op Nm dport Ar port
+-.Xc
++.TP foo
++\fBudp\fP
++[\fBsport\fP \fIport\fP]
++[\fBdport\fP \fIport\fP]
+ Prepend the data read from standard input with a UDP header on
+ standard output. A
+-.Ar port
++\fIport\fP
+ may be specified by name or hex, octal, or decimal number.
+-.El
+-.Ss Packet transmission commands
+-.Bl -tag -width "foo"
+-.It Nm send Op Ar device
++.SS "Packet transmission commands"
++.TP foo
++\fBsend\fP [\fIdevice\fP]
+ Read a packet from standard input and send it over the network. If no
+-.Ar device
++\fIdevice\fP
+ is specified, the packet is assumed to be an IP datagram and routed
+ to its destination. Otherwise, the packet is assumed to be an Ethernet
+ frame and is transmitted on the specified interface.
+-.El
+-.Ss Kernel interface commands
+-.Bl -tag -width "foo"
+-.It Nm arp show
++.SS "Kernel interface commands"
++.TP foo
++\fBarp show\fP
+ Display the kernel ARP cache.
+-.It Nm arp get Ar host
++.TP foo
++\fBarp get\fP \fIhost\fP
+ Display the kernel ARP entry for
+-.Ar host .
+-.It Nm arp add Ar host Ar mac
++\fIhost\fP.
++.TP foo
++\fBarp add\fP \fIhost\fP \fImac\fP
+ Add an ARP entry mapping the
+-.Ar mac
++\fImac\fP
+ address for
+-.Ar host .
+-.It Nm arp delete Ar host
++\fIhost\fP.
++.TP foo
++\fBarp delete\fP \fIhost\fP
+ Delete the ARP entry for
+-.Ar host .
+-.Pp
+-.It Nm fw show
++\fIhost\fP.
++.sp
++.TP foo
++\fBfw show\fP
+ Display the kernel firewall ruleset.
+-.It Xo
+-.Nm fw add Ns \&| Ns Nm delete
+-.Ar action Ar direction Ar device 
+-.Ar protocol 
+-.Ar src Ns Op \&: Ns Ar port[-max]
+-.Ar dst Ns Op \&: Ns Ar port[-max]
+-.Op Ar type Ns Op /code
+-.Xc
++.TP foo
++\fBfw add\fP\&|\fBdelete\fP
++\fIaction\fP \fIdirection\fP \fIdevice\fP
++\fIprotocol\fP
++\fIsrc\fP[\&:\fIport[-max]\fP]
++\fIdst\fP[\&:\fIport[-max]\fP]
++[\fItype\fP[/code]]
+ Add a rule to or delete a rule from the active firewall ruleset. The
+-.Ar action
++\fIaction\fP
+ must be either
+-.Ql allow
++`allow'
+ or
+-.Ql block .
++`block'.
+ The direction must be either
+-.Ql in
++`in'
+ or
+-.Ql out .
+-The 
+-.Ar device
+-may specify an interface name, or 
+-.Ql any .
+-The 
+-.Ar protocol
++`out'.
++The
++\fIdevice\fP
++may specify an interface name, or
++`any'.
++The
++\fIprotocol\fP
+ may be specified by name, or as a decimal number. For TCP and
+-UDP protocols, a 
+-.Ar port
++UDP protocols, a
++\fIport\fP
+ (or range, if specified with a
+-.Ar max
++\fImax\fP
+ value) may be specified in decimal and appended to the source and/or
+ destination address. For ICMP, a
+-.Ar type
++\fItype\fP
+ (and optional
+-.Ar code )
++\fIcode\fP)
+ may be specified in decimal.
+-.It Nm intf show
++.TP foo
++\fBintf show\fP
+ Display the configuration of all network interfaces.
+-.It Nm intf get Ar device
++.TP foo
++\fBintf get\fP \fIdevice\fP
+ Display the configuration for the interface specified by
+-.Ar device .
+-.It Xo
+-.Nm intf set
+-.Ar device
+-.Op Nm alias Ar host
+-.Op Nm dst Ar host
+-.Op Nm inet Ar host
+-.Op Nm link Ar mac
+-.Op Nm up Ns \&| Ns Nm down
+-.Op Nm arp Ns \&| Ns Nm noarp
+-.Xc
++\fIdevice\fP.
++.TP foo
++\fBintf set\fP
++\fIdevice\fP
++[\fBalias\fP \fIhost\fP]
++[\fBdst\fP \fIhost\fP]
++[\fBinet\fP \fIhost\fP]
++[\fBlink\fP \fImac\fP]
++[\fBup\fP\&|\fBdown\fP]
++[\fBarp\fP\&|\fBnoarp\fP]
+ Configure the interface specified by
+-.Ar device .
+-.It Nm route show
++\fIdevice\fP.
++.TP foo
++\fBroute show\fP
+ Display the kernel routing table.
+-.It Nm route get Ar dst
++.TP foo
++\fBroute get\fP \fIdst\fP
+ Display the route for the destination
+-.Ar dst ,
++\fIdst\fP,
+ specified as a hostname, IP address, or network prefix in CIDR notation.
+-.It Nm route add Ar dst Ar gw
++.TP foo
++\fBroute add\fP \fIdst\fP \fIgw\fP
+ Add a route for the destination
+-.Ar dst
++\fIdst\fP
+ through the gateway
+-.Ar gw .
+-.It Nm route delete Ar dst
++\fIgw\fP.
++.TP foo
++\fBroute delete\fP \fIdst\fP
+ Delete the route for the destination
+-.Ar dst .
+-.El
+-.Sh EXAMPLES
++\fIdst\fP.
++.SH "EXAMPLES"
+ Send a UDP datagram containing random shellcode:
+-.Bd -literal -offset indent
++.nf
+ dnet hex "\\xeb\\x1f\\x5e\\x89\\x76\\x08\\x31\\xc0\\x88\\x46\\x07\\x89" \\
+ "\\x46\\x0c\\xb0\\x0b\\x89\\xf3\\x8d\\x4e\\x08\\x8d\\x56\\x0c\\xcd\\x80" \\
+ "\\x31\\xdb\\x89\\xd8\\x40\\xcd\\x80\\xe8\\xdc\\xff\\xff\\xff/bin/sh" | \\
+ dnet udp sport 555 dport 666 | \\
+ dnet ip proto udp src 1.2.3.4 dst 5.6.7.8 | dnet send
+-.Ed
+-.Pp
++.fi
++.PP
+ Save an ARP request in a file and send it twice:
+-.Bd -literal -offset indent
++.nf
+ dnet arp op req sha 0:d:e:a:d:0 spa 10.0.0.3 tpa 10.0.0.4 | \\
+ dnet eth type arp src 0:d:e:a:d:0 dst ff:ff:ff:ff:ff:ff > arp.pkt
+ dnet send fxp0 < arp.pkt
+ dnet send fxp0 < arp.pkt
+-.Ed
+-.Pp
++.fi
++.PP
+ Send a fragmented ping packet:
+-.Bd -literal -offset indent
++.nf
+ # Create ping packet with IP header, to set ICMP checksum
+ echo "monkey monkey monkey monkey" | dnet icmp type 8 code 0 | \\
+ dnet ip proto icmp src 1.2.3.4 dst 5.6.7.8 > ping.pkt
+@@ -251,9 +246,9 @@
+ dnet send
+ dnet ip id 1 off 24 proto icmp src 1.2.3.4 dst 5.6.7.8 < p.ab | \\
+ dnet send
+-.Ed
+-.Sh SEE ALSO
+-.Xr dnet 3
+-.Sh AUTHORS
++.fi
++.SH "SEE ALSO"
++dnet(3)
++.SH "AUTHORS"
+ Dug Song
+-.Aq [email protected]
++<[email protected]>