Integrate 0.9.8 NDS read-only lab, repair upstream hook and simplify setup guidance

This commit is contained in:
2026-11-30 21:13:35 +00:00
parent b9fe2e61d2
commit c3aa4688d8
57 changed files with 2894 additions and 36 deletions

View File

@@ -6,7 +6,7 @@ all: build/mars-pcapd build/libmarspcap.a
build:
mkdir -p $@
build/mars-pcapd: src/broker.c src/slp.c src/ncp_ip.c src/ncp_ip_config.c src/wire.c src/pcap_dyn.c src/ipxpkt.c src/gateway.c src/dhcp.c src/gateway_config.c src/gateway.h src/ipxpkt.h src/wire.h src/pcap_dyn.h src/ncp_ip.h src/slp.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 src/broker.c src/slp.c src/ncp_ip.c src/ncp_ip_config.c src/wire.c src/pcap_dyn.c src/ipxpkt.c src/gateway.c src/dhcp.c src/gateway_config.c $(shell pkg-config --cflags --libs json-c) -ldl -o $@
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 src/broker.c src/slp.c src/ncp_ip.c src/ncp_ip_config.c src/wire.c src/pcap_dyn.c src/ipxpkt.c src/gateway.c src/dhcp.c src/gateway_config.c $(shell pkg-config --cflags --libs json-c sqlite3) -ldl -o $@
build/shim.o: src/shim.c src/shim.h src/wire.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -c $< -o $@
build/libmarspcap.a: build/shim.o
@@ -173,6 +173,8 @@ check-ncp-ip: build/test-ncp-ip-config
./build/test-ncp-ip-config
check-ncp-ip-integration: build/test-ncp-ip build/mars-pcapd
./tests/run_ncp_ip.sh
./tests/run_ncp_ip.sh --nds
./tests/run_ncp_ip.sh --invalid-nds
check-release: check-ncp-ip
check-ncp-ip: check-ncp-ip-ui
@@ -186,3 +188,50 @@ build/test-slp: tests/test_slp.c src/slp.c src/slp.h src/wire.h | build
check-slp: build/test-slp
./build/test-slp
check-release: check-slp
.PHONY: check-nds-lab
build/test-nds-lab: tests/test_nds_server.c nds/server.c nds/server.h nds/fragger.c nds/fragger.h nds/nds_directory.c nds/nds_directory.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -std=c11 -Inds tests/test_nds_server.c nds/server.c nds/fragger.c nds/nds_directory.c -o $@ $(shell pkg-config --cflags --libs json-c sqlite3)
check-nds-lab: build/test-nds-lab
./build/test-nds-lab
MARS_NDS_LAB=0 ./build/test-nds-lab disabled
MARS_NDS_LAB=1 MARS_NDS_LAB_CONFIG='{"tree":"X","organization":"Y","units":["A/B"]}' ./build/test-nds-lab invalid
python3 tests/test_nds_hook.py
check-release: check-nds-lab
.PHONY: check-nds-directory
build/test-nds-directory: tests/test_nds_directory.c nds/nds_directory.c nds/nds_directory.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Inds tests/test_nds_directory.c nds/nds_directory.c -o $@ $(shell pkg-config --cflags --libs sqlite3)
check-nds-directory: build/test-nds-directory build/test-nds-lab
python3 tests/test_nds_directory.py
python3 tests/test_nds_snapshot.py
check-release: check-nds-directory
.PHONY: check-nds-probe
check-nds-probe:
python3 tests/test_nds_probe.py
check-release: check-nds-probe
.PHONY: check-nds-schema
build/mars-nds-inspect: nds/tools/inspect.c nds/nds_directory.c nds/nds_directory.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Inds nds/tools/inspect.c nds/nds_directory.c -o $@ $(shell pkg-config --cflags --libs sqlite3)
check-nds-schema: build/mars-nds-inspect build/test-nds-lab build/test-nds-schema
python3 tests/test_nds_schema.py
build/test-nds-schema: tests/test_nds_schema.c nds/nds_directory.c nds/nds_directory.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -Inds tests/test_nds_schema.c nds/nds_directory.c -o $@ $(shell pkg-config --cflags --libs sqlite3)
check-release: check-nds-schema
.PHONY: check-nds-wire
build/test-nds-wire.so: nds/server.c nds/server.h nds/fragger.c nds/fragger.h nds/nds_directory.c nds/nds_directory.h | build
$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -std=c11 -shared -fPIC -Inds nds/server.c nds/fragger.c nds/nds_directory.c -o $@ $(shell pkg-config --cflags --libs json-c sqlite3)
check-nds-wire: build/test-nds-wire.so
python3 tests/test_nds_wire.py
check-release: check-nds-wire
# Optional independent legacy decoder/encoder check. NCPFS_DIR points to a
# configured ncpfs 2.2.6 checkout containing lib/libncp.a, not bundled here.
.PHONY: check-nds-ncpfs
check-nds-ncpfs: | build
test -n "$(NCPFS_DIR)" && test -f "$(NCPFS_DIR)/lib/libncp.a"
$(CC) -std=gnu11 -O2 -g -D_GNU_SOURCE -D_DEFAULT_SOURCE -DN_PLAT_LINUX -I"$(NCPFS_DIR)/include" -I"$(NCPFS_DIR)/lib" -I"$(NCPFS_DIR)" -Inds tests/test_nds_ncpfs.c nds/server.c nds/fragger.c nds/nds_directory.c "$(NCPFS_DIR)/lib/libncp.a" -Wl,--wrap=ncp_send_nds_frag -pthread $(shell pkg-config --cflags --libs json-c sqlite3) -o build/test-nds-ncpfs
python3 tests/test_nds_ncpfs.py