From deffcdb6389dfbdb3d9169065db04e37020a17f5 Mon Sep 17 00:00:00 2001 From: _Frky <3105926+Frky@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:23:00 +0200 Subject: [PATCH] Fix bug when iterating more than twice --- src/proto-tcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/proto-tcp.c b/src/proto-tcp.c index 61b96549..e2fa8635 100644 --- a/src/proto-tcp.c +++ b/src/proto-tcp.c @@ -1426,15 +1426,15 @@ application(struct TCP_ConnectionTable *tcpcon, new_pkt->length = tcp_create_packet( tcpcon->pkt_template, tcb->ip_them, tcb->port_them, - tcb->ip_me, tcb->port_me + 1, + tcb->ip_me, tcb->port_me + tcb->banner1_state.iter, /* XXX: the trick here is to use a different key for the syn-cookie * in order to differentiate in the receiving thread the different * protocol attempts we are doing on the same ip:port */ syn_cookie_ipv4( tcb->ip_them.ipv4, tcb->port_them, - tcb->ip_me.ipv4, tcb->port_me, - tcpcon->entropy + tcb->banner1_state.iter + 1 + tcb->ip_me.ipv4, tcb->port_me + tcb->banner1_state.iter, + tcpcon->entropy + tcb->banner1_state.iter ), 0, /* SYN */ @@ -1443,8 +1443,8 @@ application(struct TCP_ConnectionTable *tcpcon, new_pkt->px, sizeof(new_pkt->px) ); - if (tcpcon->stack->src->port.last < tcb->port_me + 1) { - tcpcon->stack->src->port.last = tcb->port_me + 1; + if (tcpcon->stack->src->port.last < tcb->port_me + tcb->banner1_state.iter) { + tcpcon->stack->src->port.last = tcb->port_me + tcb->banner1_state.iter; } /* Put this buffer on the transmit queue. Remember: transmits happen * from a transmit-thread only, and this function is being called