Using Ipv4RawSocket to change IpTtl doesn't work?

63 views
Skip to first unread message

NanerLee

unread,
Sep 10, 2016, 5:17:40 AM9/10/16
to ns-3-users
Hello,everyone!
      Today, I want to write a n3 traceroute application. I create a icmp echo packet and use the Ipv4RawSocket (ttl =1) to sending it to a node. Once one packet is sent, I will  ++ttl. But when I run the program ,the socket send a packet with ttl =64 (should be 1).
      I think that my codes maybe have some errors, so I find the v4ping.cc and add a line code (m_socket -> SetIpTtl(2)) before socket sent packet.
then I use v4ping application and find that v4ping also sent a echo packet with ttl =64.
      so, I guess there are some problem in Ipv4RawSocket. What's more, UdpSocket and TcpSocket are ok. And I also change the Ipv4 protocol to make it can reply the icmp.
      
   Is there someone have some advice? Thanks.


Tommaso Pecorella

unread,
Sep 10, 2016, 8:35:02 AM9/10/16
to ns-3-users
Hi,

it's a bug. Can you provide a test script ?

Thanks,

T.

Tommaso Pecorella

unread,
Sep 10, 2016, 10:27:38 AM9/10/16
to ns-3-users
The patch in bug 2500 should fix your problem.
Nevertheless, a test case would be very helpful.

Thanks,

T.

NanerLee

unread,
Sep 10, 2016, 10:38:52 PM9/10/16
to ns-3-users
Thanks ! 
Yesterday I also saw source codes and compared Ipv4RawSocket with UdpSocket. I found the IpRawSocket didn't check IsManualIpTtl  and handle the  SocketIpTtlTag and so on.
Now, I see your patch, and I think it should fix the bug. But I'm not at my computer. So I will test it tomorrow. When I complete the test, I will reply you again.

Thanks again !    

NanerLee

unread,
Sep 12, 2016, 9:12:06 AM9/12/16
to ns-3-users
Hello, Tommaso Pecorella !
        Today, I download your patch. I find your version is ns3-dev, but I use ns-3.25 now. InetSocketAddress is different between them. So I just test the part of ttl, and it's ok.  Thanks again!

在 2016年9月10日星期六 UTC+8下午10:27:38,Tommaso Pecorella写道:

Tommaso Pecorella

unread,
Sep 13, 2016, 5:27:45 AM9/13/16
to ns-3-users
Hi,

the patch has been pushed and it's "live" in ns-3-dev (it will be incorporated in 3.26).
Thanks for finding this.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages