diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-06 17:51:45 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-06 17:51:45 +0100 |
commit | 281e7b8848108f26253ffc466fc149c04665a2c2 (patch) | |
tree | 4d5aa6febfcc64db7ec24f24e90ca817e894d3b6 | |
parent | 1bb52a9b73772d47a49bcaee0eb4eeb0c68b9b4c (diff) | |
download | busybox-w32-281e7b8848108f26253ffc466fc149c04665a2c2.tar.gz busybox-w32-281e7b8848108f26253ffc466fc149c04665a2c2.tar.bz2 busybox-w32-281e7b8848108f26253ffc466fc149c04665a2c2.zip |
ping: trivial simplification. -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/ping.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/networking/ping.c b/networking/ping.c index 28ccbb0bb..c2ff42e2c 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -419,16 +419,18 @@ static void print_stats_and_exit(int junk UNUSED_PARAM) | |||
419 | exit(nreceived == 0 || (deadline && nreceived < pingcount)); | 419 | exit(nreceived == 0 || (deadline && nreceived < pingcount)); |
420 | } | 420 | } |
421 | 421 | ||
422 | static void sendping_tail(void (*sp)(int), const void *pkt, int size_pkt) | 422 | static void sendping_tail(void (*sp)(int), int size_pkt) |
423 | { | 423 | { |
424 | int sz; | 424 | int sz; |
425 | 425 | ||
426 | CLR((uint16_t)ntransmitted % MAX_DUP_CHK); | 426 | CLR((uint16_t)ntransmitted % MAX_DUP_CHK); |
427 | ntransmitted++; | 427 | ntransmitted++; |
428 | 428 | ||
429 | size_pkt += datalen; | ||
430 | |||
429 | /* sizeof(pingaddr) can be larger than real sa size, but I think | 431 | /* sizeof(pingaddr) can be larger than real sa size, but I think |
430 | * it doesn't matter */ | 432 | * it doesn't matter */ |
431 | sz = xsendto(pingsock, pkt, size_pkt, &pingaddr.sa, sizeof(pingaddr)); | 433 | sz = xsendto(pingsock, G.snd_packet, size_pkt, &pingaddr.sa, sizeof(pingaddr)); |
432 | if (sz != size_pkt) | 434 | if (sz != size_pkt) |
433 | bb_error_msg_and_die(bb_msg_write_error); | 435 | bb_error_msg_and_die(bb_msg_write_error); |
434 | 436 | ||
@@ -479,7 +481,7 @@ static void sendping4(int junk UNUSED_PARAM) | |||
479 | 481 | ||
480 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, datalen + ICMP_MINLEN); | 482 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, datalen + ICMP_MINLEN); |
481 | 483 | ||
482 | sendping_tail(sendping4, pkt, datalen + ICMP_MINLEN); | 484 | sendping_tail(sendping4, ICMP_MINLEN); |
483 | } | 485 | } |
484 | #if ENABLE_PING6 | 486 | #if ENABLE_PING6 |
485 | static void sendping6(int junk UNUSED_PARAM) | 487 | static void sendping6(int junk UNUSED_PARAM) |
@@ -498,7 +500,7 @@ static void sendping6(int junk UNUSED_PARAM) | |||
498 | 500 | ||
499 | //TODO? pkt->icmp_cksum = in_cksum(...); | 501 | //TODO? pkt->icmp_cksum = in_cksum(...); |
500 | 502 | ||
501 | sendping_tail(sendping6, pkt, datalen + sizeof(struct icmp6_hdr)); | 503 | sendping_tail(sendping6, sizeof(struct icmp6_hdr)); |
502 | } | 504 | } |
503 | #endif | 505 | #endif |
504 | 506 | ||