LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-01-2019, 04:01 PM   #1
makarandp
LQ Newbie
 
Registered: May 2019
Posts: 2

Rep: Reputation: Disabled
TCP three way handshake question for SW bridge


Hello All,

I'm new to Linux questions and this is my first post. So pl forgive any mistakes on my part.

I'm trying to create a sw bridge using packet sockets. My set up is follows:

Machine 1
10.10.6.4/24
eth0
|
eth0 Sw bridge veth0 net1_veth0
10.10.6.1/24 10.10.6.3/24
name space: net1
Machine 2

I have coded the SW bridge using 2 threads. The SW bridge simply reads the entire L2 packet from eth0 and writes it to veth0. Similarly in the other direction.

With this setup, I can ping from 10.10.6.4 to 10.10.6.3. All the same a TCP connection fails to establish between 10.10.6.4 and 10.10.6.3.

The reason being that the three way handshake does not complete.

The server is running on 10.10.6.3.
The client is running on 10.10.6.4.

I can see the following:
10.10.6.3 receives SYM.
10.10.6.3 sends back SYN-ACK.
10.10.6.4 receives SYN-ACK.
But it does not send ACK back to 10.10.6.3.
10.10.6.4 retransmits SYN.
10.10.6.3 retransmits SYN-ACK.
The process repeats.

The tcpdump is given below.

