Ping fixes:

+ integer overflow (#834661)
  + Fallback to numeric addresses while exiting (#834661)
This commit is contained in:
Jan Synacek 2012-06-26 09:39:29 +02:00
parent 69f9e16e6d
commit 6d1533c8b4
3 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,75 @@
--- iputils-s20101006/ping.c 2012-06-25 09:43:53.247390215 +0200
+++ iputils-s20101006-patch/ping.c 2012-06-25 09:46:01.333436372 +0200
@@ -1243,12 +1243,17 @@ pr_addr(__u32 addr)
addr_cache = addr;
tmp_addr.s_addr = addr;
- if ((options & F_NUMERIC) ||
+ in_pr_addr = !setjmp(pr_addr_jmp);
+
+ if (exiting || (options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
sprintf(buf, "%s", inet_ntoa(tmp_addr));
else
snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
inet_ntoa(tmp_addr));
+
+ in_pr_addr = 0;
+
return(buf);
}
--- iputils-s20101006/ping6.c 2012-06-25 09:43:53.233390208 +0200
+++ iputils-s20101006-patch/ping6.c 2012-06-25 09:46:52.437450591 +0200
@@ -1565,9 +1565,13 @@ char * pr_addr(struct in6_addr *addr)
return hp ? hp->h_name : pr_addr_n(addr);
memcpy(&addr_cache, addr, sizeof(addr_cache));
- if (!(options&F_NUMERIC))
+ in_pr_addr = !setjmp(pr_addr_jmp);
+
+ if (!(exiting || options&F_NUMERIC))
hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);
+ in_pr_addr = 0;
+
return hp ? hp->h_name : pr_addr_n(addr);
}
--- iputils-s20101006/ping_common.h 2012-06-25 09:43:53.249390215 +0200
+++ iputils-s20101006-patch/ping_common.h 2012-06-25 09:47:24.002458261 +0200
@@ -16,6 +16,7 @@
#include <errno.h>
#include <string.h>
#include <netdb.h>
+#include <setjmp.h>
#ifdef HAVE_CAPABILITIES
#include <sys/capability.h>
@@ -219,3 +220,6 @@ extern int gather_statistics(__u8 *ptr,
int csfailed, struct timeval *tv, char *from,
void (*pr_reply)(__u8 *ptr, int cc));
extern void print_timestamp(void);
+
+extern int in_pr_addr;
+extern jmp_buf pr_addr_jmp;
--- iputils-s20101006/ping_common.c 2012-06-25 09:43:53.252390217 +0200
+++ iputils-s20101006-patch/ping_common.c 2012-06-25 09:49:04.972477402 +0200
@@ -32,6 +32,8 @@ struct timeval start_time, cur_time;
volatile int exiting;
volatile int status_snapshot;
int confirm = 0;
+int in_pr_addr = 0; /* pr_addr() is executing */
+jmp_buf pr_addr_jmp;
/* Stupid workarounds for bugs/missing functionality in older linuces.
* confirm_flag fixes refusing service of kernels without MSG_CONFIRM.
@@ -252,6 +254,8 @@ void common_options(int ch)
static void sigexit(int signo)
{
exiting = 1;
+ if (in_pr_addr)
+ longjmp(pr_addr_jmp, 0);
}
static void sigstatus(int signo)

View File

@ -0,0 +1,11 @@
--- iputils-s20101006/ping_common.c 2010-10-06 13:59:20.000000000 +0200
+++ iputils-s20101006-patched/ping_common.c 2012-03-09 16:42:46.878151032 +0100
@@ -590,7 +590,7 @@
/* If we are here, recvmsg() is unable to wait for
* required timeout. */
- if (1000*next <= 1000000/(int)HZ) {
+ if (((uint64_t)1000*next) <= (uint64_t)1000000/(int)HZ) {
/* Very short timeout... So, if we wait for
* something, we sleep for MININTERVAL.
* Otherwise, spin! */

View File

@ -32,6 +32,8 @@ Patch16: iputils-20101006-man.patch
Patch17: iputils-20101006-eth.patch
Patch18: iputils-20101006-rr.patch
Patch20: iputils-20101006-ping-defer-caps-drop-when-marking-packets.patch
Patch21: iputils-20101006-ping-integer-overflow.patch
Patch22: iputils-20101006-ping-fallback-to-numeric-addresses-while-exiting.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: docbook-utils perl-SGMLSpm
@ -90,6 +92,8 @@ The iputils-sysvinit contains SysV initscritps support.
%patch17 -p1 -b .eth
%patch18 -p1 -b .rr
%patch20 -p1
%patch21 -p1
%patch22 -p1
%build
%ifarch s390 s390x
@ -196,6 +200,8 @@ rm -rf ${RPM_BUILD_ROOT}
* Mon Jun 25 2012 Jan Synáček <jsynacek@redhat.com> 20101006-15
- Ping fixes:
+ enable marking packets when the correct capabilities are set (#802197)
+ integer overflow (#834661)
+ Fallback to numeric addresses while exiting (#834661)
* Wed Jan 25 2012 Harald Hoyer <harald@redhat.com> 20101006-14
- install everything in /usr