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.