[PATCH] ping: broken
Shaun Jackman
sjackman at gmail.com
Tue May 30 22:31:20 UTC 2006
On 5/30/06, Shaun Jackman <sjackman at gmail.com> wrote:
> Can somebody verify for me that there's something wrong with ping? It
> looks to me as though it transmits 64 bytes, and then checks that 192
> bytes were written, which fails.
>
> Cheers,
> Shaun
A patch fixing this issue follows. Please apply.
Cheers,
Shaun
2006-05-30 Shaun Jackman <sjackman at gmail.com>
* networking/ping.c (ping): Fix a bug by removing a check for
exactly sizeof(packet) bytes being sent. Add some CLEAN_UP code.
#
# old_revision [5b53617107a4e90cf2a550391147640480c5a927]
#
# patch "networking/ping.c"
# from [ace3f454dc97642c4caf4fc7cefefa8dd956c52f]
# to [b2059dd7cc68188d67e4f94bbcabe79e9fead0d5]
#
============================================================
--- networking/ping.c ace3f454dc97642c4caf4fc7cefefa8dd956c52f
+++ networking/ping.c b2059dd7cc68188d67e4f94bbcabe79e9fead0d5
@@ -111,8 +111,10 @@
c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
- if (c < 0 || c != sizeof(packet))
+ if (c < 0) {
+ if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
bb_perror_msg_and_die("sendto");
+ }
signal(SIGALRM, noresp);
alarm(5); /* give the host 5000ms to respond */
@@ -136,6 +138,7 @@
break;
}
}
+ if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
printf("%s is alive!\n", hostname);
return;
}
-------------- next part --------------
2006-05-30 Shaun Jackman <sjackman at gmail.com>
* networking/ping.c (ping): Fix a bug by removing a check for
exactly sizeof(packet) bytes being sent. Add some CLEAN_UP code.
#
# old_revision [5b53617107a4e90cf2a550391147640480c5a927]
#
# patch "networking/ping.c"
# from [ace3f454dc97642c4caf4fc7cefefa8dd956c52f]
# to [b2059dd7cc68188d67e4f94bbcabe79e9fead0d5]
#
============================================================
--- networking/ping.c ace3f454dc97642c4caf4fc7cefefa8dd956c52f
+++ networking/ping.c b2059dd7cc68188d67e4f94bbcabe79e9fead0d5
@@ -111,8 +111,10 @@
c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
- if (c < 0 || c != sizeof(packet))
+ if (c < 0) {
+ if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
bb_perror_msg_and_die("sendto");
+ }
signal(SIGALRM, noresp);
alarm(5); /* give the host 5000ms to respond */
@@ -136,6 +138,7 @@
break;
}
}
+ if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
printf("%s is alive!\n", hostname);
return;
}
More information about the busybox
mailing list