summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2010-01-27 17:11:16 -0800
committerSam Roberts <vieuxtech@gmail.com>2010-01-27 17:11:16 -0800
commit29ab1bfc1be2c97fb32e9564bcf33bba43c14136 (patch)
treeb638140bfeb5e0b9e9e72cad3ab856bba10ded9f /debian/patches
parent76f9a66807a8b337a0eb7d8497efc57229a68512 (diff)
downloadlibnet-29ab1bfc1be2c97fb32e9564bcf33bba43c14136.tar.gz
Added ability to build a debian package directly from git.
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/00-fix_build_process.patch246
-rw-r--r--debian/patches/01-fix_libnet-functions.h.3.patch839
-rw-r--r--debian/patches/02-fix_libnet_802_1q_hdr.3.patch11
-rw-r--r--debian/patches/03-fix_libnet_802_1x_hdr.3.patch11
-rw-r--r--debian/patches/04-fix_libnet_build_ntp.patch13
-rw-r--r--debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch11
-rw-r--r--debian/patches/06-fix_libnet_pblock_coalesce_leak.patch49
-rw-r--r--debian/patches/07-add_libnet-cq-end-loop.patch32
-rw-r--r--debian/patches/08-fix_libnet_checksum.c.patch23
-rw-r--r--debian/patches/09-fix_hurd-i386_build.patch11
-rw-r--r--debian/patches/series10
11 files changed, 1256 insertions, 0 deletions
diff --git a/debian/patches/00-fix_build_process.patch b/debian/patches/00-fix_build_process.patch
new file mode 100644
index 0000000..49b3842
--- /dev/null
+++ b/debian/patches/00-fix_build_process.patch
@@ -0,0 +1,246 @@
+--- libnet-1.1.2.1.orig/Makefile.am
++++ libnet-1.1.2.1/Makefile.am
+@@ -12,4 +12,4 @@
+
+ EXTRA_DIST = Makefile.am.common
+
+-bin_scripts = libnet-config
++bin_SCRIPTS = libnet-config
+--- libnet-1.1.2.1.orig/configure.in
++++ libnet-1.1.2.1/configure.in
+@@ -21,10 +21,24 @@
+ dnl
+ AC_PROG_CC
+ AC_PROG_INSTALL
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
+
++# Added by Debian maintainer after `autoscan`
++AC_PROG_CXX
++AC_PROG_CPP
++AC_PROG_LN_S
++AC_PROG_MAKE_SET
++#
++
++# Check for headers
+ AC_CHECK_HEADERS(sys/sockio.h)
+
++# Added by Debian maintainer after `autoscan`
++AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h netdb.h netinet/in.h nlist.h])
++AC_CHECK_HEADERS([stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h])
++AC_CHECK_HEADERS([sys/socket.h sys/systeminfo.h sys/time.h sys/timeb.h unistd.h])
++#
++
+ dnl
+ dnl And some custom things
+ dnl
+@@ -49,6 +63,22 @@
+ CFLAGS="$CFLAGS -Wall"
+ fi
+
++# Added by Debian maintainer after `autoscan`
++AC_C_INLINE
++AC_TYPE_INT16_T
++AC_TYPE_INT32_T
++AC_TYPE_INT64_T
++AC_TYPE_INT8_T
++AC_TYPE_OFF_T
++AC_TYPE_SIZE_T
++AC_CHECK_MEMBERS([struct stat.st_rdev])
++AC_TYPE_UINT16_T
++AC_TYPE_UINT32_T
++AC_TYPE_UINT64_T
++AC_TYPE_UINT8_T
++#
++
++
+ dnl
+ dnl Set the root install directory
+ dnl
+@@ -61,6 +91,11 @@
+ dnl Check for library functions.
+ dnl
+ AC_CHECK_FUNCS(strerror)
++# Added by Debian maintainer after `autoscan`
++AC_HEADER_MAJOR
++AC_CHECK_FUNCS([bzero gethostbyaddr gethostbyname gettimeofday memmove])
++AC_CHECK_FUNCS([memset socket strchr strdup strpbrk strrchr strtol strtoul])
++#
+
+ dnl
+ dnl Get link-layer interface type
+--- libnet-1.1.2.1.orig/src/Makefile.am
++++ libnet-1.1.2.1/src/Makefile.am
+@@ -8,9 +8,9 @@
+
+ include $(top_srcdir)/Makefile.am.common
+
+-lib_LIBRARIES = libnet.a
++lib_LTLIBRARIES = libnet.la
+
+-libnet_a_SOURCES = libnet_asn1.c \
++libnet_la_SOURCES = libnet_asn1.c \
+ libnet_build_802.1q.c \
+ libnet_build_802.1x.c \
+ libnet_build_802.2.c \
+@@ -57,15 +57,20 @@
+ libnet_version.c \
+ libnet_write.c
+
+-EXTRA_libnet_a_SOURCES = libnet_link_bpf.c \
+- libnet_link_dlpi.c \
+- libnet_link_linux.c \
+- libnet_link_nit.c \
+- libnet_link_none.c \
+- libnet_link_pf.c \
+- libnet_link_snit.c \
+- libnet_link_snoop.c \
+- libnet_link_win32.c
+-
+-libnet_a_LIBADD = @LIBOBJS@
++libnet_la_LIBADD = @LTLIBOBJS@
+
++# Here are a set of rules to help you update your library version
++# information:
++#
++# 1. If the library source code has changed at all since the last
++# update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
++#
++# 2. If any interfaces have been added, removed, or changed since the
++# last update, increment CURRENT, and set REVISION to 0.
++#
++# 3. If any interfaces have been added since the last public release,
++# then increment AGE.
++#
++# 4. If any interfaces have been removed since the last public release,
++# then set AGE to 0.
++libnet_la_LDFLAGS = -version-info 4:0:3 # CURRENT[:REVISION[:AGE]]
+--- libnet-1.1.2.1.orig/acinclude.m4
++++ libnet-1.1.2.1/acinclude.m4
+@@ -11,7 +11,7 @@
+ dnl usage: AC_LIBNET_LINUX_PROCFS
+ dnl results: HAVE_LINUX_PROCFS
+ dnl
+-AC_DEFUN(AC_LIBNET_LINUX_PROCFS,
++AC_DEFUN([AC_LIBNET_LINUX_PROCFS],
+ [AC_MSG_CHECKING(for Linux proc filesystem)
+ AC_CACHE_VAL(ac_cv_libnet_linux_procfs,
+ if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then
+@@ -37,15 +37,15 @@
+ dnl HAVE_PACKET_SOCKET (DEFINED)
+ dnl
+
+-AC_DEFUN(AC_LIBNET_CHECK_PF_PACKET,
++AC_DEFUN([AC_LIBNET_CHECK_PF_PACKET],
+ [
+ AC_MSG_CHECKING(for packet socket (PF_SOCKET))
+- AC_CACHE_VAL(ac_libnet_have_packet_socket,
++ AC_CACHE_VAL(ac_cv_libnet_have_packet_socket,
+
+ [case "$target_os" in
+
+ linux)
+- ac_libnet_have_packet_socket = no
++ ac_cv_libnet_have_packet_socket = no
+ ;;
+ *)
+
+@@ -94,17 +94,17 @@
+
+ # Oopz 4.3 BSD doesn't have this. Sorry.
+ if test ! -x ./pf_packet-test ; then
+- ac_libnet_have_packet_socket=choked
++ ac_cv_libnet_have_packet_socket=choked
+ else
+- ac_libnet_have_packet_socket=`./pf_packet-test`;
++ ac_cv_libnet_have_packet_socket=`./pf_packet-test`;
+ fi
+- if test $ac_libnet_have_packet_socket = choked; then
++ if test $ac_cv_libnet_have_packet_socket = choked; then
+ AC_MSG_RESULT(test program compile choked... assuming no)
+- elif test $ac_libnet_have_packet_socket = yes; then
++ elif test $ac_cv_libnet_have_packet_socket = yes; then
+ AC_MSG_RESULT(yes)
+- elif test $ac_libnet_have_packet_socket = probably; then
++ elif test $ac_cv_libnet_have_packet_socket = probably; then
+ AC_MSG_RESULT(test program got EPERM... assuming yes)
+- elif test $ac_libnet_have_packet_socket = no; then
++ elif test $ac_cv_libnet_have_packet_socket = no; then
+ AC_MSG_RESULT(no)
+ fi
+
+@@ -112,7 +112,7 @@
+ ;;
+ esac])
+
+- if test $ac_libnet_have_packet_socket = yes -o $ac_libnet_have_packet_socket = probably; then
++ if test $ac_cv_libnet_have_packet_socket = yes -o $ac_cv_libnet_have_packet_socket = probably; then
+ AC_DEFINE(HAVE_PACKET_SOCKET)
+ fi
+ ])
+@@ -131,17 +131,17 @@
+ dnl
+ dnl
+
+-AC_DEFUN(AC_LIBNET_CHECK_LIBNET_VER,
++AC_DEFUN([AC_LIBNET_CHECK_LIBNET_VER],
+ [
+ AC_CHECK_LIB(net, libnet_build_ip, AC_MSG_CHECKING(version) \
+
+ changequote(<<, >>)dnl
+- if [[ ! -f $LIB_PREFIX/libnet.a ]] ; then
++ if [[ ! -f $LIB_PREFIX/libnet.la ]] ; then
+ changequote([, ])dnl
+- AC_MSG_RESULT($LIB_PREFIX/libnet.a doesn't exist)
++ AC_MSG_RESULT($LIB_PREFIX/libnet.la doesn't exist)
+ AC_MSG_RESULT(previous libnet install lives elsewhere, you should probably find it)
+ else
+- __LIBNET_VERSION=`strings $LIB_PREFIX/libnet.a | grep "libnet version"\
++ __LIBNET_VERSION=`strings $LIB_PREFIX/libnet.la | grep "libnet version"\
+ | cut -f3 -d" "`;\
+ if test -z "$__LIBNET_VERSION"; then
+ AC_MSG_RESULT(<0.8)
+@@ -166,7 +166,7 @@
+ dnl HAVE_STRUCT_IP_CSUM (DEFINED)
+ dnl
+
+-AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM,
++AC_DEFUN([AC_LIBNET_CHECK_IP_CSUM],
+ [
+ AC_MSG_CHECKING([struct ip contains ip_csum])
+ AC_TRY_COMPILE([
+@@ -199,7 +199,7 @@
+ dnl LBL_ALIGN (DEFINED)
+ dnl
+
+-AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
++AC_DEFUN([AC_LBL_UNALIGNED_ACCESS],
+ [AC_MSG_CHECKING(if unaligned accesses fail)
+ AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
+ [case "$target_cpu" in
+@@ -278,7 +278,7 @@
+ dnl LIBNET_LIL_ENDIAN = 1
+ dnl
+
+-AC_DEFUN(AC_LIBNET_ENDIAN_CHECK,
++AC_DEFUN([AC_LIBNET_ENDIAN_CHECK],
+ [AC_MSG_CHECKING(machine endianess)
+
+ cat > conftest.c << EOF
+@@ -439,7 +439,7 @@
+ dnl statically and happen to have a libresolv.a lying around (and no
+ dnl libnsl.a).
+ dnl
+-AC_DEFUN(AC_LBL_LIBRARY_NET, [
++AC_DEFUN([AC_LBL_LIBRARY_NET], [
+ # Most operating systems have gethostbyname() in the default searched
+ # libraries (i.e. libc):
+ AC_CHECK_FUNC(gethostbyname, ,
+--- libnet-1.1.2.1.orig/sample/Makefile.am
++++ libnet-1.1.2.1/sample/Makefile.am
+@@ -60,4 +60,4 @@
+ ip_link_SOURCES = ip_link.c
+ sebek_SOURCES = sebek.c
+
+-LDADD = $(top_srcdir)/src/libnet.a
++LDADD = $(top_srcdir)/src/libnet.la
diff --git a/debian/patches/01-fix_libnet-functions.h.3.patch b/debian/patches/01-fix_libnet-functions.h.3.patch
new file mode 100644
index 0000000..1ba50e0
--- /dev/null
+++ b/debian/patches/01-fix_libnet-functions.h.3.patch
@@ -0,0 +1,839 @@
+--- libnet.orig/doc/man/man3/libnet-functions.h.3
++++ libnet/doc/man/man3/libnet-functions.h.3
+@@ -485,7 +485,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -504,7 +504,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -535,7 +535,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-the number of bytes written, or -1 on failure
++the number of bytes written, or \-1 on failure
+ .RE
+ .PP
+
+@@ -560,7 +560,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -579,7 +579,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -606,7 +606,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -627,7 +627,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -654,7 +654,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -675,7 +675,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -706,7 +706,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -741,7 +741,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -768,7 +768,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -795,7 +795,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -826,7 +826,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -853,7 +853,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -892,13 +892,14 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+ .SS "libnet_ptag_t libnet_build_bgp4_header (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
+ .PP
+-Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced. This function builds the base BGP header which is used as a preamble before any other BGP header. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification.
++Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header. The primary function of a BGP speaking system is to exchange network reachability
++information with other BGP systems. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced. This function builds the base BGP header which is used as a preamble before any other BGP header. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -919,7 +920,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -944,7 +945,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -975,7 +976,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1008,7 +1009,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1027,7 +1028,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1060,7 +1061,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1081,7 +1082,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1100,7 +1101,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1133,13 +1134,13 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+ .SS "libnet_ptag_t libnet_build_egre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
+ .PP
+-Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.
++Generic Routing Encapsulation (GRE \- RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -1168,7 +1169,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1195,7 +1196,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1228,13 +1229,13 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+ .SS "libnet_ptag_t libnet_build_gre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
+ .PP
+-Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.
++Generic Routing Encapsulation (GRE \- RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery header'. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -1263,7 +1264,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1282,7 +1283,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1301,7 +1302,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1332,7 +1333,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1365,7 +1366,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1406,7 +1407,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1449,7 +1450,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1486,7 +1487,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1527,7 +1528,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1556,7 +1557,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1589,7 +1590,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1616,7 +1617,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1643,7 +1644,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1682,7 +1683,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1703,7 +1704,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1738,7 +1739,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1763,7 +1764,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1792,7 +1793,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1817,7 +1818,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1844,7 +1845,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1883,7 +1884,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1912,7 +1913,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -1941,7 +1942,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2000,7 +2001,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2019,7 +2020,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2038,7 +2039,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2057,7 +2058,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2076,7 +2077,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2095,7 +2096,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2114,7 +2115,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2133,7 +2134,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2152,7 +2153,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2171,7 +2172,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2190,7 +2191,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2229,7 +2230,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2243,7 +2244,7 @@
+ .br
+ \fIxid\fP transaction identifier used to link calls and replies
+ .br
+-\fIprog_num\fP remote program specification typically between 0 - 1fffffff
++\fIprog_num\fP remote program specification typically between 0 \- 1fffffff
+ .br
+ \fIprog_vers\fP remote program version specification
+ .br
+@@ -2272,7 +2273,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2315,7 +2316,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2360,7 +2361,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2387,7 +2388,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2422,7 +2423,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2443,7 +2444,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2482,7 +2483,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2511,7 +2512,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2523,7 +2524,7 @@
+ .RS 4
+ \fIversion\fP VRRP version (should be 2)
+ .br
+-\fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT)
++\fItype\fP VRRP packet type (should be 1 \-\- ADVERTISEMENT)
+ .br
+ \fIvrouter_id\fP virtual router identification
+ .br
+@@ -2531,7 +2532,7 @@
+ .br
+ \fIip_count\fP number of IPv4 addresses contained in this advertisement
+ .br
+-\fIauth_type\fP type of authentication (0, 1, 2 -- see RFC)
++\fIauth_type\fP type of authentication (0, 1, 2 \-\- see RFC)
+ .br
+ \fIadvert_int\fP interval between advertisements
+ .br
+@@ -2548,7 +2549,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2575,7 +2576,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -2757,7 +2758,7 @@
+
+ .SS "u_int32_t libnet_get_ipaddr4 (libnet_t * l)"
+ .PP
+-Returns the IP address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns -1 a call to libnet_geterrror() will tell you why.
++Returns the IP address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns \-1 a call to libnet_geterrror() will tell you why.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -2766,7 +2767,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-a big endian IP address suitable for use in a libnet_build function or -1
++a big endian IP address suitable for use in a libnet_build function or \-1
+ .RE
+ .PP
+
+@@ -2787,7 +2788,7 @@
+
+ .SS "u_int32_t libnet_get_prand (int mod)"
+ .PP
+-Generates an unsigned psuedo-random value within the range specified by mod. LIBNET_PR2 0 - 1 LIBNET_PR8 0 - 255 LIBNET_PR16 0 - 32767 LIBNET_PRu16 0 - 65535 LIBNET_PR32 0 - 2147483647 LIBNET_PRu32 0 - 4294967295
++Generates an unsigned psuedo-random value within the range specified by mod. LIBNET_PR2 0 \- 1 LIBNET_PR8 0 \- 255 LIBNET_PR16 0 \- 32767 LIBNET_PRu16 0 \- 65535 LIBNET_PR32 0 \- 2147483647 LIBNET_PRu32 0 \- 4294967295
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -2796,7 +2797,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -2860,7 +2861,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-protocol tag value on success, -1 on error
++protocol tag value on success, \-1 on error
+ .RE
+ .PP
+
+@@ -2964,7 +2965,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-network byte ordered IPv4 address or -1 (2^32 - 1) on error
++network byte ordered IPv4 address or \-1 (2^32 \- 1) on error
+ .RE
+ .PP
+
+@@ -2998,7 +2999,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -3028,13 +3029,13 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+ .SS "int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)"
+ .PP
+-Creates a new port list. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise). The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,-' of the general format 'x - y, z', where 'xyz' are port numbers between 0 and 65,535. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions. Upon success, the function returns 1. Upon failure, the function returns -1 and \fBlibnet_geterror()\fP can tell you why.
++Creates a new port list. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise). The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,\-' of the general format 'x \- y, z', where 'xyz' are port numbers between 0 and 65,535. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions. Upon success, the function returns 1. Upon failure, the function returns \-1 and \fBlibnet_geterror()\fP can tell you why.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -3047,13 +3048,13 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+ .SS "int libnet_plist_chain_next_pair (libnet_plist_t * plist, u_int16_t * bport, u_int16_t * eport)"
+ .PP
+-Returns the next port list chain pair from the port list chain plist. bport and eport contain the starting port number and ending port number, respectively. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0. Upon failure, the function returns -1.
++Returns the next port list chain pair from the port list chain plist. bport and eport contain the starting port number and ending port number, respectively. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0. Upon failure, the function returns \-1.
+ .PP
+ \fBParameters:\fP
+ .RS 4
+@@ -3066,7 +3067,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, 0 if empty, -1 on failure
++1 on success, 0 if empty, \-1 on failure
+ .RE
+ .PP
+
+@@ -3081,7 +3082,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -3112,7 +3113,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-1 on success, -1 on failure
++1 on success, \-1 on failure
+ .RE
+ .PP
+
+@@ -3127,7 +3128,7 @@
+ .PP
+ \fBReturns:\fP
+ .RS 4
+-the number of bytes written, -1 on error
++the number of bytes written, \-1 on error
+ .RE
+ .PP
+
diff --git a/debian/patches/02-fix_libnet_802_1q_hdr.3.patch b/debian/patches/02-fix_libnet_802_1q_hdr.3.patch
new file mode 100644
index 0000000..90d3961
--- /dev/null
+++ b/debian/patches/02-fix_libnet_802_1q_hdr.3.patch
@@ -0,0 +1,11 @@
+--- libnet.orig/doc/man/man3/libnet_802_1q_hdr.3
++++ libnet/doc/man/man3/libnet_802_1q_hdr.3
+@@ -2,7 +2,7 @@
+ .ad l
+ .nh
+ .SH NAME
+-libnet_802_1q_hdr \-
++libnet_802_1q_hdr \- IEEE 802.1Q VLAN header
+ .SH SYNOPSIS
+ .br
+ .PP
diff --git a/debian/patches/03-fix_libnet_802_1x_hdr.3.patch b/debian/patches/03-fix_libnet_802_1x_hdr.3.patch
new file mode 100644
index 0000000..2c9b945
--- /dev/null
+++ b/debian/patches/03-fix_libnet_802_1x_hdr.3.patch
@@ -0,0 +1,11 @@
+--- libnet.orig/doc/man/man3/libnet_802_1x_hdr.3
++++ libnet/doc/man/man3/libnet_802_1x_hdr.3
+@@ -2,7 +2,7 @@
+ .ad l
+ .nh
+ .SH NAME
+-libnet_802_1x_hdr \-
++libnet_802_1x_hdr \- IEEE 802.1X EAP header
+ .SH SYNOPSIS
+ .br
+ .PP
diff --git a/debian/patches/04-fix_libnet_build_ntp.patch b/debian/patches/04-fix_libnet_build_ntp.patch
new file mode 100644
index 0000000..4bf2d15
--- /dev/null
+++ b/debian/patches/04-fix_libnet_build_ntp.patch
@@ -0,0 +1,13 @@
+--- libnet.orig/src/libnet_build_ntp.c
++++ libnet/src/libnet_build_ntp.c
+@@ -85,8 +85,8 @@
+ ntp_hdr.ntp_ref_ts.fraction = htonl(ref_ts_frac);
+ ntp_hdr.ntp_orig_ts.integer = htonl(orig_ts_int);
+ ntp_hdr.ntp_orig_ts.fraction = htonl(orig_ts_frac);
+- ntp_hdr.ntp_rec_ts.integer = htonl(orig_ts_int);
+- ntp_hdr.ntp_rec_ts.fraction = htonl(orig_ts_frac);
++ ntp_hdr.ntp_rec_ts.integer = htonl(rec_ts_int);
++ ntp_hdr.ntp_rec_ts.fraction = htonl(rec_ts_frac);
+ ntp_hdr.ntp_xmt_ts.integer = htonl(xmt_ts_int);
+ ntp_hdr.ntp_xmt_ts.fraction = htonl(xmt_ts_frac);
+
diff --git a/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch b/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch
new file mode 100644
index 0000000..7c6a2f2
--- /dev/null
+++ b/debian/patches/05-fix_libnet_pblock_coalesce_buffer_overrun.patch
@@ -0,0 +1,11 @@
+--- libnet.orig/src/libnet_pblock.c
++++ libnet/src/libnet_pblock.c
+@@ -389,7 +389,7 @@
+ {
+ if ((q->flags) & LIBNET_PBLOCK_DO_CHECKSUM)
+ {
+- int offset = (l->total_size + l->aligner) - q->ip_offset;
++ int offset = l->aligner + q->ip_offset;
+ c = libnet_do_checksum(l, *packet + offset,
+ libnet_pblock_p2p(q->type), q->h_len);
+ if (c == -1)
diff --git a/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch b/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch
new file mode 100644
index 0000000..50b9411
--- /dev/null
+++ b/debian/patches/06-fix_libnet_pblock_coalesce_leak.patch
@@ -0,0 +1,49 @@
+--- libnet.orig/src/libnet_pblock.c
++++ libnet/src/libnet_pblock.c
+@@ -339,7 +339,7 @@
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
+ "%s(): packet assembly cannot find a layer 2 header\n",
+ __func__);
+- return (-1);
++ goto err;
+ }
+ break;
+ case LIBNET_RAW4:
+@@ -348,7 +348,7 @@
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
+ "%s(): packet assembly cannot find an IPv4 header\n",
+ __func__);
+- return (-1);
++ goto err;
+ }
+ break;
+ case LIBNET_RAW6:
+@@ -357,7 +357,7 @@
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
+ "%s(): packet assembly cannot find an IPv6 header\n",
+ __func__);
+- return (-1);
++ goto err;
+ }
+ break;
+ default:
+@@ -365,7 +365,7 @@
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
+ "%s(): suddenly the dungeon collapses -- you die\n",
+ __func__);
+- return (-1);
++ goto err;
+ break;
+ }
+ }
+@@ -419,6 +419,10 @@
+ *size -= l->aligner;
+ }
+ return (1);
++
++err:
++ free(packet);
++ return (-1);
+ }
+
+ void
diff --git a/debian/patches/07-add_libnet-cq-end-loop.patch b/debian/patches/07-add_libnet-cq-end-loop.patch
new file mode 100644
index 0000000..7f10311
--- /dev/null
+++ b/debian/patches/07-add_libnet-cq-end-loop.patch
@@ -0,0 +1,32 @@
+--- libnet-1.1.2.1.orig/src/libnet_cq.c
++++ libnet-1.1.2.1/src/libnet_cq.c
+@@ -393,3 +393,14 @@
+ {
+ return (l_cqd.node);
+ }
++
++u_int32_t
++libnet_cq_end_loop()
++{
++ if (! clear_cq_lock(CQ_LOCK_WRITE))
++ {
++ return (0);
++ }
++ l_cqd.current = l_cq;
++ return (1);
++}
+--- libnet-1.1.2.1.orig/include/libnet/libnet-functions.h
++++ libnet-1.1.2.1/include/libnet/libnet-functions.h
+@@ -1886,6 +1886,12 @@
+ libnet_cq_size();
+
+ /**
++ * [Context Queue]
++ */
++u_int32_t
++libnet_cq_end_loop();
++
++/**
+ * [Diagnostic]
+ * Prints the contents of the given context.
+ * @param l pointer to a libnet context
diff --git a/debian/patches/08-fix_libnet_checksum.c.patch b/debian/patches/08-fix_libnet_checksum.c.patch
new file mode 100644
index 0000000..627ddd7
--- /dev/null
+++ b/debian/patches/08-fix_libnet_checksum.c.patch
@@ -0,0 +1,23 @@
+--- libnet-1.1.2.1.orig/src/libnet_checksum.c
++++ libnet-1.1.2.1/src/libnet_checksum.c
+@@ -42,8 +42,10 @@
+ libnet_in_cksum(u_int16_t *addr, int len)
+ {
+ int sum;
++ u_int16_t last_byte;
+
+ sum = 0;
++ last_byte = 0;
+
+ while (len > 1)
+ {
+@@ -52,7 +54,8 @@
+ }
+ if (len == 1)
+ {
+- sum += *(u_int16_t *)addr;
++ *(u_int8_t *)&last_byte = *(u_int8_t *)addr;
++ sum += last_byte;
+ }
+
+ return (sum);
diff --git a/debian/patches/09-fix_hurd-i386_build.patch b/debian/patches/09-fix_hurd-i386_build.patch
new file mode 100644
index 0000000..6ab2b50
--- /dev/null
+++ b/debian/patches/09-fix_hurd-i386_build.patch
@@ -0,0 +1,11 @@
+--- libnet-1.1.2.1.orig/include/libnet.h.in
++++ libnet-1.1.2.1/include/libnet.h.in
+@@ -90,7 +90,7 @@
+ #include <winsock2.h>
+ #include <win32/in_systm.h>
+ #endif /* __WIN32__ */
+-#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__)
++#if !(__linux__) && !(__WIN32__) && !(__APPLE__) && !(__CYGWIN__) && !(__GNU__)
+ #include <netinet/ip_var.h>
+ #else /* __linux__ */
+ #if (HAVE_NET_ETHERNET_H)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..cb1db37
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,10 @@
+#00-fix_build_process.patch
+#01-fix_libnet-functions.h.3.patch
+#02-fix_libnet_802_1q_hdr.3.patch
+#03-fix_libnet_802_1x_hdr.3.patch
+#04-fix_libnet_build_ntp.patch
+#05-fix_libnet_pblock_coalesce_buffer_overrun.patch
+#06-fix_libnet_pblock_coalesce_leak.patch
+#07-add_libnet-cq-end-loop.patch
+#08-fix_libnet_checksum.c.patch
+#09-fix_hurd-i386_build.patch