I'm implementing a Tun Driver that allows to change packets before they
are sent out to the net.

The applications thinks it is communicating within a private subnet,
let's say 172.16.1.0.

Outgoing packets work just fine, but incoming packets are not passed to
the application (see wireshark capture)

does anybody see what the problem could be?
It seems that the application does not receive the SYN,ACK packet
although it is received on the Interface!?
The packets received on tun0 look fine, don't they?



No. Time Source Destination Protocol
Info
1 0.000000 172.16.1.1 172.16.1.20 TCP
37354 > 17000 [SYN] Seq=0 Len=0 MSS=1460 TSV=1175120 TSER=0 WS=5

Frame 1 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.1 (172.16.1.1), Dst: 172.16.1.20
(172.16.1.20)
Transmission Control Protocol, Src Port: 37354 (37354), Dst Port: 17000
(17000), Seq: 0, Len: 0

No. Time Source Destination Protocol
Info
2 0.014512 172.16.1.20 172.16.1.1 TCP
17000 > 37354 [SYN, ACK] Seq=0 Ack=1 Win=741376 Len=0 MSS=1460
TSV=686579 TSER=1175120 WS=7

Frame 2 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.20 (172.16.1.20), Dst: 172.16.1.1
(172.16.1.1)
Transmission Control Protocol, Src Port: 17000 (17000), Dst Port: 37354
(37354), Seq: 0, Ack: 1, Len: 0

No. Time Source Destination Protocol
Info
3 2.999038 172.16.1.1 172.16.1.20 TCP
37354 > 17000 [SYN] Seq=0 Len=0 MSS=1460 TSV=1175870 TSER=0 WS=5

Frame 3 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.1 (172.16.1.1), Dst: 172.16.1.20
(172.16.1.20)
Transmission Control Protocol, Src Port: 37354 (37354), Dst Port: 17000
(17000), Seq: 0, Len: 0

No. Time Source Destination Protocol
Info
4 3.014900 172.16.1.20 172.16.1.1 TCP
[TCP Previous segment lost] 17000 > 37354 [SYN, ACK] Seq=2999928
Ack=1 Win=741376 Len=0 MSS=1460 TSV=687329 TSER=1175870 WS=7

Frame 4 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.20 (172.16.1.20), Dst: 172.16.1.1
(172.16.1.1)
Transmission Control Protocol, Src Port: 17000 (17000), Dst Port: 37354
(37354), Seq: 2999928, Ack: 1, Len: 0

No. Time Source Destination Protocol Info
1 0.000000 172.16.1.1 172.16.1.20 TCP 37354 > 17000 [SYN] Seq=0 Len=0 MSS=1460 TSV=1175120 TSER=0 WS=5

Frame 1 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.1 (172.16.1.1), Dst: 172.16.1.20 (172.16.1.20)
Transmission Control Protocol, Src Port: 37354 (37354), Dst Port: 17000 (17000), Seq: 0, Len: 0

No. Time Source Destination Protocol Info
2 0.014512 172.16.1.20 172.16.1.1 TCP 17000 > 37354 [SYN, ACK] Seq=0 Ack=1 Win=741376 Len=0 MSS=1460 TSV=686579 TSER=1175120 WS=7

Frame 2 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.20 (172.16.1.20), Dst: 172.16.1.1 (172.16.1.1)
Transmission Control Protocol, Src Port: 17000 (17000), Dst Port: 37354 (37354), Seq: 0, Ack: 1, Len: 0

No. Time Source Destination Protocol Info
3 2.999038 172.16.1.1 172.16.1.20 TCP 37354 > 17000 [SYN] Seq=0 Len=0 MSS=1460 TSV=1175870 TSER=0 WS=5

Frame 3 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.1 (172.16.1.1), Dst: 172.16.1.20 (172.16.1.20)
Transmission Control Protocol, Src Port: 37354 (37354), Dst Port: 17000 (17000), Seq: 0, Len: 0

No. Time Source Destination Protocol Info
4 3.014900 172.16.1.20 172.16.1.1 TCP [TCP Previous segment lost] 17000 > 37354 [SYN, ACK] Seq=2999928 Ack=1 Win=741376 Len=0 MSS=1460 TSV=687329 TSER=1175870 WS=7

Frame 4 (76 bytes on wire, 76 bytes captured)
Linux cooked capture
Internet Protocol, Src: 172.16.1.20 (172.16.1.20), Dst: 172.16.1.1 (172.16.1.1)
Transmission Control Protocol, Src Port: 17000 (17000), Dst Port: 37354 (37354), Seq: 2999928, Ack: 1, Len: 0