- Extract NAT detection logic (~250 lines) from topo_group.c into new nat_detection.c - NAT_DETECTION struct owns ping_pending, next_ping_req_id, allow_nat_check_local (removed from TOPO_GROUP) - route_ping.* signatures changed: TOPO_GROUP* -> NAT_DETECTION* (+ TOPO_GROUP* where needed) - topo_group.c now only dispatches BGP subcommands to nat_detection_* handlers - UTUN_INSTANCE gets struct NAT_DETECTION* nat_det field (init/destroy in topo_groups_init/destroy) - External callers (etcp_connections, etcp, control_server) call nat_detection_* directly - nat_detection_cancel_for_conn / nat_detection_send_nat_info / nat_detection_link_ready / nat_detection_request_check_all - route_ping_destroy_pending properly implemented (was dead code) - TOPO_SUBCMD_PING_REQ/RESP moved from route_ping.h to topo_group.h (all BGP subcommands in one place) - Tests updated: test_nat_detection, test_route_ping - both PASSED - Build: auto(CORE_SOURCES+libutun) and cmake(chatgui/libutun)
159 lines
2.9 KiB
Makefile
159 lines
2.9 KiB
Makefile
bin_PROGRAMS = utun
|
|
noinst_LIBRARIES = libutun.a
|
|
|
|
# Sources that are always compiled
|
|
utun_CORE_SOURCES = \
|
|
utun.c \
|
|
utun_instance.c \
|
|
config_parser.c \
|
|
config_updater.c \
|
|
route_lib.c \
|
|
route6_lib.c \
|
|
topo_group.c \
|
|
route_ping.c \
|
|
nat_detection.c \
|
|
topo_node.c \
|
|
topo_node_sqlite.c \
|
|
route_connectivity.c \
|
|
conn_mgr.c \
|
|
db_sync.c \
|
|
routing.c \
|
|
tun_if.c \
|
|
tun_route.c \
|
|
tun_linux.c \
|
|
tun_freebsd.c \
|
|
tun_windows.c \
|
|
etcp.c \
|
|
etcp_connections.c \
|
|
etcp_bbr.c \
|
|
etcp_loadbalancer.c \
|
|
etcp_debug.c \
|
|
etcp_dump.c \
|
|
secure_channel.c \
|
|
crc32.c \
|
|
stcp_link.c \
|
|
stcp.c \
|
|
stcp_server.c \
|
|
stcp_client.c \
|
|
pkt_normalizer.c \
|
|
packet_dump.c \
|
|
etcp_api.c \
|
|
etcp_connect.c \
|
|
control_server.c \
|
|
msg_transport.c \
|
|
firewall.c \
|
|
eim_nat.c \
|
|
nat_transport.c \
|
|
dummynet.c \
|
|
ntp_time.c \
|
|
ntp_node_time.c \
|
|
proxy/tcp_proxy_client.c \
|
|
etcp_router.c \
|
|
proxy/tcp_proxy_server.c \
|
|
proxy/udp_proxy.c \
|
|
proxy/socks_proxy.c \
|
|
proxy/icmp_proxy.c \
|
|
lwip_tcp/lwip_pbuf.c \
|
|
lwip_tcp/lwip_tcp.c \
|
|
lwip_tcp/lwip_tcp_in.c \
|
|
lwip_tcp/lwip_tcp_out.c
|
|
|
|
# libutun: all core sources except main()
|
|
libutun_a_SOURCES = \
|
|
utun_instance.c \
|
|
config_parser.c \
|
|
config_updater.c \
|
|
route_lib.c \
|
|
route6_lib.c \
|
|
topo_group.c \
|
|
route_ping.c \
|
|
nat_detection.c \
|
|
topo_node.c \
|
|
topo_node_sqlite.c \
|
|
route_connectivity.c \
|
|
conn_mgr.c \
|
|
db_sync.c \
|
|
routing.c \
|
|
tun_if.c \
|
|
tun_route.c \
|
|
tun_linux.c \
|
|
tun_freebsd.c \
|
|
tun_windows.c \
|
|
etcp.c \
|
|
etcp_connections.c \
|
|
etcp_bbr.c \
|
|
etcp_loadbalancer.c \
|
|
etcp_debug.c \
|
|
etcp_dump.c \
|
|
secure_channel.c \
|
|
crc32.c \
|
|
stcp_link.c \
|
|
stcp.c \
|
|
stcp_server.c \
|
|
stcp_client.c \
|
|
pkt_normalizer.c \
|
|
packet_dump.c \
|
|
etcp_api.c \
|
|
etcp_connect.c \
|
|
control_server.c \
|
|
msg_transport.c \
|
|
firewall.c \
|
|
eim_nat.c \
|
|
nat_transport.c \
|
|
dummynet.c \
|
|
ntp_time.c \
|
|
ntp_node_time.c \
|
|
proxy/tcp_proxy_client.c \
|
|
etcp_router.c \
|
|
proxy/tcp_proxy_server.c \
|
|
proxy/udp_proxy.c \
|
|
proxy/socks_proxy.c \
|
|
proxy/icmp_proxy.c \
|
|
lwip_tcp/lwip_pbuf.c \
|
|
lwip_tcp/lwip_tcp.c \
|
|
lwip_tcp/lwip_tcp_in.c \
|
|
lwip_tcp/lwip_tcp_out.c
|
|
libutun_a_CFLAGS = $(utun_CFLAGS)
|
|
|
|
# Platform-specific TUN libs (Windows only)
|
|
utun_TUN_LIBS = @TUN_LIBS@
|
|
|
|
utun_SOURCES = utun.c
|
|
|
|
# Include paths
|
|
utun_CFLAGS = \
|
|
-I$(top_srcdir)/lib \
|
|
-I$(top_srcdir)/src/uip \
|
|
-g \
|
|
-DUSE_SQLITE \
|
|
-DSQLITE_THREADSAFE=1 \
|
|
$(DEBUG_FLAGS)
|
|
|
|
# Libraries
|
|
utun_LDADD = \
|
|
libutun.a \
|
|
$(top_builddir)/lib/libuasync.a \
|
|
-lpthread \
|
|
-lm \
|
|
-lcrypto \
|
|
$(utun_TUN_LIBS)
|
|
|
|
# Copy binary to project root after building
|
|
all-local: copy-to-root
|
|
|
|
copy-to-root: utun$(EXEEXT)
|
|
@cp -f utun$(EXEEXT) $(top_srcdir)/
|
|
@cp -f $(top_srcdir)/lib/wintun.dll $(top_srcdir)/ 2>/dev/null || echo "Warning: wintun.dll not found in lib/"
|
|
if OS_WINDOWS
|
|
@cp -f $(srcdir)/utun.manifest $(top_srcdir)/utun.exe.manifest 2>/dev/null || true
|
|
endif
|
|
|
|
# Clean
|
|
clean-local:
|
|
@true
|
|
|
|
# Install directories
|
|
install-exec-hook:
|
|
$(MKDIR_P) $(DESTDIR)$(bindir)
|
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/utun
|