Bug 1480 - RouteOutput() header source address is always 102.102.102.102
RouteOutput() header source address is always 102.102.102.102
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: routing
ns-3.14
All All
: P5 critical
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-31 14:55 EDT by Mohammed Alenazi
Modified: 2012-09-14 17:02 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mohammed Alenazi 2012-07-31 14:55:31 EDT
I am trying to develop an epidemic routing. I need to know the source address when a packet reaches RouteOutput()function. However, the header source address is always 102.102.102.102. I checked other routing protocols and they all have the same issue.
Comment 1 Tom Henderson 2012-08-01 12:21:10 EDT
(In reply to comment #0)
> I am trying to develop an epidemic routing. I need to know the source address
> when a packet reaches RouteOutput()function. However, the header source address
> is always 102.102.102.102. I checked other routing protocols and they all have
> the same issue.

All Ipv4Address objects are initialized to that value in the constructor:
Ipv4Address::Ipv4Address ()
  : m_address (0x66666666)
{
}

so when you see this value appear in the program, you know that the Ipv4Address hasn't been provided a valid value yet.

Now, regarding your problem, if you are trying to know the source address of the Ipv4Header passed into the RouteOutput() function, it will be uninitialized (i.e. it is "102.102.102.102").  Only the destination address will be set at this point in the code, and only the destination address should be used by the routing protocol (perhaps this should be made clearer in the Doxygen).

Can your epidemic routing protocol determine the source address from the destination address that is passed in to RouteOutput (embedded in the Ipv4Header)?
Comment 2 Mohammed Alenazi 2012-08-02 17:39:24 EDT
First I would like to ask why the source address is not initialized at this point and the destination address is? Is ns-3 trying to follow the Linux functionality in this regard?  
 

For your question "Can your epidemic routing protocol determine the source address from the
destination address that is passed in to RouteOutput (embedded in the
Ipv4Header)?"

I can not determine the source address from the destination address.
Comment 3 Tom Henderson 2012-08-02 20:09:28 EDT
(In reply to comment #2)
> First I would like to ask why the source address is not initialized at this
> point and the destination address is? Is ns-3 trying to follow the Linux
> functionality in this regard?  

Yes, this is similar to Linux's ip_route_output().  The source address is set once you have a route to the destination, based on the next hop for the packet corresponding to the route.

> 
> 
> For your question "Can your epidemic routing protocol determine the source
> address from the
> destination address that is passed in to RouteOutput (embedded in the
> Ipv4Header)?"
> 
> I can not determine the source address from the destination address.

What I mean here is whether you can find a route at this point in the code, just based on having a valid destination address.  Once you have a route, you presumably have a next hop and can determine the matching source address.  I'm not sure how your routing protocol works, but if it has to discover routes, it either needs to make an assumption about the outbound interface at this point in the code, or else defer this until a route is found (similar to how AODV works).
Comment 4 Mohammed Alenazi 2012-08-03 11:28:29 EDT
So, is there a way to determine that the packet is generated from the current node at the route output function?
Comment 5 Tom Henderson 2012-08-03 11:34:18 EDT
(In reply to comment #4)
> So, is there a way to determine that the packet is generated from the current
> node at the route output function?


The assumption is that the packet is generated from the current node; these functions are typically called from the transport protocols when sending data out.
Comment 6 Mohammed Alenazi 2012-08-03 12:04:38 EDT
Fair enough. 
Thank you for your responses. I have read the ns-3 manual routing section
http://www.nsnam.org/docs/release/3.10/manual/html/routing.html

I did not grasp how the routing is done. Do you have any recommendations to read to understand how routing works in more details? a paper or a book
I am not talking about routing in general. I am talking about the references, which ns-3 implementation is based on.       

again
Thank you very much
Comment 7 Tom Henderson 2012-08-22 00:48:58 EDT
(In reply to comment #6)
> Fair enough. 
> Thank you for your responses. I have read the ns-3 manual routing section
> http://www.nsnam.org/docs/release/3.10/manual/html/routing.html
> 
> I did not grasp how the routing is done. Do you have any recommendations to
> read to understand how routing works in more details? a paper or a book
> I am not talking about routing in general. I am talking about the references,
> which ns-3 implementation is based on.       
> 
> again
> Thank you very much

Sorry, I did not see this question until now.  One of the better references I've found is Linux Networking Architecture by Wehrle et al.

I will mark this bug as "Resolved Invalid" resolution unless you would like to propose some change.  I did update the doxygen of RouteOutput() to try to clarify this.