From: German Service Network Date: Wed, 9 Oct 2024 19:55:56 +0000 (+0200) Subject: Change ICMP proto number 13 and 14 to name ICMP_TSTAMP and ICMP_TSTAMPREPLY X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9993f628278c41274c4b6f2af2cf585594846b6;p=fping.git Change ICMP proto number 13 and 14 to name ICMP_TSTAMP and ICMP_TSTAMPREPLY --- diff --git a/src/fping.c b/src/fping.c index fd38bc6..569a04d 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1939,7 +1939,7 @@ int send_ping(HOST_ENTRY *h, int index) if (h->saddr.ss_family == AF_INET && socket4 >= 0) { if(icmp_request_typ == 13) - proto = 13; + proto = ICMP_TSTAMP; n = socket_sendto_ping_ipv4(socket4, (struct sockaddr *)&h->saddr, h->saddr_len, myseq, ident4, proto); } #ifdef IPV6 @@ -2216,7 +2216,7 @@ int decode_icmp_ipv4( icp = (struct icmp *)(reply_buf + hlen); - if (icp->icmp_type != ICMP_ECHOREPLY && icp->icmp_type != 14) { + if (icp->icmp_type != ICMP_ECHOREPLY && icp->icmp_type != ICMP_TSTAMPREPLY) { /* Handle other ICMP packets */ struct icmp *sent_icmp; SEQMAP_VALUE *seqmap_value; @@ -2231,7 +2231,7 @@ int decode_icmp_ipv4( sent_icmp = (struct icmp *)(reply_buf + hlen + ICMP_MINLEN + sizeof(struct ip)); - if ((sent_icmp->icmp_type != ICMP_ECHO && sent_icmp->icmp_type != 13) || sent_icmp->icmp_id != ident4) { + if ((sent_icmp->icmp_type != ICMP_ECHO && sent_icmp->icmp_type != ICMP_TSTAMP) || sent_icmp->icmp_id != ident4) { /* not caused by us */ return -1; } @@ -2282,7 +2282,7 @@ int decode_icmp_ipv4( *id = icp->icmp_id; *seq = ntohs(icp->icmp_seq); - if(icp->icmp_type == 14) { + if(icp->icmp_type == ICMP_TSTAMPREPLY) { *ip_header_otime_ms = ntohl(icp->icmp_dun.id_ts.its_otime); *ip_header_rtime_ms = ntohl(icp->icmp_dun.id_ts.its_rtime); *ip_header_ttime_ms = ntohl(icp->icmp_dun.id_ts.its_ttime); diff --git a/src/socket4.c b/src/socket4.c index d3d07d4..c408c6d 100644 --- a/src/socket4.c +++ b/src/socket4.c @@ -140,7 +140,7 @@ int socket_sendto_ping_ipv4(int s, struct sockaddr* saddr, socklen_t saddr_len, icp = (struct icmp*)ping_buffer_ipv4; icp->icmp_type = icmp_proto; - if(icmp_proto == 13) { + if(icmp_proto == ICMP_TSTAMP) { clock_gettime(CLOCK_REALTIME, &tsorig); tsorig_ms = (tsorig.tv_sec % (24*60*60)) * 1000 + tsorig.tv_nsec / 1000000; icp->icmp_otime = htonl(tsorig_ms);