Fix: Failed to bind to device (#1348934)

Resolves: #1348934
This commit is contained in:
Jan Synacek 2016-06-22 13:38:28 +02:00
parent 23665fab9f
commit 823348da55
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,37 @@
commit 1f6f39b84f81cfa6bc243557a68eebeeac7e8ea3
Author: Robert Schiele <rschiele@gmail.com>
Date: Mon Mar 14 09:18:08 2016 +0100
reorder -I option parsing
This changes -I option parsing in a way that device is only assigned
if neither an IPv4 nor an IPv6 address is detected. Otherwise those
addresses are misinterpreted as device names and as such will cause
error messages later in the code.
Signed-off-by: Robert Schiele <rschiele@gmail.com>
diff --git a/ping.c b/ping.c
index c42d6eb..498c0e8 100644
--- a/ping.c
+++ b/ping.c
@@ -279,10 +279,6 @@ main(int argc, char **argv)
break;
}
case 'I':
- if (inet_pton(AF_INET, optarg, &source.sin_addr) > 0)
- options |= F_STRICTSOURCE;
- else
- device = optarg;
/* IPv6 */
if (strchr(optarg, ':')) {
char *p, *addr = strdup(optarg);
@@ -306,6 +302,8 @@ main(int argc, char **argv)
options |= F_STRICTSOURCE;
free(addr);
+ } else if (inet_pton(AF_INET, optarg, &source.sin_addr) > 0) {
+ options |= F_STRICTSOURCE;
} else {
device = optarg;
}

View File

@ -3,7 +3,7 @@
Summary: Network monitoring tools including ping
Name: iputils
Version: 20160308
Release: 2%{?dist}
Release: 3%{?dist}
# some parts are under the original BSD (ping.c)
# some are under GPLv2+ (tracepath.c)
License: BSD and GPLv2+
@ -20,6 +20,7 @@ Source5: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Patch0: iputils-rh.patch
Patch1: iputils-ifenslave.patch
Patch2: iputils-reorder-I-parsing.patch
BuildRequires: docbook-utils perl-SGMLSpm
BuildRequires: glibc-kernheaders >= 2.4-8.19
@ -57,6 +58,7 @@ cp %{SOURCE4} %{SOURCE5} .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%ifarch s390 s390x
@ -158,6 +160,9 @@ mv -f RELNOTES.tmp RELNOTES
%attr(644,root,root) %{_mandir}/man8/ninfod.8.gz
%changelog
* Wed Jun 22 2016 Jan Synáček <jsynacek@redhat.com> - 20160308-3
- Fix: Failed to bind to device (#1348934)
* Wed Mar 9 2016 Jan Synáček <jsynacek@redhat.com> - 20160308-2
- Don't build against libnettle