How to modify a packet tag during during routing by RouteInput ()? [Bug 624]

30 views
Skip to first unread message

Wilson Thong

unread,
Jul 5, 2009, 8:45:48 AM7/5/09
to ns-3-users
Just would like to catch your attention on this Bug 624. (http://
www.nsnam.org/bugzilla/show_bug.cgi?id=624)

I am doing a tag-based routing. My attempt is to add a tag to a packet
in
Ipv4RoutingProtocol::RouteOutput (), and the tag is read and modified
by
Ipv4RoutingProtocol::RouteInput () in all the subsequence hops the
packet is
traversing.

However, several issues prevent this from happening.
- Ipv4RoutingProtocol::RouteInput () receives Ptr<const Packet> as its
input
argument. This prevents me from using Packet::RemovePacketTag () to
remove the
original tag and add back a modified tag into the packet.
- Packet::PeekPacketTag (Tag &tag) only copies the tag to its output
argument,
instead of returning the reference to the actually tag. Thus, any
changes to
the "peeked" tag has no effect to the actual tag that is being
"peeked".

Thanks,
Wilson

Mathieu Lacage

unread,
Jul 5, 2009, 9:02:31 AM7/5/09
to ns-3-...@googlegroups.com
On Sun, 2009-07-05 at 05:45 -0700, Wilson Thong wrote:


> - Packet::PeekPacketTag (Tag &tag) only copies the tag to its output
> argument,
> instead of returning the reference to the actually tag. Thus, any
> changes to
> the "peeked" tag has no effect to the actual tag that is being
> "peeked".

Yes, this is on purpose: PeekPacketTag creates a copy of the tag. I
guess that the real problem for you is that RouteInput should take a
non-const packet pointer.

Mathie

Antti Mäkelä

unread,
Jul 5, 2009, 3:08:45 PM7/5/09
to ns-3-users
On Jul 5, 4:02 pm, Mathieu Lacage <mathieu.lac...@sophia.inria.fr>
wrote:
> Yes, this is on purpose: PeekPacketTag creates a copy of the tag. I
> guess that the real problem for you is that RouteInput should take a
> non-const packet pointer.

Maybe hack around it with const_cast?

Wilson Thong

unread,
Jul 5, 2009, 3:46:37 PM7/5/09
to ns-3-users
This is what I did ^^
http://www.nsnam.org/bugzilla/show_bug.cgi?id=624#c2

But as Mathieu mentioned, a better hack should be done on RouteInput
() method. Some more discussion can be found here
http://www.nsnam.org/bugzilla/show_bug.cgi?id=592

Wilson

Wilson Thong

unread,
Jul 5, 2009, 3:48:24 PM7/5/09
to ns-3-users
Oops~! Sorry Mäkelä. I just miss-read your post~ ^^!

Sorry,
Wilson

On Jul 6, 3:46 am, Wilson Thong <wilsonthon...@gmail.com> wrote:
> This is what I did ^^http://www.nsnam.org/bugzilla/show_bug.cgi?id=624#c2
>
> But as Mathieu mentioned, a better hack should be done on RouteInput
> () method. Some more discussion can be found herehttp://www.nsnam.org/bugzilla/show_bug.cgi?id=592

Wilson Thong

unread,
Jul 6, 2009, 1:55:53 AM7/6/09
to ns-3-users
Added a patch to change RouteInput (). It patches the RouteInput ()
argument list so that Ptr<const Packet> becomes Ptr<Packet>
http://www.nsnam.org/bugzilla/show_bug.cgi?id=624#c3

Thanks,
Wilson
Reply all
Reply to author
Forward
0 new messages