diff --git a/logging.h b/logging.h index 60b21eb..29a6ba9 100644 --- a/logging.h +++ b/logging.h @@ -24,8 +24,11 @@ #define lgdebugmsg(msg, ...) \ (LOG_LEVEL >= VERBOSE_DEBUG ? printf(msg "\n", ##__VA_ARGS__) : 0) -#define lgtracemsg(msg, ...) \ -(LOG_LEVEL >= VERBOSE_TRACE ? printf(msg "\n", ##__VA_ARGS__) : 0) + +#define lgtrace(msg, ...) \ +(LOG_LEVEL >= VERBOSE_TRACE ? printf(msg, ##__VA_ARGS__) : 0) + +#define lgtracemsg(msg, ...) lgtrace(msg "\n", __VA_ARGS__) #define lgtrace_start(msg, ...) \ (LOG_LEVEL >= VERBOSE_TRACE ? printf("[TRACE] " msg " ( ", ##__VA_ARGS__) : 0) diff --git a/mangle.c b/mangle.c index bfb1932..4c0a83f 100644 --- a/mangle.c +++ b/mangle.c @@ -382,6 +382,12 @@ send_fake: } memcpy(fake_pad, frag2, iphfl + tcphfl); memset(fake_pad + iphfl + tcphfl, 0, f2len - iphfl - tcphfl); + struct tcphdr *fakethdr = (void *)(fake_pad + iphfl); + if (config.faking_strategy == FAKE_STRAT_PAST_SEQ) { + lgtrace("frag fake sent with %d -> ", ntohl(fakethdr->seq)); + fakethdr->seq = htonl(ntohl(fakethdr->seq) - dvs); + lgtrace("%d\n", ntohl(fakethdr->seq)); + } ret = fail4_packet(fake_pad, f2len); if (ret < 0) { lgerror("Failed to fail packet", ret); @@ -752,7 +758,10 @@ int fail4_packet(uint8_t *payload, uint32_t plen) { tcph->ack_seq = random(); #endif } else if (config.faking_strategy == FAKE_STRAT_PAST_SEQ) { + lgtrace("fake sent with %d -> ", ntohl(tcph->seq)); tcph->seq = htonl(ntohl(tcph->seq) - dlen); + lgtrace("%d\n", ntohl(tcph->seq)); + } else if (config.faking_strategy == FAKE_STRAT_TTL) { iph->ttl = config.faking_ttl; }