diff --git a/dhcp4relay/.gitignore b/dhcp4relay/.gitignore new file mode 100644 index 0000000..1d89f39 --- /dev/null +++ b/dhcp4relay/.gitignore @@ -0,0 +1,15 @@ +# Build artifacts +build/ +build-test/ +*.o +*.d +*.gcda +*.gcno +*.gcov +*.html +*.xml + +# PcapPlusPlus downloaded files +PcapPlusPlus-*/ +PcapPlusPlus-*.tar.gz +pcappp.stamp diff --git a/dhcp4relay/Makefile b/dhcp4relay/Makefile index eda86cc..31eaa39 100644 --- a/dhcp4relay/Makefile +++ b/dhcp4relay/Makefile @@ -15,9 +15,11 @@ GCOVR := gcovr LD_PCAPPLUSPLUS_LIB := -lPcap++ -lPacket++ -lCommon++ -#pcap plus plus zip file pcappp_v24.09.zip +# PcapPlusPlus library configuration PCAPPPVAR := 24.09 -PCAPPPZIP_FILE := pcappp_v${PCAPPPVAR}.zip +PCAPPP_URL := https://github.com/seladb/PcapPlusPlus/archive/refs/tags/v$(PCAPPPVAR).tar.gz +PCAPPP_TARBALL := PcapPlusPlus-$(PCAPPPVAR).tar.gz +PCAPPP_SHA256 := b14998ecf5718c2bfb6f709060e53f7ef67639b98bf2222a3cd23d820d70acdc PCAPPLUSPLUS_DIR := $(WORKING_DIR)/PcapPlusPlus-$(PCAPPPVAR) PCAPPP_DONE = $(WORKING_DIR)/pcappp.stamp INCLUDE_DIR = $(PCAPPLUSPLUS_DIR)/include @@ -34,10 +36,20 @@ PWD := $(shell pwd) .PHONY: $(PCAPPP_DONE) $(PCAPPP_DONE): + # Download PcapPlusPlus from official GitHub release if not already present + if [ ! -f $(PCAPPP_TARBALL) ]; then \ + echo "Downloading PcapPlusPlus v$(PCAPPPVAR)..."; \ + wget -O $(PCAPPP_TARBALL) $(PCAPPP_URL); \ + fi + + # Verify checksum + echo "$(PCAPPP_SHA256) $(PCAPPP_TARBALL)" | sha256sum -c - + # Remove stale files rm -rf $(PCAPPLUSPLUS_DIR) - unzip ${PCAPPPZIP_FILE} + # Extract tarball (GitHub tarball extracts to PcapPlusPlus- without 'v' prefix) + tar xzf $(PCAPPP_TARBALL) pushd $(PCAPPLUSPLUS_DIR) # Create a git repository here for stg to apply patches @@ -98,6 +110,7 @@ uninstall: clean: -$(RM) $(BUILD_DIR) $(BUILD_TEST_DIR) *.html *.xml + -$(RM) $(PCAPPLUSPLUS_DIR) $(PCAPPP_TARBALL) $(PCAPPP_DONE) $(FIND) . -name *.gcda -exec rm -f {} \; $(FIND) . -name *.gcno -exec rm -f {} \; $(FIND) . -name *.gcov -exec rm -f {} \; diff --git a/dhcp4relay/patch/0001-dhcpv4-relay-accept-random-src-port.patch b/dhcp4relay/patch/0001-dhcpv4-relay-accept-random-src-port.patch index f0729b6..ac9ab57 100644 --- a/dhcp4relay/patch/0001-dhcpv4-relay-accept-random-src-port.patch +++ b/dhcp4relay/patch/0001-dhcpv4-relay-accept-random-src-port.patch @@ -1,7 +1,7 @@ -diff --git a/PcapPlusPlus-24.09/Packet++/header/DhcpLayer.h b/PcapPlusPlus-24.09/Packet++/header/DhcpLayer.h +diff --git a/Packet++/header/DhcpLayer.h b/Packet++/header/DhcpLayer.h index 435becb..282d739 100644 ---- a/PcapPlusPlus-24.09/Packet++/header/DhcpLayer.h -+++ b/PcapPlusPlus-24.09/Packet++/header/DhcpLayer.h +--- a/Packet++/header/DhcpLayer.h ++++ b/Packet++/header/DhcpLayer.h @@ -881,8 +881,8 @@ namespace pcpp bool DhcpLayer::isDhcpPorts(uint16_t portSrc, uint16_t portDst) diff --git a/dhcp4relay/pcappp_v24.09.zip b/dhcp4relay/pcappp_v24.09.zip deleted file mode 100644 index cdbbd6c..0000000 Binary files a/dhcp4relay/pcappp_v24.09.zip and /dev/null differ