Dima K. on 4 Jan 2004 18:42:02 -0000 |
Hello, The getservbyport function expects the port in network byte order, while tcptraceroute 1.5beta5 passes it in host byte order. Attached is a simple patch to fix that. Dmitry Karasik diff -ru tcptraceroute-1.5beta5/tcptraceroute.c tcptraceroute-1.5beta5.new/tcptraceroute.c --- tcptraceroute-1.5beta5/tcptraceroute.c 2003-07-03 15:56:41.000000000 -0400 +++ tcptraceroute-1.5beta5.new/tcptraceroute.c 2003-12-26 14:24:24.000000000 -0500 @@ -1065,7 +1065,7 @@ else safe_snprintf(dst_name, TEXTSIZE, "%s (%s)", dst, iptos(dst_ip)); - if ((serv = getservbyport(dst_prt, "tcp")) == NULL) + if ((serv = getservbyport(htons(dst_prt), "tcp")) == NULL) safe_snprintf(dst_prt_name, TEXTSIZE, "%d", dst_prt); else safe_snprintf(dst_prt_name, TEXTSIZE, "%d (%s)", dst_prt, serv->s_name);
|
|