Skip to content

Commit

Permalink
remove bogus check required for < 2.4.9 kernels
Browse files Browse the repository at this point in the history
Debian bug: #709052
  • Loading branch information
nmeyerhans authored and David Heidelberger committed Apr 18, 2014
1 parent 0f483ad commit 5bb0f0a
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions ping.c
Expand Up @@ -654,17 +654,6 @@ int receive_error_msg()

acknowledge(ntohs(icmph.un.echo.sequence));

if (!working_recverr) {
struct icmp_filter filt;
working_recverr = 1;
/* OK, it works. Add stronger filter. */
filt.data = ~((1<<ICMP_SOURCE_QUENCH)|
(1<<ICMP_REDIRECT)|
(1<<ICMP_ECHOREPLY));
if (setsockopt(icmp_sock, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) == -1)
perror("\rWARNING: setsockopt(ICMP_FILTER)");
}

net_errors++;
nerrors++;
if (options & F_QUIET)
Expand Down Expand Up @@ -820,19 +809,7 @@ parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv)
icp->type != ICMP_SOURCE_QUENCH);
if (error_pkt) {
acknowledge(ntohs(icp1->un.echo.sequence));
if (working_recverr) {
return 0;
} else {
static int once;
/* Sigh, IP_RECVERR for raw socket
* was broken until 2.4.9. So, we ignore
* the first error and warn on the second.
*/
if (once++ == 1)
fprintf(stderr, "\rWARNING: kernel is not very fresh, upgrade is recommended.\n");
if (once == 1)
return 0;
}
return 0;
}
nerrors+=error_pkt;
if (options&F_QUIET)
Expand Down

0 comments on commit 5bb0f0a

Please sign in to comment.