Bugzilla – Bug 2377
SocketIpTosTag and SocketIpv6TclassTag may be added twice
Last modified: 2016-04-19 18:19:40 UTC
Created attachment 2390 [details] Proposed fix int UdpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address) adds a SocketIpTosTag or a SocketIpv6TclassTag (depending on the IP protocol version) and then calls int UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv{4|6}Address dest, uint16_t port), which add the same tags as well. To verify the issue, I modified the udp test by adding txSocket->SetIpTos (10); in void UdpSocketImplTest::DoRun (void). The test indeed crashed: ---------- begin standard err ---------- assert failed. cond="cur->tid != tag.GetInstanceTypeId ()", msg="Error: cannot add the same kind of tag twice.", file=../src/network/model/packet-tag-list.cc, line=250 terminate called without an active exception ---------- end standard err ---------- CRASH: TestSuite udp 0 of 1 tests passed (0 passed, 0 skipped, 0 failed, 1 crashed, 0 valgrind errors) Attached is the proposed fix, which consists in only having the DoSendTo functions (which are ultimately called by all the other Send variants) add the tags. After applying the fix, the udp test passes again.
Created attachment 2391 [details] Proposed fix v2 Clearly, the changes to the udp test are not part of the fix :-)
Thanks, pushed in changeset: 12090:846fe53b77fc