16:50:31.086022 IP (tos 0x10, ttl 64, id 38054, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.4.38218 > 10.10.6.3.2222: Flags [S], cksum 0x2049 (incorrect -> 0x1759), seq 3623274701, win 29200, options [mss 1460,sackOK,TS val 55860331 ecr 0,nop,wscale 7], length 0
0x0000: b2b6 ea50 8c51 0800 27d8 7816 0800 4510 ...P.Q..'.x...E.
0x0010: 003c 94a6 4000 4006 85eb 0a0a 0604 0a0a .<..@.@.........
0x0020: 0603 954a 08ae d7f6 c8cd 0000 0000 a002 ...J............
0x0030: 7210 2049 0000 0204 05b4 0402 080a 0354 r..I...........T
0x0040: 5c6b 0000 0000 0103 0307 \k........
16:50:31.087097 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.3.2222 > 10.10.6.4.38218: Flags [S.], cksum 0x2049 (incorrect -> 0xead6), seq 2020233119, ack 3623274702, win 28960, options [mss 1460,sackOK,TS val 3991566188 ecr 55860331,nop,wscale 7], length 0
0x0000: 0800 27d8 7816 b2b6 ea50 8c51 0800 4500 ..'.x....P.Q..E.
0x0010: 003c 0000 4000 4006 1aa2 0a0a 0603 0a0a .<..@.@.........
0x0020: 0604 08ae 954a 786a 4f9f d7f6 c8ce a012 .....JxjO.......
0x0030: 7120 2049 0000 0204 05b4 0402 080a edea q..I............
0x0040: 776c 0354 5c6b 0103 0307 wl.T\k....
16:50:32.091903 IP (tos 0x10, ttl 64, id 38055, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.4.38218 > 10.10.6.3.2222: Flags [S], cksum 0x2049 (incorrect -> 0x165d), seq 3623274701, win 29200, options [mss 1460,sackOK,TS val 55860583 ecr 0,nop,wscale 7], length 0
0x0000: b2b6 ea50 8c51 0800 27d8 7816 0800 4510 ...P.Q..'.x...E.
0x0010: 003c 94a7 4000 4006 85ea 0a0a 0604 0a0a .<..@.@.........
0x0020: 0603 954a 08ae d7f6 c8cd 0000 0000 a002 ...J............
0x0030: 7210 2049 0000 0204 05b4 0402 080a 0354 r..I...........T
0x0040: 5d67 0000 0000 0103 0307 ]g........
16:50:32.091998 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.3.2222 > 10.10.6.4.38218: Flags [S.], cksum 0x2049 (incorrect -> 0xe6ea), seq 2020233119, ack 3623274702, win 28960, options [mss 1460,sackOK,TS val 3991567192 ecr 55860331,nop,wscale 7], length 0
0x0000: 0800 27d8 7816 b2b6 ea50 8c51 0800 4500 ..'.x....P.Q..E.
0x0010: 003c 0000 4000 4006 1aa2 0a0a 0603 0a0a .<..@.@.........
0x0020: 0604 08ae 954a 786a 4f9f d7f6 c8ce a012 .....JxjO.......
0x0030: 7120 2049 0000 0204 05b4 0402 080a edea q..I............
0x0040: 7b58 0354 5c6b 0103 0307 {X.T\k....
16:50:32.093204 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.3.2222 > 10.10.6.4.38218: Flags [S.], cksum 0x2049 (incorrect -> 0xe6e8), seq 2020233119, ack 3623274702, win 28960, options [mss 1460,sackOK,TS val 3991567194 ecr 55860331,nop,wscale 7], length 0
0x0000: 0800 27d8 7816 b2b6 ea50 8c51 0800 4500 ..'.x....P.Q..E.
0x0010: 003c 0000 4000 4006 1aa2 0a0a 0603 0a0a .<..@.@.........
0x0020: 0604 08ae 954a 786a 4f9f d7f6 c8ce a012 .....JxjO.......
0x0030: 7120 2049 0000 0204 05b4 0402 080a edea q..I............
0x0040: 7b5a 0354 5c6b 0103 0307 {Z.T\k....
16:50:34.096430 IP (tos 0x10, ttl 64, id 38056, offset 0, flags [DF], proto TCP (6), length 60)
10.10.6.4.38218 > 10.10.6.3.2222: Flags [S], cksum 0x2049 (incorrect -> 0x1468), seq 3623274701, win 29200, options [mss 1460,sackOK,TS val 55861084 ecr 0,nop,wscale 7], length 0
0x0000: b2b6 ea50 8c51 0800 27d8 7816 0800 4510 ...P.Q..'.x...E.
0x0010: 003c 94a8 4000 4006 85e9 0a0a 0604 0a0a .<..@.@.........
0x0020: 0603 954a 08ae d7f6 c8cd 0000 0000 a002 ...J............
0x0030: 7210 2049 0000 0204 05b4 0402 080a 0354 r..I...........T
0x0040: 5f5c 0000 0000 0103 0307 _\........

Any pointers on what the problem may be would be highly appreciated.

Thanks and Rgds,
Makarand.
 
Old 05-02-2019, 09:40 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
The SYN-ACK packet looks ok, but 10.10.6.4 resends SYN with the same sequence number, so it either did not receive the SYN-ACK packet or did not accept it. Run tcpdump/wireshark on the 10.10.6.4 system and see if there is something different in what's reported.
 
Old 05-02-2019, 12:24 PM   #3
makarandp
LQ Newbie
 
Registered: May 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hello Smallpond,

Thanks for your note.

I have managed to root cause the issue. The problem was with checksum calculation virtual ethernet interface. I had to turn off checksum offloading on the virtual ethernet interface to get the checksum correct.

ip netns exec net1 ethtool --offload net1_veth0 tx off

resolved the issue.

Marking the thread as closed.

With Rgds,
Makarand.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP Handshake C Linux with Raw Sockets Graim Linux - Networking 2 02-01-2018 08:29 PM
iptables question: default DROP policy and TCP Three Way Handshake johnnygear Linux - Networking 5 04-22-2012 08:38 PM
TCP handshake fails, SYN/ACK ignored by system. xnomad Linux - Networking 1 09-28-2011 11:10 AM
Three way handshake fails rawdata Linux - Server 11 10-12-2008 03:54 PM
is it possible to ignore TCP three way handshake? Thinking Programming 7 12-02-2005 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration