Packages: Add libnet 1.0 and 1.1

foxtrot
Foxtrot 2019-08-20 19:07:00 +01:00
parent 254ec00aac
commit e139a9e47f
8 changed files with 335 additions and 0 deletions

View File

@ -0,0 +1,74 @@
#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnet0
PKG_VERSION:=1.0.2a
PKG_RELEASE:=9
PKG_SOURCE:=libnet-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/deprecated/
PKG_MD5SUM:=ddf53f0f484184390e8c2a1bd0853667
PKG_BUILD_DIR:=$(BUILD_DIR)/Libnet-$(PKG_VERSION)
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnet0
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpcap
TITLE:=Low-level packet creation library (v1.0.x)
URL:=http://www.packetfactory.net/libnet/
endef
ENDIANESS:=lil
ifeq ($(CONFIG_BIG_ENDIAN),y)
ENDIANESS:=big
endif
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-shared \
--enable-static \
--with-pf_packet=yes
CONFIGURE_VARS += \
ac_cv_libnet_endianess=$(ENDIANESS) \
ac_libnet_have_pf_packet=yes \
LL_INT_TYPE=sockpacket
define Build/Configure
(cd $(PKG_BUILD_DIR); touch \
configure.in \
include.m4 \
aclocal.m4 \
Makefile.in \
configure \
);
$(call Build/Configure/Default)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.0.x/bin/
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.0.x/include/
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.0.x/lib/
endef
define Package/libnet0/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnet0))

Binary file not shown.

View File

@ -0,0 +1,28 @@
diff -ur libnet.old/configure libnet.dev/configure
--- libnet.old/configure 2007-04-01 17:36:55.000000000 +0200
+++ libnet.dev/configure 2007-04-01 17:40:06.000000000 +0200
@@ -8613,7 +8613,9 @@
echo "$as_me:$LINENO: checking low-level packet interface type" >&5
echo $ECHO_N "checking low-level packet interface type... $ECHO_C" >&6
-if test -r /dev/bpf0 ; then
+if [ -n "$LL_INT_TYPE" ]; then
+ echo "$as_me:$LINENO: result: found $LL_INT_TYPE (cached)" >&5
+elif test -r /dev/bpf0 ; then
LL_INT_TYPE=bpf
echo "$as_me:$LINENO: result: found bpf" >&5
echo "${ECHO_T}found bpf" >&6
diff -ur libnet.old/configure.in libnet.dev/configure.in
--- libnet.old/configure.in 2007-04-01 17:36:55.000000000 +0200
+++ libnet.dev/configure.in 2007-04-01 17:41:08.000000000 +0200
@@ -97,7 +97,9 @@
dnl
AC_MSG_CHECKING(low-level packet interface type)
-if test -r /dev/bpf0 ; then
+if [ -n "$LL_INT_TYPE" ]; then
+ AC_MSG_RESULT(found $LL_INT_TYPE (cached))
+elif test -r /dev/bpf0 ; then
LL_INT_TYPE=bpf
AC_MSG_RESULT(found bpf)
elif test -r /usr/include/net/pfilt.h ; then

View File

@ -0,0 +1,19 @@
--- a/configure.in 2014-03-06 14:55:36.627221831 -0800
+++ b/configure.in 2014-03-06 14:56:48.709112089 -0800
@@ -53,16 +53,6 @@
dnl
-dnl Use these compiler flags if we have gcc.
-dnl
-if test $ac_cv_prog_gcc = yes; then
-dnl if test -z $CFLAGS; then
- CCOPTS='-O2 -funroll-loops -fomit-frame-pointer -Wall'
- CFLAGS="$CCOPTS"
-dnl fi
-fi
-
-dnl
dnl Check for package inclusion/exclusion
dnl
AC_ARG_WITH(pf_packet, [ --with-pf_packet=[yes,no] override defaults], \

View File

@ -0,0 +1,75 @@
#
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnet
PKG_VERSION:=1.1.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
PKG_MD5SUM:=be845c41170d72c7db524f3411b50256
PKG_BUILD_DIR:=$(BUILD_DIR)/libnet
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnet1
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpcap
TITLE:=Low-level packet creation library (v1.1.x)
URL:=http://www.packetfactory.net/libnet/
endef
ENDIANESS:=lil
ifeq ($(CONFIG_BIG_ENDIAN),y)
ENDIANESS:=big
endif
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-shared \
--enable-static \
--with-pf_packet=yes
CONFIGURE_VARS += \
ac_cv_libnet_endianess=$(ENDIANESS) \
ac_libnet_have_pf_packet=yes \
LL_INT_TYPE=libnet_link_linux
define Build/Configure
(cd $(PKG_BUILD_DIR); touch \
configure.in \
include.m4 \
aclocal.m4 \
Makefile.in \
configure \
);
$(call Build/Configure/Default)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.1.x/bin/
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.1.x/include/
$(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.1.x/lib/
endef
define Package/libnet1/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnet1))

View File

@ -0,0 +1,107 @@
--- a/configure.in
+++ b/configure.in
@@ -21,7 +21,7 @@ dnl Check for the usual programs
dnl
AC_PROG_CC
AC_PROG_INSTALL
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
AC_CHECK_HEADERS(sys/sockio.h)
--- a/include/libnet/libnet-functions.h
+++ b/include/libnet/libnet-functions.h
@@ -1429,7 +1429,7 @@ libnet_t *l, libnet_ptag_t ptag);
* @param ptag protocol tag to modify an existing header, 0 to build a new one
* @return protocol tag value on success, -1 on error
*/
-inline u_int32_t
+u_int32_t
libnet_getgre_length(u_int16_t fv);
/**
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,4 +12,4 @@ SUBDIRS = include src sample
EXTRA_DIST = Makefile.am.common
-bin_scripts = libnet-config
+bin_SCRIPTS = libnet-config
--- a/sample/Makefile.am
+++ b/sample/Makefile.am
@@ -60,4 +60,4 @@ ip_raw_SOURCES = ip_raw.c
ip_link_SOURCES = ip_link.c
sebek_SOURCES = sebek.c
-LDADD = $(top_srcdir)/src/libnet.a
+LDADD = $(top_srcdir)/src/libnet.la
--- a/src/libnet_checksum.c
+++ b/src/libnet_checksum.c
@@ -42,8 +42,10 @@ int
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 @@ libnet_in_cksum(u_int16_t *addr, int len
}
if (len == 1)
{
- sum += *(u_int16_t *)addr;
+ *(u_int8_t*)&last_byte = *(u_int8_t*)addr;
+ sum += last_byte;
}
return (sum);
--- a/src/Makefile.am
+++ b/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_a_SOURCES = libnet_asn1.c \
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]]

View File

@ -0,0 +1,14 @@
--- a/configure.in
+++ b/configure.in
@@ -67,7 +67,10 @@ dnl Get link-layer interface type
dnl
AC_MSG_CHECKING(link-layer packet interface type)
-if test -r /dev/bpf0 ; then
+if test -n "$LL_INT_TYPE"; then
+ AC_LIBOBJ($LL_INT_TYPE)
+ AC_MSG_RESULT(found $LL_INT_TYPE (cached))
+elif test -r /dev/bpf0 ; then
AC_LIBOBJ([libnet_link_bpf])
AC_MSG_RESULT(found bpf)
elif test -r /usr/include/net/pfilt.h ; then

View File

@ -0,0 +1,18 @@
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -281,6 +281,7 @@ dnl
AC_DEFUN(AC_LIBNET_ENDIAN_CHECK,
[AC_MSG_CHECKING(machine endianess)
+ if \! test x${ac_cv_libnet_endianess+set} = xset ; then
cat > conftest.c << EOF
# include <stdio.h>
# include <stdlib.h>
@@ -332,6 +333,7 @@ dnl failed to compile for some reason
fi
fi
rm -f conftest* core core.conftest
+ fi
AC_MSG_RESULT($ac_cv_libnet_endianess)