Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3553C6FD18 for ; Tue, 28 Mar 2023 21:08:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A328E85CFA; Tue, 28 Mar 2023 23:07:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="aTtaBHQe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98CC0857BC; Tue, 28 Mar 2023 22:31:19 +0200 (CEST) Received: from mail-ed1-x549.google.com (mail-ed1-x549.google.com [IPv6:2a00:1450:4864:20::549]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E2C2C85C14 for ; Tue, 28 Mar 2023 22:31:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=3k04jZAkKBuQJOSUXOTTeMUUMRK.IUSa-HUUZROYZY.JKTd.JK@flex--dimorinny.bounces.google.com Received: by mail-ed1-x549.google.com with SMTP id h11-20020a0564020e8b00b004e59d4722a3so18972211eda.6 for ; Tue, 28 Mar 2023 13:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680035475; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=nYT+tm/KCUTMZfSEPTDSJZnGVffVZDFqG8sdHijw6TY=; b=aTtaBHQeTB7KhNzEJ9z7ZfUp+k0bBMKOti7S3OnELCvd8TcNay7UKG7YUGS0SK8GXQ CRtwygdsrDAnMAVu+WSU3GXEmCmM0tCCYkPiKO/IOnIrxYJ3LfASD12OOaTRqq3h2t6M E1//X1+06H7FFJzj0eAJxRT9lxSir1xC+yWWB9U2VB93g9g+ngNG9F2XKFXz2AQKcB8d yX8ZqajnlgGa0K5oAwVeoBLXWwJ8xtHOuxTjFUaBlJSNtOGUMZBFQiuk1YwRSDey86kc 2wpVfeDoPzONfPkcKUxWN87fkb6fm4wOzvnbyV0EsWO4PuSA5UaZe75nnU8yI/E5LUx9 h+pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680035475; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nYT+tm/KCUTMZfSEPTDSJZnGVffVZDFqG8sdHijw6TY=; b=1pmrYc1BZ5rIjPPhqP4ffF7immEyAUcwl/rijn8KnnQxe3JfHnJV7/QTNyW1Uh7kCC jIOSbacUXQW1RQCbAN7MLYjyGl5e0fuRayZHyTAHEuJmODw8PhqsqURab7azGO3Swmnh EZm8Ny3kn8goWX4sjWmJiYX9xQsj4n1K+DepF8BtsTE7f9/Dsq8aXZjS6gJATq2PIWQB BuSttibTmJO6qydcGQxkZ+PiSDSunz0TotmvWZ0qFad5QsnvBxr2l4rBP7bUOFzp0wcC 9wwaRPk2OHidMrs0VbJKUANf7sSZVrPepm+fKG5CLhhuyufCvBr+iU+TYz876WRttST4 v1yQ== X-Gm-Message-State: AAQBX9fzCxFL/miwDK0uXlzK68N6+mhGmvD3tQh6T4u3VTYeqy1jvDST mQ7gax9pIyZBRBHbKMSO/PkKqxiAdW6Bq4Nec4t+wCgn3RKfoROqq9P4EDV/K9QuAuNqtO+KMv3 22ip8pOJjq/LTN34N1Lb5Osr7QTC2+RHo38dNCRcACenhOlu5vL2Hlyz8W+sTuv5GrD8= X-Google-Smtp-Source: AKy350aQ1dNd1WJRRt9pWQ7zQF+s0Om2wt5mqFXCrxnGks9KacxeUh0AC35DLErCWRjAPy/DQueOfUtyzbarJyE= X-Received: from dimorinny0.lon.corp.google.com ([2a00:79e0:d:209:dec6:15cf:125b:436b]) (user=dimorinny job=sendgmr) by 2002:a50:9f62:0:b0:4fa:d8aa:74ad with SMTP id b89-20020a509f62000000b004fad8aa74admr8242410edf.8.1680035475286; Tue, 28 Mar 2023 13:31:15 -0700 (PDT) Date: Tue, 28 Mar 2023 21:31:09 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230328203111.1032378-1-dimorinny@google.com> Subject: [PATCH 1/3] net: support being a TCP server to unblock TCP fastboot From: Dmitrii Merkurev To: u-boot@lists.denx.de Cc: Dmitrii Merkurev , Ying-Chun Liu , Simon Glass Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Tue, 28 Mar 2023 23:07:15 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Make following changes to unblock TCP fastboot support: 1. Implement being a TCP server support 2. Introduce dedicated TCP traffic handler (get rid of UDP signature) 3. Ensure seq_num and ack_num are respected in net_send_tcp_packet function (make sure existing wget_cmd code is reflected with the fix) Signed-off-by: Dmitrii Merkurev Cc: Ying-Chun Liu (PaulLiu) Cc: Simon Glass =D0=A1=D1=81: Joe Hershberger =D0=A1=D1=81: Ramon Fried --- include/net/tcp.h | 16 +++++-- net/tcp.c | 115 +++++++++++++++++++++++----------------------- net/wget.c | 43 ++++++++--------- 3 files changed, 90 insertions(+), 84 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 322551694f..c29d4ce24a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -259,6 +259,7 @@ union tcp_build_pkt { * enum tcp_state - TCP State machine states for connection * @TCP_CLOSED: Need to send SYN to connect * @TCP_SYN_SENT: Trying to connect, waiting for SYN ACK + * @TCP_SYN_RECEIVED: Initial SYN received, waiting for ACK * @TCP_ESTABLISHED: both server & client have a connection * @TCP_CLOSE_WAIT: Rec FIN, passed to app for FIN, ACK rsp * @TCP_CLOSING: Rec FIN, sent FIN, ACK waiting for ACK @@ -268,6 +269,7 @@ union tcp_build_pkt { enum tcp_state { TCP_CLOSED, TCP_SYN_SENT, + TCP_SYN_RECEIVED, TCP_ESTABLISHED, TCP_CLOSE_WAIT, TCP_CLOSING, @@ -283,14 +285,18 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int spo= rt, int payload_len, /** * rxhand_tcp() - An incoming packet handler. * @pkt: pointer to the application packet - * @dport: destination UDP port + * @dport: destination TCP port * @sip: source IP address - * @sport: source UDP port + * @sport: source TCP port + * @tcp_seq_num: TCP sequential number + * @tcp_ack_num: TCP acknowledgment number + * @action: TCP action (SYN, ACK, FIN, etc) * @len: packet length */ -typedef void rxhand_tcp(uchar *pkt, unsigned int dport, - struct in_addr sip, unsigned int sport, - unsigned int len); +typedef void rxhand_tcp(uchar *pkt, u16 dport, + struct in_addr sip, u16 sport, + u32 tcp_seq_num, u32 tcp_ack_num, + u8 action, unsigned int len); void tcp_set_tcp_handler(rxhand_tcp *f); =20 void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int len); diff --git a/net/tcp.c b/net/tcp.c index 8d338c72e8..a713e1dd60 100644 --- a/net/tcp.c +++ b/net/tcp.c @@ -36,7 +36,6 @@ static u32 rmt_timestamp; =20 static u32 tcp_seq_init; static u32 tcp_ack_edge; -static u32 tcp_seq_max; =20 static int tcp_activity_count; =20 @@ -90,9 +89,10 @@ void tcp_set_tcp_state(enum tcp_state new_state) current_tcp_state =3D new_state; } =20 -static void dummy_handler(uchar *pkt, unsigned int dport, - struct in_addr sip, unsigned int sport, - unsigned int len) +static void dummy_handler(uchar *pkt, u16 dport, + struct in_addr sip, u16 sport, + u32 tcp_seq_num, u32 tcp_ack_num, + u8 action, unsigned int len) { } =20 @@ -256,7 +256,7 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int sport= , int payload_len, switch (action) { case TCP_SYN: debug_cond(DEBUG_DEV_PKT, - "TCP Hdr:SYN (%pI4, %pI4, sq=3D%d, ak=3D%d)\n", + "TCP Hdr:SYN (%pI4, %pI4, sq=3D%u, ak=3D%u)\n", &net_server_ip, &net_ip, tcp_seq_num, tcp_ack_num); tcp_activity_count =3D 0; @@ -271,41 +271,46 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int spo= rt, int payload_len, current_tcp_state =3D TCP_SYN_SENT; } break; + case TCP_SYN | TCP_ACK: case TCP_ACK: pkt_hdr_len =3D IP_HDR_SIZE + net_set_ack_options(b); b->ip.hdr.tcp_flags =3D action; debug_cond(DEBUG_DEV_PKT, - "TCP Hdr:ACK (%pI4, %pI4, s=3D%d, a=3D%d, A=3D%x)\n", + "TCP Hdr:ACK (%pI4, %pI4, s=3D%u, a=3D%u, A=3D%x)\n", &net_server_ip, &net_ip, tcp_seq_num, tcp_ack_num, action); break; case TCP_FIN: debug_cond(DEBUG_DEV_PKT, - "TCP Hdr:FIN (%pI4, %pI4, s=3D%d, a=3D%d)\n", + "TCP Hdr:FIN (%pI4, %pI4, s=3D%u, a=3D%u)\n", &net_server_ip, &net_ip, tcp_seq_num, tcp_ack_num); payload_len =3D 0; pkt_hdr_len =3D IP_TCP_HDR_SIZE; current_tcp_state =3D TCP_FIN_WAIT_1; break; - + case TCP_RST | TCP_ACK: + case TCP_RST: + debug_cond(DEBUG_DEV_PKT, + "TCP Hdr:RST (%pI4, %pI4, s=3D%u, a=3D%u)\n", + &net_server_ip, &net_ip, tcp_seq_num, tcp_ack_num); + current_tcp_state =3D TCP_CLOSED; + break; /* Notify connection closing */ - case (TCP_FIN | TCP_ACK): case (TCP_FIN | TCP_ACK | TCP_PUSH): if (current_tcp_state =3D=3D TCP_CLOSE_WAIT) current_tcp_state =3D TCP_CLOSING; =20 - tcp_ack_edge++; debug_cond(DEBUG_DEV_PKT, - "TCP Hdr:FIN ACK PSH(%pI4, %pI4, s=3D%d, a=3D%d, A=3D%x)\n", + "TCP Hdr:FIN ACK PSH(%pI4, %pI4, s=3D%u, a=3D%u, A=3D%x)\n", &net_server_ip, &net_ip, - tcp_seq_num, tcp_ack_edge, action); + tcp_seq_num, tcp_ack_num, action); fallthrough; default: pkt_hdr_len =3D IP_HDR_SIZE + net_set_ack_options(b); b->ip.hdr.tcp_flags =3D action | TCP_PUSH | TCP_ACK; debug_cond(DEBUG_DEV_PKT, - "TCP Hdr:dft (%pI4, %pI4, s=3D%d, a=3D%d, A=3D%x)\n", + "TCP Hdr:dft (%pI4, %pI4, s=3D%u, a=3D%u, A=3D%x)\n", &net_server_ip, &net_ip, tcp_seq_num, tcp_ack_num, action); } @@ -313,12 +318,12 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int spo= rt, int payload_len, pkt_len =3D pkt_hdr_len + payload_len; tcp_len =3D pkt_len - IP_HDR_SIZE; =20 + tcp_ack_edge =3D tcp_ack_num; /* TCP Header */ b->ip.hdr.tcp_ack =3D htonl(tcp_ack_edge); b->ip.hdr.tcp_src =3D htons(sport); b->ip.hdr.tcp_dst =3D htons(dport); b->ip.hdr.tcp_seq =3D htonl(tcp_seq_num); - tcp_seq_num =3D tcp_seq_num + payload_len; =20 /* * TCP window size - TCP header variable tcp_win. @@ -353,9 +358,8 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int sport= , int payload_len, * tcp_hole() - Selective Acknowledgment (Essential for fast stream transf= er) * @tcp_seq_num: TCP sequence start number * @len: the length of sequence numbers - * @tcp_seq_max: maximum of sequence numbers */ -void tcp_hole(u32 tcp_seq_num, u32 len, u32 tcp_seq_max) +void tcp_hole(u32 tcp_seq_num, u32 len) { u32 idx_sack, sack_in; u32 sack_end =3D TCP_SACK - 1; @@ -496,7 +500,7 @@ void tcp_parse_options(uchar *o, int o_len) } } =20 -static u8 tcp_state_machine(u8 tcp_flags, u32 *tcp_seq_num, int payload_le= n) +static u8 tcp_state_machine(u8 tcp_flags, u32 tcp_seq_num, int payload_len= ) { u8 tcp_fin =3D tcp_flags & TCP_FIN; u8 tcp_syn =3D tcp_flags & TCP_SYN; @@ -527,46 +531,44 @@ static u8 tcp_state_machine(u8 tcp_flags, u32 *tcp_se= q_num, int payload_len) switch (current_tcp_state) { case TCP_CLOSED: debug_cond(DEBUG_INT_STATE, "TCP CLOSED %x\n", tcp_flags); - if (tcp_ack) - action =3D TCP_DATA; - else if (tcp_syn) - action =3D TCP_RST; - else if (tcp_fin) + if (tcp_syn) { + action =3D TCP_SYN | TCP_ACK; + tcp_seq_init =3D tcp_seq_num; + tcp_ack_edge =3D tcp_seq_num + 1; + current_tcp_state =3D TCP_SYN_RECEIVED; + } else if (tcp_ack || tcp_fin) { action =3D TCP_DATA; + } break; + case TCP_SYN_RECEIVED: case TCP_SYN_SENT: - debug_cond(DEBUG_INT_STATE, "TCP_SYN_SENT %x, %d\n", - tcp_flags, *tcp_seq_num); + debug_cond(DEBUG_INT_STATE, "TCP_SYN_SENT | TCP_SYN_RECEIVED %x, %u\n", + tcp_flags, tcp_seq_num); if (tcp_fin) { action =3D action | TCP_PUSH; current_tcp_state =3D TCP_CLOSE_WAIT; - } - if (tcp_syn) { - action =3D action | TCP_ACK | TCP_PUSH; - if (tcp_ack) { - tcp_seq_init =3D *tcp_seq_num; - *tcp_seq_num =3D *tcp_seq_num + 1; - tcp_seq_max =3D *tcp_seq_num; - tcp_ack_edge =3D *tcp_seq_num; - sack_idx =3D 0; - edge_a[sack_idx].se.l =3D *tcp_seq_num; - edge_a[sack_idx].se.r =3D *tcp_seq_num; - prev_len =3D 0; - current_tcp_state =3D TCP_ESTABLISHED; - for (i =3D 0; i < TCP_SACK; i++) - edge_a[i].st =3D NOPKT; - } - } else if (tcp_ack) { + } else if (tcp_ack || (tcp_syn && tcp_ack)) { + action |=3D TCP_ACK; + tcp_seq_init =3D tcp_seq_num; + tcp_ack_edge =3D tcp_seq_num + 1; + sack_idx =3D 0; + edge_a[sack_idx].se.l =3D tcp_ack_edge; + edge_a[sack_idx].se.r =3D tcp_ack_edge; + prev_len =3D 0; + current_tcp_state =3D TCP_ESTABLISHED; + for (i =3D 0; i < TCP_SACK; i++) + edge_a[i].st =3D NOPKT; + + if (tcp_syn && tcp_ack) + action |=3D TCP_PUSH; + } else { action =3D TCP_DATA; } - break; case TCP_ESTABLISHED: debug_cond(DEBUG_INT_STATE, "TCP_ESTABLISHED %x\n", tcp_flags); - if (*tcp_seq_num > tcp_seq_max) - tcp_seq_max =3D *tcp_seq_num; if (payload_len > 0) { - tcp_hole(*tcp_seq_num, payload_len, tcp_seq_max); + tcp_hole(tcp_seq_num, payload_len); tcp_fin =3D TCP_DATA; /* cause standalone FIN */ } =20 @@ -603,15 +605,14 @@ static u8 tcp_state_machine(u8 tcp_flags, u32 *tcp_se= q_num, int payload_len) case TCP_FIN_WAIT_1: debug_cond(DEBUG_INT_STATE, "TCP_FIN_WAIT_1 (%x)\n", tcp_flags); if (tcp_fin) { + tcp_ack_edge++; action =3D TCP_ACK | TCP_FIN; current_tcp_state =3D TCP_FIN_WAIT_2; } if (tcp_syn) action =3D TCP_RST; - if (tcp_ack) { + if (tcp_ack) current_tcp_state =3D TCP_CLOSED; - tcp_seq_num =3D tcp_seq_num + 1; - } break; case TCP_CLOSING: debug_cond(DEBUG_INT_STATE, "TCP_CLOSING (%x)\n", tcp_flags); @@ -640,7 +641,6 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int = pkt_len) u16 tcp_rx_xsum =3D b->ip.hdr.ip_sum; u8 tcp_action =3D TCP_DATA; u32 tcp_seq_num, tcp_ack_num; - struct in_addr action_and_state; int tcp_hdr_len, payload_len; =20 /* Verify IP header */ @@ -685,7 +685,7 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int = pkt_len) =20 /* Packets are not ordered. Send to app as received. */ tcp_action =3D tcp_state_machine(b->ip.hdr.tcp_flags, - &tcp_seq_num, payload_len); + tcp_seq_num, payload_len); =20 tcp_activity_count++; if (tcp_activity_count > TCP_ACTIVITY) { @@ -695,18 +695,17 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned in= t pkt_len) =20 if ((tcp_action & TCP_PUSH) || payload_len > 0) { debug_cond(DEBUG_DEV_PKT, - "TCP Notify (action=3D%x, Seq=3D%d,Ack=3D%d,Pay%d)\n", + "TCP Notify (action=3D%x, Seq=3D%u,Ack=3D%u,Pay%d)\n", tcp_action, tcp_seq_num, tcp_ack_num, payload_len); =20 - action_and_state.s_addr =3D tcp_action; - (*tcp_packet_handler) ((uchar *)b + pkt_len - payload_len, - tcp_seq_num, action_and_state, - tcp_ack_num, payload_len); + (*tcp_packet_handler) ((uchar *)b + pkt_len - payload_len, b->ip.hdr.tcp= _dst, + b->ip.hdr.ip_src, b->ip.hdr.tcp_src, tcp_seq_num, + tcp_ack_num, tcp_action, payload_len); =20 } else if (tcp_action !=3D TCP_DATA) { debug_cond(DEBUG_DEV_PKT, - "TCP Action (action=3D%x,Seq=3D%d,Ack=3D%d,Pay=3D%d)\n", - tcp_action, tcp_seq_num, tcp_ack_num, payload_len); + "TCP Action (action=3D%x,Seq=3D%u,Ack=3D%u,Pay=3D%d)\n", + tcp_action, tcp_ack_num, tcp_ack_edge, payload_len); =20 /* * Warning: Incoming Ack & Seq sequence numbers are transposed @@ -715,6 +714,6 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int = pkt_len) net_send_tcp_packet(0, ntohs(b->ip.hdr.tcp_src), ntohs(b->ip.hdr.tcp_dst), (tcp_action & (~TCP_PUSH)), - tcp_seq_num, tcp_ack_num); + tcp_ack_num, tcp_ack_edge); } } diff --git a/net/wget.c b/net/wget.c index eebdf80eb5..2dbfeb1a1d 100644 --- a/net/wget.c +++ b/net/wget.c @@ -88,8 +88,8 @@ static void wget_send_stored(void) { u8 action =3D retry_action; int len =3D retry_len; - unsigned int tcp_ack_num =3D retry_tcp_ack_num + len; - unsigned int tcp_seq_num =3D retry_tcp_seq_num; + unsigned int tcp_ack_num =3D retry_tcp_seq_num + (len =3D=3D 0 ? 1 : len)= ; + unsigned int tcp_seq_num =3D retry_tcp_ack_num; uchar *ptr, *offset; =20 switch (current_wget_state) { @@ -130,8 +130,8 @@ static void wget_send_stored(void) } } =20 -static void wget_send(u8 action, unsigned int tcp_ack_num, - unsigned int tcp_seq_num, int len) +static void wget_send(u8 action, unsigned int tcp_seq_num, + unsigned int tcp_ack_num, int len) { retry_action =3D action; retry_tcp_ack_num =3D tcp_ack_num; @@ -178,10 +178,8 @@ static void wget_timeout_handler(void) #define PKT_QUEUE_PACKET_SIZE 0x800 =20 static void wget_connected(uchar *pkt, unsigned int tcp_seq_num, - struct in_addr action_and_state, - unsigned int tcp_ack_num, unsigned int len) + u8 action, unsigned int tcp_ack_num, unsigned int len) { - u8 action =3D action_and_state.s_addr; uchar *pkt_in_q; char *pos; int hlen, i; @@ -268,22 +266,25 @@ static void wget_connected(uchar *pkt, unsigned int t= cp_seq_num, } =20 /** - * wget_handler() - handler of wget - * @pkt: the pointer to the payload - * @tcp_seq_num: tcp sequence number - * @action_and_state: TCP state - * @tcp_ack_num: tcp acknowledge number - * @len: length of the payload + * wget_handler() - TCP handler of wget + * @pkt: pointer to the application packet + * @dport: destination TCP port + * @sip: source IP address + * @sport: source TCP port + * @tcp_seq_num: TCP sequential number + * @tcp_ack_num: TCP acknowledgment number + * @action: TCP action (SYN, ACK, FIN, etc) + * @len: packet length * * In the "application push" invocation, the TCP header with all * its information is pointed to by the packet pointer. */ -static void wget_handler(uchar *pkt, unsigned int tcp_seq_num, - struct in_addr action_and_state, - unsigned int tcp_ack_num, unsigned int len) +static void wget_handler(uchar *pkt, u16 dport, + struct in_addr sip, u16 sport, + u32 tcp_seq_num, u32 tcp_ack_num, + u8 action, unsigned int len) { enum tcp_state wget_tcp_state =3D tcp_get_tcp_state(); - u8 action =3D action_and_state.s_addr; =20 net_set_timeout_handler(wget_timeout, wget_timeout_handler); packets++; @@ -294,7 +295,7 @@ static void wget_handler(uchar *pkt, unsigned int tcp_s= eq_num, break; case WGET_CONNECTING: debug_cond(DEBUG_WGET, - "wget: Connecting In len=3D%x, Seq=3D%x, Ack=3D%x\n", + "wget: Connecting In len=3D%x, Seq=3D%u, Ack=3D%u\n", len, tcp_seq_num, tcp_ack_num); if (!len) { if (wget_tcp_state =3D=3D TCP_ESTABLISHED) { @@ -310,14 +311,13 @@ static void wget_handler(uchar *pkt, unsigned int tcp= _seq_num, } break; case WGET_CONNECTED: - debug_cond(DEBUG_WGET, "wget: Connected seq=3D%x, len=3D%x\n", + debug_cond(DEBUG_WGET, "wget: Connected seq=3D%u, len=3D%x\n", tcp_seq_num, len); if (!len) { wget_fail("Image not found, no data returned\n", tcp_seq_num, tcp_ack_num, action); } else { - wget_connected(pkt, tcp_seq_num, action_and_state, - tcp_ack_num, len); + wget_connected(pkt, tcp_seq_num, action, tcp_ack_num, len); } break; case WGET_TRANSFERRING: @@ -338,6 +338,7 @@ static void wget_handler(uchar *pkt, unsigned int tcp_s= eq_num, wget_send(TCP_ACK, tcp_seq_num, tcp_ack_num, len); fallthrough; case TCP_SYN_SENT: + case TCP_SYN_RECEIVED: case TCP_CLOSING: case TCP_FIN_WAIT_1: case TCP_CLOSED: --=20 2.40.0.348.gf938b09366-goog