Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Released gor1.3 forwards the same request twice on Linux #989

Closed
anatoly71 opened this issue Aug 10, 2021 · 2 comments · Fixed by #992
Closed

Released gor1.3 forwards the same request twice on Linux #989

anatoly71 opened this issue Aug 10, 2021 · 2 comments · Fixed by #992

Comments

@anatoly71
Copy link

Hello, I am using macbook, gor1.3.

I deploy two docker containers (linux) exposing an http endpoint each.
They are started with docker-compose so that they can communicate with each other being on the same docker network.

"mock1" linux container:

  • http endpont with port 9003
  • gor1.3 started with command ./gor1.3 -verbose 3 -input-raw :9003 -output-http http://mock2:9004

"mock2" linux container:

  • http endpont with port 9004

I execute tcpdump on the both containers to see requests.

Scenario:: mac host -> linux mock1 (goreplay) -> linux mock2.
I send a request to linux container mock1 (goreplay here) using mapped port 9093, and I expect the request forwarded to linux container mock2. The actual outcome TWO requests forwarded.

on my workstation I execute
curl -v "http://localhost:9093/some/path" -H "accept: application/json"

mock1
tcpdump records ONE incoming request but goreplay reports TWO incoming requests

bash-4.3#tcpdump -Avvs0 -i eth0 'dst port 9003 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:36:00.901910 IP (tos 0x0, ttl 64, id 61123, offset 0, flags [DF], proto TCP (6), length 156)
172.24.0.1.57306 > 20b83084ad91.9003: Flags [P.], cksum 0x58c2 (incorrect -> 0x4cac), seq 1525591779:1525591883, ack 70000080, win 502, options [nop,nop,TS val 1146716091 ecr 3110618404], length 104
E.....@.@..d..........#+Z....,......X......
DY...hE$GET /some/path HTTP/1.1
Host: localhost:9093
User-Agent: curl/7.64.1
accept: application/json

goreplay reports TWO incoming requests (same meta data in the debug output)

bash-4.3# ./gor1.3 -verbose 3 -input-raw :9003 -output-http http://mock2:9004
[DEBUG][elapsed 91.0109ms]: Intercepting traffic from: :[9003]
2021/08/10 11:35:27 [PPID 42 and PID 122] Version:1.3.0
[DEBUG][elapsed 34.7126803s]: [EMITTER] input: 1 dfda232bac180001042c1dd0 1628595360901910500 0 from: Intercepting traffic from: :[9003]
[DEBUG][elapsed 1.6367ms]: [EMITTER] input: 1 dfda232bac180001042c1dd0 1628595360901910500 0 from: Intercepting traffic from: :[9003]

mock2
TWO requests received

bash-4.3# tcpdump -Avvs0 -i eth0 'dst port 9004 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:36:02.527683 IP (tos 0x0, ttl 64, id 50761, offset 0, flags [DF], proto TCP (6), length 175)
scripts_mock1_1.scripts_default.41406 > b9561d25d337.9004: Flags [P.], cksum 0x58d7 (incorrect -> 0x8750), seq 4181280619:4181280742, ack 3794026077, win 502, options [nop,nop,TS val 724414948 ecr 703821815], length 123
E....I@.@.............#,.9Gk.$>]....X......
+-..).w.GET /ftaas/v1/info HTTP/1.1
Host: mock2:9004
User-Agent: curl/7.64.1
Accept: application/json
Accept-Encoding: gzip

11:36:02.530773 IP (tos 0x0, ttl 64, id 46863, offset 0, flags [DF], proto TCP (6), length 175)
scripts_mock1_1.scripts_default.41408 > b9561d25d337.9004: Flags [P.], cksum 0x58d7 (incorrect -> 0x3dc0), seq 1256581563:1256581686, ack 2418861540, win 502, options [nop,nop,TS val 724414951 ecr 703821815], length 123
E.....@.@.+...........#,J....,......X......
+-..).w.GET /ftaas/v1/info HTTP/1.1
Host: mock2:9004
User-Agent: curl/7.64.1
Accept: application/json
Accept-Encoding: gzip

@anatoly71 anatoly71 changed the title Released gor1.3 forwards the same requests twice on Linux Released gor1.3 forwards the same request twice on Linux Aug 11, 2021
buger added a commit that referenced this issue Aug 12, 2021
Issue was introduced while fixing windows c9274ac

Added exception for Windows, which by default allows interfaces without IPs.
Interface name check moved higher, so if interface namee or IP match, rest of check will be ignored.

Additionally windows npcap loopback mechanism can now be picked by specifying 127.0.0.1 or loopback IP.

Fix #989
buger added a commit that referenced this issue Aug 12, 2021
Issue was introduced while fixing windows c9274ac

Added exception for Windows, which by default allows interfaces without IPs.
Interface name check moved higher, so if interface namee or IP match, rest of check will be ignored.

Additionally windows npcap loopback mechanism can now be picked by specifying 127.0.0.1 or loopback IP.

Fix #989
@buger
Copy link
Owner

buger commented Aug 12, 2021

Should be fixed now and released as 1.3.1!

@anatoly71
Copy link
Author

I've tested 1.3.1 on Linux and the issue is fixed. Thanks a lot!

xingren23 referenced this issue in xingren23/goreplay Sep 4, 2021
Issue was introduced while fixing windows buger/goreplay@c9274ac

Added exception for Windows, which by default allows interfaces without IPs.
Interface name check moved higher, so if interface namee or IP match, rest of check will be ignored.

Additionally windows npcap loopback mechanism can now be picked by specifying 127.0.0.1 or loopback IP.

Fix #989
xingren23 referenced this issue in xingren23/goreplay Sep 4, 2021
Issue was introduced while fixing windows buger/goreplay@c9274ac

Added exception for Windows, which by default allows interfaces without IPs.
Interface name check moved higher, so if interface namee or IP match, rest of check will be ignored.

Additionally windows npcap loopback mechanism can now be picked by specifying 127.0.0.1 or loopback IP.

Fix #989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants