Skip to content

Instantly share code, notes, and snippets.

@pfalcon
Created October 17, 2016 23:19
Show Gist options
  • Save pfalcon/d27fafcf703d21a7fa39752f865049dc to your computer and use it in GitHub Desktop.
Save pfalcon/d27fafcf703d21a7fa39752f865049dc to your computer and use it in GitHub Desktop.
diff --git a/include/net/yaip/net_ip.h b/include/net/yaip/net_ip.h
index e131d0b..bc98888 100644
--- a/include/net/yaip/net_ip.h
+++ b/include/net/yaip/net_ip.h
@@ -265,7 +265,10 @@ struct net_udp_hdr {
struct net_tcp_hdr {
uint16_t src_port;
uint16_t dst_port;
+ union {
uint8_t seq[4];
+ uint32_t seq32;
+ };
uint8_t ack[4];
uint8_t offset;
uint8_t flags;
diff --git a/net/yaip/net_context.c b/net/yaip/net_context.c
index b710726..549d5a3 100644
--- a/net/yaip/net_context.c
+++ b/net/yaip/net_context.c
@@ -897,6 +897,7 @@ static enum net_verdict tcp_syn_rcvd(struct net_conn *conn,
struct sockaddr peer, *remote;
net_tcp_print_recv_info("SYN", buf, NET_TCP_BUF(buf)->src_port);
+ tcp->send_ack = sys_be32_to_cpu(NET_TCP_BUF(buf)->seq32) + 1;
net_tcp_change_state(tcp, NET_TCP_SYN_RCVD);
diff --git a/net/yaip/tcp.c b/net/yaip/tcp.c
index 335f91b..a32df61 100644
--- a/net/yaip/tcp.c
+++ b/net/yaip/tcp.c
@@ -237,6 +237,8 @@ static struct net_buf *prepare_segment(struct net_tcp *tcp,
tcphdr->flags = segment->flags;
tcphdr->wnd[0] = segment->wnd >> 8;
tcphdr->wnd[1] = segment->wnd;
+ tcphdr->urg[0] = 0;
+ tcphdr->urg[1] = 0;
if (segment->data) {
net_buf_frag_add(header, segment->data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment