Skip to content

Commit

Permalink
ci: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Dec 18, 2024
1 parent 1b505dd commit 6a25345
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
set(BUILD_STATIC_LIBS ON CACHE INTERNAL "")
FetchContent_MakeAvailable(llhttp)

target_link_libraries(ua2f mnl netfilter_queue pthread nfnetlink) # disable llhttp_static first
target_link_libraries(ua2f mnl netfilter_queue pthread nfnetlink llhttp_static)

install(TARGETS ua2f RUNTIME DESTINATION bin)

Expand Down
5 changes: 5 additions & 0 deletions src/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
// will this happen?
send_verdict(queue, pkt, get_next_mark(pkt, false), NULL);
syslog(LOG_WARNING, "Received unknown ip packet %x. You may set wrong firewall rules.", pkt->hw_protocol);
goto end;
}

if (type == IPV4) {
Expand All @@ -255,6 +256,10 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
const __auto_type tcp_hdr = nfq_tcp_get_hdr(pkt_buff);
if (tcp_hdr == NULL) {
// This packet is not tcp, pass it
char buf[1000];
nfq_ip_snprintf(buf, sizeof(buf), nfq_ip_get_hdr(pkt_buff));
printf("Received non-tcp packet: %s\n", buf);

send_verdict(queue, pkt, (struct mark_op){false, 0}, NULL);
syslog(LOG_WARNING, "Received non-tcp packet. You may set wrong firewall rules.");
goto end;
Expand Down

0 comments on commit 6a25345

Please sign in to comment.