diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-02 16:57:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-02 16:57:59 +0000 |
commit | e0b7f71d26d224bd8304d9dfcac3fe9b9d862cd2 (patch) | |
tree | 682ff0c7ef630f2e115b6fbe35d4fed561d06cc5 | |
parent | 2cbe6e6eb237a8f51139be4d450997a0317ec593 (diff) | |
download | busybox-w32-e0b7f71d26d224bd8304d9dfcac3fe9b9d862cd2.tar.gz busybox-w32-e0b7f71d26d224bd8304d9dfcac3fe9b9d862cd2.tar.bz2 busybox-w32-e0b7f71d26d224bd8304d9dfcac3fe9b9d862cd2.zip |
ping(6): use htons instead of SWAP_BE.
-rw-r--r-- | networking/ping.c | 6 | ||||
-rw-r--r-- | networking/ping6.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/networking/ping.c b/networking/ping.c index 18fb926ad..4269eaa6f 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -209,7 +209,7 @@ static void sendping(int junk) | |||
209 | pkt->icmp_type = ICMP_ECHO; | 209 | pkt->icmp_type = ICMP_ECHO; |
210 | pkt->icmp_code = 0; | 210 | pkt->icmp_code = 0; |
211 | pkt->icmp_cksum = 0; | 211 | pkt->icmp_cksum = 0; |
212 | pkt->icmp_seq = SWAP_BE16(ntransmitted++); | 212 | pkt->icmp_seq = htons(ntransmitted++); |
213 | pkt->icmp_id = myid; | 213 | pkt->icmp_id = myid; |
214 | CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK); | 214 | CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK); |
215 | 215 | ||
@@ -235,7 +235,7 @@ static void sendping(int junk) | |||
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | static char *icmp_type_name (int id) | 238 | static char *icmp_type_name(int id) |
239 | { | 239 | { |
240 | switch (id) { | 240 | switch (id) { |
241 | case ICMP_ECHOREPLY: return "Echo Reply"; | 241 | case ICMP_ECHOREPLY: return "Echo Reply"; |
@@ -318,7 +318,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
318 | } else | 318 | } else |
319 | if (icmppkt->icmp_type != ICMP_ECHO) | 319 | if (icmppkt->icmp_type != ICMP_ECHO) |
320 | bb_error_msg("Warning: Got ICMP %d (%s)", | 320 | bb_error_msg("Warning: Got ICMP %d (%s)", |
321 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 321 | icmppkt->icmp_type, icmp_type_name(icmppkt->icmp_type)); |
322 | fflush(stdout); | 322 | fflush(stdout); |
323 | } | 323 | } |
324 | 324 | ||
diff --git a/networking/ping6.c b/networking/ping6.c index 267109c9f..990328a51 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -198,7 +198,7 @@ static void sendping(int junk) | |||
198 | pkt->icmp6_type = ICMP6_ECHO_REQUEST; | 198 | pkt->icmp6_type = ICMP6_ECHO_REQUEST; |
199 | pkt->icmp6_code = 0; | 199 | pkt->icmp6_code = 0; |
200 | pkt->icmp6_cksum = 0; | 200 | pkt->icmp6_cksum = 0; |
201 | pkt->icmp6_seq = SWAP_BE16(ntransmitted++); | 201 | pkt->icmp6_seq = htons(ntransmitted++); |
202 | pkt->icmp6_id = myid; | 202 | pkt->icmp6_id = myid; |
203 | CLR(pkt->icmp6_seq % MAX_DUP_CHK); | 203 | CLR(pkt->icmp6_seq % MAX_DUP_CHK); |
204 | 204 | ||
@@ -234,7 +234,7 @@ static void sendping(int junk) | |||
234 | #ifndef MLD_LISTENER_REDUCTION | 234 | #ifndef MLD_LISTENER_REDUCTION |
235 | # define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION | 235 | # define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION |
236 | #endif | 236 | #endif |
237 | static char *icmp6_type_name (int id) | 237 | static char *icmp6_type_name(int id) |
238 | { | 238 | { |
239 | switch (id) { | 239 | switch (id) { |
240 | case ICMP6_DST_UNREACH: return "Destination Unreachable"; | 240 | case ICMP6_DST_UNREACH: return "Destination Unreachable"; |
@@ -309,7 +309,7 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit | |||
309 | } else | 309 | } else |
310 | if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) | 310 | if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) |
311 | bb_error_msg("Warning: Got ICMP %d (%s)", | 311 | bb_error_msg("Warning: Got ICMP %d (%s)", |
312 | icmppkt->icmp6_type, icmp6_type_name (icmppkt->icmp6_type)); | 312 | icmppkt->icmp6_type, icmp6_type_name(icmppkt->icmp6_type)); |
313 | } | 313 | } |
314 | 314 | ||
315 | static void ping(const char *host) | 315 | static void ping(const char *host) |