Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
iputils
ping6-Fix-device-binding.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ping6-Fix-device-binding.patch of Package iputils
From cbb67570c37271480aa32b4032c0d742231a8b9a Mon Sep 17 00:00:00 2001 From: Duncan Eastoe <deastoe@vyatta.att-mail.com> Date: Tue, 24 Apr 2018 13:38:58 +0100 Subject: [PATCH] ping6: Fix device binding The use of the && operator instead of || within ping6_run() results in only the first setsockopt() call for IPV6_PKTINFO/SO_BINDTODEVICE getting executed if it returns success, rather than all setsockopt() calls as intended. Fixes #88 Signed-off-by: Duncan Eastoe <deastoe@vyatta.att-mail.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> --- ping6_common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ping6_common.c b/ping6_common.c index 498e590..63f68a3 100644 --- a/ping6_common.c +++ b/ping6_common.c @@ -795,12 +795,16 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock IN6_IS_ADDR_MC_LINKLOCAL(&firsthop.sin6_addr)) firsthop.sin6_scope_id = iface; enable_capability_raw(); - if ( #ifdef IPV6_RECVPKTINFO - setsockopt(probe_fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1 && - setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1 && + if ( + setsockopt(probe_fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1 || + setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1) { + perror("setsockopt(IPV6_PKTINFO)"); + exit(2); + } #endif - setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1 && + if ( + setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1 || setsockopt(sock->fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1) { perror("setsockopt(SO_BINDTODEVICE)"); exit(2); -- 2.36.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor