ns-2 UDP agent omits IP/UDP headers from hdr_cmn::size() — known issue?

14 views
Skip to first unread message

Sergio Andreozzi

unread,
Apr 16, 2026, 6:57:37 AM (12 days ago) Apr 16
to ns-3-users
Hi all,

I'd like to flag a packet size inconsistency in ns-2 and ask whether this is already known.

In ns-2.35, `UdpAgent::sendmsg()` sets `hdr_cmn::size()` to the application payload only, without adding IP (20B) or UDP (8B) header bytes. 

The ns-2 documentation for `hdr_cmn::size_` states it "should be set to the sum of the application data size and IP-, transport-, and application-level headers" but the UDP code doesn't follow this.

Since `LinkDelay::txtime()` uses `hdr_cmn::size()` to compute serialisation time, protocol headers consume zero link bandwidth for UDP traffic.

TCP does not have this issue: `Agent/TCP` has a `useHeaders_` flag (default true since November 2001) that adds 40 bytes (IP+TCP). No equivalent was ever applied to the UDP agent.

In ns-3, headers are real serialised bytes, which is the physically correct behaviour.

Is this a known issue? I couldn't find any discussion of it in the ns-2 documentation, the known-problems page, or the mailing list archives. I'd appreciate confirmation that my reading of the ns-2 source is correct.

Kind regards, Sergio  

Tom Henderson

unread,
Apr 16, 2026, 11:28:13 AM (12 days ago) Apr 16
to ns-3-...@googlegroups.com, Sergio Andreozzi

this is not an ns-2 list, but I'm not sure whether any are still active so I will answer this briefly, going from my memory (not having worked with ns-2 simulations for many years).

ns-2 did not have an IP layer model; there was a lot of abstraction at the network layer.  The implication is that you as a user have to add 28 bytes to whatever your notional UdpAgent application payload is, if you want to model this overhead.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ns-3-users/407405c7-f940-4c21-a920-32b7ed0c57e3n%40googlegroups.com.

Sergio Andreozzi

unread,
Apr 16, 2026, 12:50:08 PM (12 days ago) Apr 16
to ns-3-users
Hi Tom,

Thank you for your reply and apologies for the off-topic. I was comparing ns2 vs ns3 results to validate the port of a code and this piece of info helps to clarify.

Kind regards, Sergio
Reply all
Reply to author
Forward
0 new messages