Bug 2785 - TapBridge::ReceiveFromBridgedDevice(): Write error on Linux >= 4.4
TapBridge::ReceiveFromBridgedDevice(): Write error on Linux >= 4.4
Status: NEEDINFO
Product: ns-3
Classification: Unclassified
Component: tap-bridge
ns-3-dev
All All
: P3 normal
Assigned To: Tom Goff
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-25 19:10 EDT by Piotr Jurkiewicz
Modified: 2017-10-03 19:46 EDT (History)
2 users (show)

See Also:


Attachments
tap-bridge: Ignore EIO on write (898 bytes, text/plain)
2017-09-25 19:10 EDT, Piotr Jurkiewicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Jurkiewicz 2017-09-25 19:10:49 EDT
Created attachment 2925 [details]
tap-bridge: Ignore EIO on write

Since Linux upstream commit 1bd4978a88ac("tun: honor IFF_UP in tun_get_user()"), included in 4.4, writing to a tap device that is not up sets errno to EIO.

Before 4.4 it did no result in error, packets written to an uninitialized tap device were silently dropped.

https://github.com/torvalds/linux/commit/1bd4978a88ac

Due to this change, ns-3 with TapBridge randomly crashes on startup when it tries to write to a device which is not yet UP with the following error:

aborted. cond="bytesWritten != p->GetSize ()", msg="TapBridge::ReceiveFromBridgedDevice(): Write error.", file=../src/tap-bridge/model/tap-bridge.cc, line=994

Similar problem: https://mail.openvswitch.org/pipermail/ovs-dev/2016-June/316261.html

The attached patch fixes the problem by ignoring EIO on write to tap interface. It also adds initialization for previously uninitialized m_linkUp variable.
Comment 1 Tom Henderson 2017-10-03 19:46:17 EDT
Piotr, should we be ignoring the error (is it masking a real failure to use the device)?