libnet - API for network packet management ChangeLog

HOWTO


# libnet
# ======
# There's a Libnet at sourceforge too - not the same thing.

# libnet 1.0.2a and 1.1.2.1 are available here at the packetfactory site:
# http://packetfactory.openwall.net/projects/libnet/
#
# Once that was no longer actively developed and the developer was not
# reachable, another developer started working on it at the libnet-dev
# SourceForge project:
# https://sourceforge.net/projects/libnet-dev/
# That was then moved over to GitHub:
# https://github.com/sam-github/libnet
# The last "release" version from GitHub is the 3rd one covered below, and
# that is the only one that will successfully build and install for me of
# the three.

# Prerequisites (for all versions):
# libpcap


# To remove libnet 1.0.x (to upgrade to 1.1.x or 1.2.x), run this:
su
( cd /usr/lib ; rm -f libnet.a libpwrite.a )
test $(uname -m) = 'x86_64' &&
( cd /usr/lib64 ; rm -f libnet.a libpwrite.a )
( cd /usr/include/libnet ; rm -f libnet-asn1.h libnet-functions.h \
  libnet-headers.h libnet-macros.h libnet-ospf.h libnet-structures.h )
rmdir /usr/include/libnet
rm -f /usr/bin/libnet-config /usr/include/libnet.h /usr/man/man3/libnet.3
exit


# libnet 1.0.2a (deprecated)
# =============
# Based on the file directory, this one is from 2001, good luck building
# it without alterations

# Get it
cd
test -f installed/libnet-1.0.2a.tar.gz &&
mv installed/libnet-1.0.2a.tar.gz .
test ! -f libnet-1.0.2a.tar.gz &&
wget http://packetfactory.openwall.net/projects/libnet/dist/\
deprecated/libnet-1.0.2a.tar.gz

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "Libnet-*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "libnet-*" -exec rm -r {} \;
tar xzvf ~/libnet-1.0.2a.tar.gz
cd Libnet-1.0.2a
test $UID = 0 && chown -R root:root .

# Fix include/libnet.h's multi line error definition that modern gcc doesn't
# like:
wget -nc https://englanders.us/pub/linux/patches/\
libnet-1.0.2a-libnet.h.patch && patch -p0 < libnet-1.0.2a-libnet.h.patch

# You may need --libdir=/usr/lib64 or similar here if 64-bit

# Configure the build
./configure

# Build it
make

# Become root to install it
su

# Install it
make install
ldconfig

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libnet-*.tar.*
mv libnet-1.0.2a.tar.gz installed/


# libnet 1.1.2.1 ("current", but seemingly abandoned)
# ==============
# Get it
cd
test -f installed/libnet-1.1.2.1.tar.gz &&
mv installed/libnet-1.1.2.1.tar.gz .
test ! -f libnet-1.1.2.1.tar.gz &&
wget -O libnet-1.1.2.1.tar.gz \
  http://packetfactory.openwall.net/projects/libnet/dist/libnet.tar.gz

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "Libnet-*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "libnet-*" -exec rm -r {} \;
tar xzvf ~/libnet-1.1.2.1.tar.gz
mv libnet libnet-1.1.2.1
cd libnet-1.1.2.1
test $UID = 0 && chown -R root:root .

# Configure the build
./configure

# Build it
make

# Become root to install it
su

make install
install libnet-config /usr/bin/

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libnet-*.tar.*
mv libnet-1.1.2.1.tar.gz installed/


# libnet 1.2-rc3 (fork of the original)
# ==============
# If you want even newer code than this, there are some updates in
# Git that are not yet part of a "release"

# Get it
cd
test -f installed/libnet-1.2-rc3.tar.gz &&
mv -f installed/libnet-1.2-rc3.tar.gz .
test ! -f libnet-1.2-rc3.tar.gz &&
wget https://github.com/sam-github/libnet/archive/libnet-1.2-rc3.tar.gz

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "[Ll]ibnet-*" -exec rm -r {} \;
tar xzvf ~/libnet-1.2-rc3.tar.gz
cd libnet-libnet-1.2-rc3
test $UID = 0 && chown -R root:root .
cd libnet

# Generate autoconf, automake, libtool files
./autogen.sh

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --enable-shared --libdir=/usr/local/lib64 \
  --mandir=/usr/local/man --with-pic --enable-dependency-tracking

# Configure the build for anything else
test $(uname -m) != 'x86_64' && ./configure

# Build it
make -C doc doc
make

# Become root to install it
su

# Install it
make install
ldconfig

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libnet-*.tar.*
mv libnet-1.2-rc3.tar.gz installed/


# If you ever want to uninstall libnet, this should do it:
cd
su
test -d src/libnet-* && ( cd src/libnet-* ; make uninstall )
for pfx in /usr /usr/local;
do
  test -d ${pfx}/include/libnet && rm -r ${pfx}/include/libnet
  test -d ${pfx}/man/man3 &&
   ( cd ${pfx}/man/man3
     rm -f libnet-functions.3 libnet-macros.3 libnet.h.3 )
  rm -f ${pfx}/bin/libnet-config ${pfx}/include/libnet.h \
   ${pfx}/lib*/libnet.*
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libnet-*" -exec rm -r {} \;
rm -f ~/installed/libnet-*.tar.*

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EDT -0400)
HOWTO last updated: 2019-01-26 3:05am
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]