IPv6 with TapBridge error

171 views
Skip to first unread message

mle

unread,
Jan 15, 2020, 11:25:22 PM1/15/20
to ns-3-users
Hello,

I'm currently trying to run a simple IPv6 example using tap devices (on ns-3 version 3.29). I modified the "examples/ipv6/ping6.cc" and added a TapBridge, but I'm not able to get it working. I've attached the script to this message.

It seems like the tap device in configure local mode does not support ipv6, is this correct? 

I'm using "UseLocal" mode now, as "ConfigureLocal" didn't work at all. Before running my ns-3 script, I create a tap interface on the host with the following commands:

ip tuntap add dev tap-container1 mode tap
ip -6 addr add fe80::200:ff:fe00:8/64 dev tap-container1
ifconfig tap-container1 promisc
ip link set tap-container1 up

After executing these steps, "ip a" shows the following configuration for my tap interface:
326: tap-container1: <NO-CARRIER,BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether d2:3c:98:e8:85:d9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::200:ff:fe00:8/64 scope link tentative 
       valid_lft forever preferred_lft forever

However, when I start ns-3, another ipv6 address is assigned to my tap interface. The configuration, after starting ns-3, is the following:
325: tap-container1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 0a:cc:a3:53:b5:bb brd ff:ff:ff:ff:ff:ff
    inet6 fe80::8cc:a3ff:fe53:b5bb/64 scope link tentative 
       valid_lft forever preferred_lft forever
    inet6 fe80::200:ff:fe00:8/64 scope link 
       valid_lft forever preferred_lft forever


There are two things I don't understand:
  1. It seems like ns-3 assigns another ipv6 address to my tap interface, but why?
  2. After removing this ipv6 address, I can ping another device in the ns-3 network (e.g. ping -6 -I tap-container1 fe80::200:ff:fe00:2). However, after 5 successful pings, ns-3 crashes with the following error message:
assert failed. cond="m_current >= m_dataStart && m_current < m_dataEnd", msg="You have attempted to read beyond the bounds of the available buffer space. This usually indicates that a Header::Deserialize or Trailer::Deserialize method is trying to read data which was not written by a Header::Serialize or Trailer::Serialize method. In short: check the code of your Serialize and Deserialize methods.", file=./ns3/buffer.h, line=1000
terminate called without an active exception

I tried different setups with different configurations, but I just don't get it working... Actually, my goal is to use tap devices in a 6LoWPAN network, but this didn't work as well so I thought I'll start with a simpler setup. Any help is appreciated!
tap-ipv6.cc

mle

unread,
Jan 16, 2020, 2:57:10 PM1/16/20
to ns-3-users
I further investigated the issue and tried different topologies, configurations etc., but when I use IPv6, ns-3 always crashes after 5 successful pings with the error message shown in my original post. Is this a ns-3 bug or are tap devices not intended to be used with IPv6? I found an old ticket from 2011 which mentions IPv6 support for tap-bridges with status NEW (https://www.nsnam.org/bugzilla/show_bug.cgi?id=1433).

Tom Henderson

unread,
Jan 16, 2020, 3:03:27 PM1/16/20
to ns-3-...@googlegroups.com, mle
On 1/16/20 11:57 AM, mle wrote:
> I further investigated the issue and tried different topologies,
> configurations etc., but when I use IPv6, ns-3 always crashes after 5
> successful pings with the error message shown in my original post. Is
> this a ns-3 bug or are tap devices not intended to be used with IPv6? I
> found an old ticket from 2011 which mentions IPv6 support for
> tap-bridges with status NEW
> (https://www.nsnam.org/bugzilla/show_bug.cgi?id=1433).
>

I'm guessing that no one has ever worked on a patch for that issue.
Please let us know what you find out or if you generate a patch in
trying to get it to work with IPv6.

- Tom

mle

unread,
Jan 16, 2020, 10:29:29 PM1/16/20
to ns-3-users
As soon as I use two tap interfaces, I'm able to ping each other. I tried a simple CSMA setup, which directly connects two tap devices in "UseLocal" mode. I then moved both tap interfaces into a separate network namespace, set the IPv6 address manually, and was able to ping both (also, running a simple python web server worked as well). 

When one of the nodes is a tap device, and the other one e.g. a CsmaNetDevice, ns-3 exits with
assert failed. cond="m_current >= m_dataStart && m_current < m_dataEnd", msg="You have attempted to read beyond the bounds of the available buffer space. This usually indicates that a Header::Deserialize or Trailer::Deserialize method is trying to read data which was not written by a Header::Serialize or Trailer::Serialize method. In short: check the code of your Serialize and Deserialize methods.", file=./ns3/buffer.h, line=1000
terminate called without an active exception

I've attached this example.

I'm still new to ns-3, but after a while, I found the EnableChecking method in the packet class and added it to my code (below enabling the checksum)
Packet::EnableChecking ();

This causes ns-3 to exit immediately with 
msg="Removing unexpected header.", file=../src/network/model/packet-metadata.cc, line=701
terminate called without an active exception

However, what I'm really trying to achieve is to connect two tap devices via 6LoWPAN. As connecting two tap devices with IPv6 worked (at least more or less), I tried connecting two tap devices with 6LoWPAN & lr-wpan directly. This does not work and fails with
msg="TapBridge::SetBridgedDevice: Device does not support eui 48 addresses: cannot be added to bridge.", file=../src/tap-bridge/model/tap-bridge.cc, line=899
terminate called without an active exception

Therefore, I tried to connect each tap device to an ns-3 node via CSMA, and connect these ns-3 nodes with 6LoWPAN and lr-wpan, like
tap1 --csma-- n1 ---6LoWPAN & lr wpan--- n2 --csma-- tap2

This setup is also attached ("tap-ipv6-lrwpan-sixlowpan_failing.cc"). Again, I moved both tap interfaces into different network namespaces and configured them. Now, ns-3 terminates after sending the first ping message without getting a successful response, showing the same error message which appears when I try to ping a node in ns-3, namely
assert failed. cond="m_current >= m_dataStart && m_current < m_dataEnd", msg="You have attempted to read beyond the bounds of the available buffer space. This usually indicates that a Header::Deserialize or Trailer::Deserialize method is trying to read data which was not written by a Header::Serialize or Trailer::Serialize method. In short: check the code of your Serialize and Deserialize methods.", file=./ns3/buffer.h, line=1000
terminate called without an active exception



tap-ipv6-tap-ns3_failingexample.cc
tap-ipv6-lrwpan-sixlowpan_failing.cc

mle

unread,
Jan 17, 2020, 3:44:46 PM1/17/20
to ns-3-users
I probably won't have enough time to create a patch for this issue, but this bug occurs when ns-3 has to deal with IPv6 headers from packets arriving from any tap interface. For example, adding a bridge between two TapBridge devices and connecting them with CSMA works, i.e. ping, curl etc. works between these interfaces. As soon as ns-3 has to deal with the IPv6 header, i.e. either pinging a ns-3 NetDevice directly or using a router between two TapBridges, ns-3 terminates with the previously mentioned out-of-bounds error.

Tom Henderson

unread,
Jan 17, 2020, 3:57:49 PM1/17/20
to ns-3-...@googlegroups.com, mle
On 1/17/20 12:44 PM, mle wrote:
> I probably won't have enough time to create a patch for this issue, but
> this bug occurs when ns-3 has to deal with IPv6 headers from packets
> arriving from any tap interface. For example, adding a bridge between
> two TapBridge devices and connecting them with CSMA works, i.e. ping,
> curl etc. works between these interfaces. As soon as ns-3 has to deal
> with the IPv6 header, i.e. either pinging a ns-3 NetDevice directly or
> using a router between two TapBridges, ns-3 terminates with the
> previously mentioned out-of-bounds error.

Thank you for taking the time to report things. I may have a few cycles
to look into this sometime soon. Meanwhile, I will update the tracker.

- Tom

mle

unread,
Jan 17, 2020, 4:42:23 PM1/17/20
to ns-3-users
Thank you. Feel free to contact me if you need further examples etc.

Albu

unread,
Jul 4, 2023, 11:54:52 AM7/4/23
to ns-3-users
``` 
msg="Removing unexpected header.", +2.730860122s 2 file=/home/albu/ns3_workspace/bake/ns-3-dev/src/network/model/packet-metadata.cc, line=698

terminate called without an active exception
Command 'build/scratch/ns3.37-cttc-nr-mimo-demo-default' died with <Signals.SIGABRT: 6>.
``` 

I am trying to implement a 5g scenario using 5G-Lena, but i'm getting the same error above. It seems to be with  Packet::EnableChecking () function, using Tab-bridge module and i think it is with IPv6 Header.
The code is attached. 
cttc-nr-mimo-demo.cc
Reply all
Reply to author
Forward
0 new messages