Commit Graph

8 Commits

Author SHA1 Message Date
Dario Nieuwenhuis 273f4d60b6 Fix MTU of RawSocket and TapInterface.
Linux's MTU is the IP MTU, while smoltcp's is the Ethernet MTU.
Therefore we have to add the ethernet header size to it.
2020-12-25 23:57:54 +01:00
whitequark 996389d653 Compute soft deadline in poll() and use nonblocking sockets.
Before this commit, anything that touched RawSocket or TapInterface
worked partly by accident and partly because of a horrible crutch
that resulted in massive latencies as well as inevitable packet loss
every time an ARP request had to be issued. Also, there was no way
to use poll() other than by continuously calling it in a busy loop.

After this commit, poll() indicates when the earliest timer expires,
and so the caller can sleep until that moment (or until packets
arrive).

Note that there is a subtle problem remaining: every time poll()
is called, every socket with a pending outbound packet whose
IP address doesn't correspond to a MAC address will send a new
ARP request, resulting in potentially a whole lot of such requests.
ARP rate limiting is a separate topic though.
2017-08-29 19:47:11 +00:00
whitequark ae7e956573 Add a missing \0 in a C string. 2017-08-24 12:18:07 +00:00
whitequark 15085bd8ba Fix a file descriptor leak in TapInterfaceDesc::interface_mtu. 2017-08-21 07:28:32 +00:00
David Coffill 55ac6737b2 Fix build on i686 by using libc::suseseconds_t instead of i64 2017-08-02 07:12:36 +00:00
whitequark 051169a49d Determine MTU in TapInterface instead of hardcoding 1536. 2017-07-23 04:40:35 +00:00
whitequark cc67e1f753 Don't block forever in TapInterface.
Ideally Devices should be non-blocking, but that would be really
annoying to implement, so for now, to get the examples working,
I'm using this hack.
2017-03-05 05:30:03 +00:00
whitequark e7d6237279 Implement TAP interface support. 2016-12-11 00:30:40 +00:00