Bug 40 - Outbound UDP packets sometimes incorrectly sent on loopback interface
Summary: Outbound UDP packets sometimes incorrectly sent on loopback interface
Status: RESOLVED INVALID
Alias: None
Product: passt
Classification: Unclassified
Component: UDP (show other bugs)
Version: unspecified
Hardware: All Linux
: Normal normal
Assignee: nobody
URL:
Depends on:
Blocks:
 
Reported: 2022-12-01 02:09 UTC by David Gibson
Modified: 2023-01-24 03:43 UTC (History)
0 users

See Also:


Attachments

Description David Gibson 2022-12-01 02:09:00 UTC
# Steps to reproduce

Assume $HOST is the host IP address and $GW is the gateway address:

1. On host, run:
      $ socat -u UDP4-LISTEN:2000,bind=$HOST STDOUT
2. On host, run:
      $ tcpdump -i lo
3. On host, run:
      $ pasta --config-net
4. Within pasta shell run:
      # echo hello | socat -u STDIN UDP4:$GW:2000

# Expected results

"hello" appears on socat from step (1).  tcpdump at (2) shows no packets related to this operation.

# Actual results

No output on the host listening socat, UDP packet with "hello" appears on the host loopback interface.
Comment 1 David Gibson 2022-12-01 02:10:29 UTC
It looks like this is because the sockets created for forwarding the output packets are bound to UNSPEC, meaning that when delivering to the host via gateway translation they use loopback.
Comment 2 David Gibson 2023-01-24 03:43:55 UTC
I based this on a misunderstanding of how the $GW translation is supposed to work.

After discussing with Stefano the meaning of GW translation, the consensus was that $GW in the guest/ns represents the host's loopback address as seen from the host.

There are still some weird edge cases with $GW translation, but this specific example is working as intended.

Note You need to log in before you can comment on or make changes to this bug.