diff options
author | Anton Kling <anton@kling.gg> | 2024-02-21 00:14:29 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-21 00:14:29 +0100 |
commit | 8ff63b062d724826d8017504063df9b92f8e6703 (patch) | |
tree | 03bf0b5a278a4908da8912f956e5651bea9412f1 /kernel/network/tcp.c | |
parent | a85eacdd2406fede4d6ff5cb130b1758978cabb3 (diff) |
New clang-format options
Diffstat (limited to 'kernel/network/tcp.c')
-rw-r--r-- | kernel/network/tcp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/network/tcp.c b/kernel/network/tcp.c index a3ba7cd..f45d1af 100644 --- a/kernel/network/tcp.c +++ b/kernel/network/tcp.c @@ -55,8 +55,9 @@ u16 tcp_checksum(u16 *buffer, int size) { cksum += *buffer++; size -= sizeof(u16); } - if (size) + if (size) { cksum += *(u8 *)buffer; + } cksum = (cksum >> 16) + (cksum & 0xffff); cksum += (cksum >> 16); @@ -179,8 +180,9 @@ void handle_tcp(u8 src_ip[4], const u8 *payload, u32 payload_length) { if (SYN == flags) { struct INCOMING_TCP_CONNECTION *inc; - if (!(inc = handle_incoming_tcp_connection(src_ip, n_src_port, dst_port))) + if (!(inc = handle_incoming_tcp_connection(src_ip, n_src_port, dst_port))) { return; + } memcpy(inc->ip, src_ip, sizeof(u8[4])); inc->seq_num = 0; inc->ack_num = seq_num + 1; @@ -192,8 +194,9 @@ void handle_tcp(u8 src_ip[4], const u8 *payload, u32 payload_length) { } struct INCOMING_TCP_CONNECTION *inc = get_incoming_tcp_connection(src_ip, n_src_port); - if (!inc) + if (!inc) { return; + } if (flags == (FIN | ACK)) { if (inc->requesting_connection_close) { send_empty_tcp_message(inc, ACK, seq_num, n_dst_port, n_src_port); |