User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:traceroute [2019-02-22 21:53]
ziggi created
c:traceroute [2019-02-22 21:59] (current)
ziggi
Line 147: Line 147:
 #define ICMP_ECHO 8 #define ICMP_ECHO 8
 #define ICMP_CODE 0 #define ICMP_CODE 0
- 
  
     int ttl;     int ttl;
Line 209: Line 208:
         while (i < MAX_COUNT) {         while (i < MAX_COUNT) {
             i++;             i++;
- 
- 
             ssize_t res_count = recvfrom(sock,​ (char *)ibuffer, IBUFFER_SIZE,​ MSG_DONTWAIT,​             ssize_t res_count = recvfrom(sock,​ (char *)ibuffer, IBUFFER_SIZE,​ MSG_DONTWAIT,​
                                          ​(struct sockaddr *)&​src_sockaddr,​ &​src_sockaddr_size);​                                          ​(struct sockaddr *)&​src_sockaddr,​ &​src_sockaddr_size);​
- 
- 
             if (res_count > 0) {             if (res_count > 0) {
-                //​printf("#​ received %d bytes\n",​ (int)res_count);​ 
- 
                 ip_hdr_t *ip_hdr = (struct ip *)ibuffer;                 ip_hdr_t *ip_hdr = (struct ip *)ibuffer;
-                //​printf("# ​  ​responce ttl %d\n", ip_hdr->​ip_ttl);​ 
                 size_t ip_header_len = ip_hdr->​ip_hl >> 2;                 size_t ip_header_len = ip_hdr->​ip_hl >> 2;
                 struct icmp *icmp_header = (struct icmp *)(ip_hdr + ip_header_len);​                 struct icmp *icmp_header = (struct icmp *)(ip_hdr + ip_header_len);​
Line 245: Line 237:
             usleep(SLEEP_TIME * 1000);             usleep(SLEEP_TIME * 1000);
 #endif #endif
- 
- 
- 
         }         }
         close(sock);​         close(sock);​
- 
     }     }