- Use "getaddrinfo" and "getnameinfo" function to replace "gethostbyname".
- Use "getnameinfo" to replace "gethostbyaddr" function.
Details
Details
Use traceroute www.google.com to check if the revised code output same as before.
// Origin kola@freebsd:/usr/src/usr.sbin/traceroute $ traceroute www.google.com traceroute: Warning: www.google.com has multiple addresses; using 142.251.42.228 traceroute to tsa01s11-in-f4.1e100.net (142.251.42.228), 64 hops max, 40 byte packets 1 192.168.42.2 (192.168.42.2) 0.255 ms 0.141 ms 0.134 ms 2 192.168.0.1 (192.168.0.1) 0.376 ms 0.312 ms 0.238 ms 3 140.115.220.254 (140.115.220.254) 0.757 ms 0.863 ms 0.775 ms 4 203.72.244.177 (203.72.244.177) 0.526 ms 0.526 ms 0.636 ms 5 211.76.255.130 (211.76.255.130) 3.164 ms 3.481 ms 3.372 ms 6 203-160-226-13.twgate-ip.twgate.net (203.160.226.13) 15.519 ms 4.813 ms 4.923 ms 7 203-78-181-189.twgate-ip.twgate.net (203.78.181.189) 5.386 ms 203-78-181-245.twgate-ip.twgate.net (203.78.181.245) 6.907 ms 5.156 ms 8 175-41-58-146.twgate-ip.twgate.net (175.41.58.146) 5.350 ms 21.356 ms 203-78-181-134.twgate-ip.twgate.net (203.78.181.134) 4.814 ms 9 72.14.195.130 (72.14.195.130) 5.287 ms 5.045 ms 6.018 ms 10 * * * 11 tsa01s11-in-f4.1e100.net (142.251.42.228) 5.358 ms 142.251.226.168 (142.251.226.168) 5.988 ms 209.85.245.64 (209.85.245.64) 6.473 ms // Revised kola@freebsd:/usr/src/usr.sbin/traceroute $ traceroute www.google.com traceroute: Warning: www.google.com has multiple addresses; using 142.251.42.228 traceroute to tsa01s11-in-f4.1e100.net (142.251.42.228), 64 hops max, 40 byte packets 1 192.168.42.2 (192.168.42.2) 0.186 ms 0.056 ms 0.052 ms 2 192.168.0.1 (192.168.0.1) 0.243 ms 0.387 ms 0.344 ms 3 140.115.220.254 (140.115.220.254) 0.889 ms 0.979 ms 8.121 ms 4 203.72.244.177 (203.72.244.177) 0.550 ms 0.803 ms 0.772 ms 5 211.76.255.130 (211.76.255.130) 3.329 ms 13.877 ms 14.432 ms 6 203-160-226-13.twgate-ip.twgate.net (203.160.226.13) 4.859 ms 5.097 ms 4.582 ms 7 203-78-181-189.twgate-ip.twgate.net (203.78.181.189) 6.700 ms 203-78-181-245.twgate-ip.twgate.net (203.78.181.245) 5.055 ms 203-78-181-189.twgate-ip.twgate.net (203.78.181.189) 5.461 ms 8 203-78-181-134.twgate-ip.twgate.net (203.78.181.134) 6.462 ms 175-41-58-146.twgate-ip.twgate.net (175.41.58.146) 6.849 ms 203-78-181-134.twgate-ip.twgate.net (203.78.181.134) 5.008 ms 9 72.14.195.130 (72.14.195.130) 5.284 ms 5.401 ms 5.065 ms 10 * * * 11 142.251.226.168 (142.251.226.168) 6.245 ms tsa01s11-in-f4.1e100.net (142.251.42.228) 5.432 ms 142.251.226.168 (142.251.226.168) 6.282 ms
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 58561 Build 55449: arc lint + arc unit
Event Timeline
usr.sbin/traceroute/traceroute.c | ||
---|---|---|
1852 | Should I use register struct addinfo **res? Can't use register struct addrinfo *res because we can't use the address of register. |