diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 10:33:34 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 10:33:34 +0000 |
commit | 8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 (patch) | |
tree | 998a337ecd57b737423a3793365519213f97da72 /networking/ping.c | |
parent | c882f341cec8451ee87af6746abb7208272d5b1a (diff) | |
download | busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.gz busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.bz2 busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.zip |
- be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict
C99 mode.
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/networking/ping.c b/networking/ping.c index 0b33abf9a..382389dc2 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -209,7 +209,7 @@ int ping_main(int argc, char **argv) | |||
209 | alarm(5); /* give the host 5000ms to respond */ | 209 | alarm(5); /* give the host 5000ms to respond */ |
210 | 210 | ||
211 | #if ENABLE_PING6 | 211 | #if ENABLE_PING6 |
212 | if (lsa->sa.sa_family == AF_INET6) | 212 | if (lsa->u.sa.sa_family == AF_INET6) |
213 | ping6(lsa); | 213 | ping6(lsa); |
214 | else | 214 | else |
215 | #endif | 215 | #endif |
@@ -532,12 +532,12 @@ static void ping4(len_and_sockaddr *lsa) | |||
532 | int sockopt; | 532 | int sockopt; |
533 | 533 | ||
534 | pingsock = create_icmp_socket(); | 534 | pingsock = create_icmp_socket(); |
535 | pingaddr.sin = lsa->sin; | 535 | pingaddr.sin = lsa->u.sin; |
536 | if (source_lsa) { | 536 | if (source_lsa) { |
537 | if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, | 537 | if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, |
538 | &source_lsa->sa, source_lsa->len)) | 538 | &source_lsa->u.sa, source_lsa->len)) |
539 | bb_error_msg_and_die("can't set multicast source interface"); | 539 | bb_error_msg_and_die("can't set multicast source interface"); |
540 | xbind(pingsock, &source_lsa->sa, source_lsa->len); | 540 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
541 | } | 541 | } |
542 | if (opt_I) | 542 | if (opt_I) |
543 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); | 543 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); |
@@ -584,10 +584,10 @@ static void ping6(len_and_sockaddr *lsa) | |||
584 | char control_buf[CMSG_SPACE(36)]; | 584 | char control_buf[CMSG_SPACE(36)]; |
585 | 585 | ||
586 | pingsock = create_icmp6_socket(); | 586 | pingsock = create_icmp6_socket(); |
587 | pingaddr.sin6 = lsa->sin6; | 587 | pingaddr.sin6 = lsa->u.sin6; |
588 | /* untested whether "-I addr" really works for IPv6: */ | 588 | /* untested whether "-I addr" really works for IPv6: */ |
589 | if (source_lsa) | 589 | if (source_lsa) |
590 | xbind(pingsock, &source_lsa->sa, source_lsa->len); | 590 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
591 | if (opt_I) | 591 | if (opt_I) |
592 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); | 592 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); |
593 | 593 | ||
@@ -670,12 +670,12 @@ static void ping(len_and_sockaddr *lsa) | |||
670 | printf("PING %s (%s)", hostname, dotted); | 670 | printf("PING %s (%s)", hostname, dotted); |
671 | if (source_lsa) { | 671 | if (source_lsa) { |
672 | printf(" from %s", | 672 | printf(" from %s", |
673 | xmalloc_sockaddr2dotted_noport(&source_lsa->sa)); | 673 | xmalloc_sockaddr2dotted_noport(&source_lsa->u.sa)); |
674 | } | 674 | } |
675 | printf(": %d data bytes\n", datalen); | 675 | printf(": %d data bytes\n", datalen); |
676 | 676 | ||
677 | #if ENABLE_PING6 | 677 | #if ENABLE_PING6 |
678 | if (lsa->sa.sa_family == AF_INET6) | 678 | if (lsa->u.sa.sa_family == AF_INET6) |
679 | ping6(lsa); | 679 | ping6(lsa); |
680 | else | 680 | else |
681 | #endif | 681 | #endif |
@@ -720,11 +720,11 @@ int ping_main(int argc, char **argv) | |||
720 | lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); | 720 | lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); |
721 | #endif | 721 | #endif |
722 | 722 | ||
723 | if (source_lsa && source_lsa->sa.sa_family != lsa->sa.sa_family) | 723 | if (source_lsa && source_lsa->u.sa.sa_family != lsa->u.sa.sa_family) |
724 | /* leaking it here... */ | 724 | /* leaking it here... */ |
725 | source_lsa = NULL; | 725 | source_lsa = NULL; |
726 | 726 | ||
727 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa); | 727 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); |
728 | ping(lsa); | 728 | ping(lsa); |
729 | pingstats(0); | 729 | pingstats(0); |
730 | return EXIT_SUCCESS; | 730 | return EXIT_SUCCESS; |