How to set the TOS value from Application layer?

339 views
Skip to first unread message

trantheson

unread,
Feb 10, 2012, 9:28:43 AM2/10/12
to ns-3-users
I want to set the TOS value according to the application type in the
application layer, not set TOS value directly in IP header. It means
the TOS value must pass from application layer.
Does anyone can tell me how to do that?

Tommaso Pecorella

unread,
Feb 11, 2012, 8:39:42 PM2/11/12
to ns-3-users
Hi,

you can't, Yet. Sorry.

I'll open a enhancement request about it.

Cheers,

T.

tran the son

unread,
Feb 12, 2012, 5:17:31 AM2/12/12
to ns-3-...@googlegroups.com

Thank you for your reply. It seem to me that ns-3 is hard to build up a hetorogeneous network configuration

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.

Tommaso Pecorella

unread,
Feb 12, 2012, 6:34:25 AM2/12/12
to ns-3-users
Hi,

it's not easy, but if that can help, it's not easy in a real network
either.

Even if setting SO_PRIORITY on a socket is possible on linux, usually
the TOS is set up by accessor elements not under user's control, in
order to prevent easy network hacking. ISPs (and local networks)
preferred way to setup TOS is by using 802.1q or by marking the
packets in the proper network element, as is a border network element
like a router.

Inside the router, packets are not flowing through L4 protocols, only
IP layer is decoded (i.e., you'd use Raw sockets, exposing the IP
layer and, only if necessary, peeling the L4 ports info from the
packet. So, basically, marking is done *without* application's aid.

Now, consider that ns-3 is a simulator. Its functionalities are built
according to user's needs, so when someone find something that is not
yet possible, the feature will be (might be) added. Some features of
real networks are not in ns-3 simply because they're not useful for a
simulation, and they'd slow down the code execution or they'd make the
code more complex to maintain. Our rule is: don't add if it's not
used.

To be able to mark TOS packets might, as a matter of fact, be useful.
Plus it can fit nicely in an ongoing code change (meant to add a
different feature, but we can grab 2 birds with one stone). Hence,
soon it will be possible. Probably in the next release.

If you want to contribute to the code change, this is the reference:
https://www.nsnam.org/bugzilla/show_bug.cgi?id=1111

Cheers,

T.


On Feb 12, 11:17 am, tran the son <theson.viet...@gmail.com> wrote:
> Thank you for your reply. It seem to me that ns-3 is hard to build up a
> hetorogeneous network configuration

tran the son

unread,
Feb 12, 2012, 7:17:56 AM2/12/12
to ns-3-...@googlegroups.com

Thank you so much for your reply, Tommaso.
Hopefully we have interesting chat late on.

Cheers,
Tran

On Feb 12, 2012 11:34 AM, "Tommaso Pecorella" <tomm...@gmail.com> wrote:

Peng Wang

unread,
Mar 5, 2015, 10:34:05 AM3/5/15
to ns-3-...@googlegroups.com
Hi Tommaso,

To make my question be clear, I replied you in this question without posting a new one.

I am also have problem to set TOS from application layer. I notice that the latest ns3 already integrated IP_TOS into socket options. But I am not clear how to set the value of IP_TOS form specific kind of application like onoffapplication. Could you provide some hints on it if you know something. 

Thanks for your time and looking forward to your reply.  

Best Regards,
Peng

Tommaso Pecorella

unread,
Mar 5, 2015, 12:04:22 PM3/5/15
to ns-3-...@googlegroups.com
Hi

over the years things may get simpler.
Use Socket::SetIpTos (uint8_t tos).
You need to find the Socket being used by the Application tho, or to modify the application code. By default the OnOffApplication doesn't set the IP TOS.

Hope this helps,

T.
Reply all
Reply to author
Forward
0 new messages