diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 10:47:35 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 10:47:35 +0000 |
commit | 7c1ed2e922e80b7a81da3e748cb975c876315bd5 (patch) | |
tree | 2b6b87a697619b30753d89b04cfcdd3eb13b82fe /networking/traceroute.c | |
parent | 1c3577f91dc2a2df0f5b229aa8063365d8756efe (diff) | |
download | busybox-w32-7c1ed2e922e80b7a81da3e748cb975c876315bd5.tar.gz busybox-w32-7c1ed2e922e80b7a81da3e748cb975c876315bd5.tar.bz2 busybox-w32-7c1ed2e922e80b7a81da3e748cb975c876315bd5.zip |
traceroute: do not look up icmp protocol# in /etc, it is well-known :)
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r-- | networking/traceroute.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c index 3e142d01a..ceec0bc9c 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -224,6 +224,7 @@ | |||
224 | #include <net/if.h> | 224 | #include <net/if.h> |
225 | #include <netinet/in.h> | 225 | #include <netinet/in.h> |
226 | #include <arpa/inet.h> | 226 | #include <arpa/inet.h> |
227 | #include <netinet/protocols.h> | ||
227 | #include <netinet/udp.h> | 228 | #include <netinet/udp.h> |
228 | #include <netinet/ip.h> | 229 | #include <netinet/ip.h> |
229 | #include <netinet/ip_icmp.h> | 230 | #include <netinet/ip_icmp.h> |
@@ -921,14 +922,12 @@ int | |||
921 | traceroute_main(int argc, char *argv[]) | 922 | traceroute_main(int argc, char *argv[]) |
922 | { | 923 | { |
923 | int code, n; | 924 | int code, n; |
924 | char *cp; | ||
925 | unsigned char *outp; | 925 | unsigned char *outp; |
926 | u_int32_t *ap; | 926 | u_int32_t *ap; |
927 | struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; | 927 | struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; |
928 | struct sockaddr_in *to = (struct sockaddr_in *)&whereto; | 928 | struct sockaddr_in *to = (struct sockaddr_in *)&whereto; |
929 | struct hostinfo *hi; | 929 | struct hostinfo *hi; |
930 | int on = 1; | 930 | int on = 1; |
931 | struct protoent *pe; | ||
932 | int ttl, probe, i; | 931 | int ttl, probe, i; |
933 | int seq = 0; | 932 | int seq = 0; |
934 | int tos = 0; | 933 | int tos = 0; |
@@ -1076,16 +1075,12 @@ traceroute_main(int argc, char *argv[]) | |||
1076 | bb_show_usage(); | 1075 | bb_show_usage(); |
1077 | } | 1076 | } |
1078 | 1077 | ||
1079 | cp = "icmp"; | ||
1080 | if ((pe = getprotobyname(cp)) == NULL) | ||
1081 | bb_perror_msg_and_die("unknown protocol %s", cp); | ||
1082 | |||
1083 | /* Insure the socket fds won't be 0, 1 or 2 */ | 1078 | /* Insure the socket fds won't be 0, 1 or 2 */ |
1084 | do n = xopen(bb_dev_null, O_RDONLY); while (n < 2); | 1079 | do n = xopen(bb_dev_null, O_RDONLY); while (n < 2); |
1085 | if (n > 2) | 1080 | if (n > 2) |
1086 | close(n); | 1081 | close(n); |
1087 | 1082 | ||
1088 | s = xsocket(AF_INET, SOCK_RAW, pe->p_proto); | 1083 | s = xsocket(AF_INET, SOCK_RAW, IP_ICMP); |
1089 | 1084 | ||
1090 | #ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG | 1085 | #ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG |
1091 | if (op & USAGE_OP_DEBUG) | 1086 | if (op & USAGE_OP_DEBUG) |