I am cutting and pasting the following lines from ip.c. They show how the
IPOutgoingPacket() routine detects the source address of the router.
Remember
the source address of the router is dependent on the interface that is being
used to push the packet out. 

                verbose(2, "[IPOutgoingPacket]:: lookup next hop ");
                // find the nexthop and interface and fill them in the
"meta" frame            
                // NOTE: the packet itself is not modified by this lookup!
                if (findRouteEntry(route_tbl, gNtohl(tmpbuf,
ip_pkt->ip_dst), 
                                   pkt->frame.nxth_ip_addr,
&(pkt->frame.dst_interface)) == EXIT_FAILURE)
                                   return EXIT_FAILURE; 

                verbose(2, "[IPOutgoingPacket]:: lookup MTU of nexthop");
                // lookup the IP address of the destination interface..
                if ((status = findInterfaceIP(MTU_tbl,
pkt->frame.dst_interface,
                                              iface_ip_addr)) ==
EXIT_FAILURE)
                                              return EXIT_FAILURE; 
                // the outgoing packet should have the interface IP as
source
                COPY_IP(ip_pkt->ip_src, gHtonl(tmpbuf, iface_ip_addr)); 
                verbose(2, "[IPOutgoingPacket]:: almost one processing the
IP header.");

You can use the "find*" functions to detect the iface_ip_addr -- which is
what you
are looking for. Hope this helps.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Arin Soyen
Sent: November-07-08 1:50 PM
To: [EMAIL PROTECTED]
Cc: gini@cs.mcgill.ca
Subject: [gini] Acquiring Interface Source Address of Router

Hello,

We are having trouble finding out how we should acquire the interface source
address of a router. Could you explain how we can do this?

Thanks,
Arin_______________________________________________
gini mailing list
gini@cs.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/gini

_______________________________________________
gini mailing list
gini@cs.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/gini

Reply via email to