| Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 1 | From 2a361989b5f84ec23ba7ccb6e527a5590ff55deb Mon Sep 17 00:00:00 2001 | 
|  | 2 | From: Khem Raj <raj.khem@gmail.com> | 
|  | 3 | Date: Sun, 20 Jan 2019 23:11:56 -0800 | 
|  | 4 | Subject: [PATCH] Fix building with libc++ | 
|  | 5 |  | 
|  | 6 | Upstream-Status: Pending | 
|  | 7 |  | 
|  | 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 
|  | 9 | --- | 
|  | 10 | nping/EchoServer.cc | 16 ++++++++-------- | 
|  | 11 | 1 file changed, 8 insertions(+), 8 deletions(-) | 
|  | 12 |  | 
|  | 13 | diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc | 
|  | 14 | index 40cd4d6..04433e1 100644 | 
|  | 15 | --- a/nping/EchoServer.cc | 
|  | 16 | +++ b/nping/EchoServer.cc | 
|  | 17 | @@ -282,14 +282,14 @@ int EchoServer::nep_listen_socket(){ | 
|  | 18 | server_addr6.sin6_len = sizeof(struct sockaddr_in6); | 
|  | 19 | #endif | 
|  | 20 | /* Bind to local address and the specified port */ | 
|  | 21 | -    if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | 
|  | 22 | +    if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | 
|  | 23 | nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr6.sin6_addr), port); | 
|  | 24 | /* If the bind failed for the supplied address, just try again with in6addr_any */ | 
|  | 25 | if( o.spoofSource() ){ | 
|  | 26 | server_addr6.sin6_addr = in6addr_any; | 
|  | 27 | -            if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | 
|  | 28 | +            if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | 
|  | 29 | nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); | 
|  | 30 | -            }else{ | 
|  | 31 | +            }else{ | 
|  | 32 | nping_print(VB_1, "Server bound to port %d", port); | 
|  | 33 | } | 
|  | 34 | } | 
|  | 35 | @@ -320,12 +320,12 @@ int EchoServer::nep_listen_socket(){ | 
|  | 36 | #endif | 
|  | 37 |  | 
|  | 38 | /* Bind to local address and the specified port */ | 
|  | 39 | -    if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | 
|  | 40 | +    if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | 
|  | 41 | nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr4.sin_addr), port); | 
|  | 42 | /* If the bind failed for the supplied address, just try again with in6addr_any */ | 
|  | 43 | if( o.spoofSource() ){ | 
|  | 44 | server_addr4.sin_addr.s_addr=INADDR_ANY; | 
|  | 45 | -            if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | 
|  | 46 | +            if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | 
|  | 47 | nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); | 
|  | 48 | }else{ | 
|  | 49 | nping_print(VB_1, "Server bound to port %d", port); | 
|  | 50 | @@ -561,7 +561,7 @@ clientid_t EchoServer::nep_match_headers(IPv4Header *ip4, IPv6Header *ip6, TCPHe | 
|  | 51 | nping_print(DBG_3, ";"); | 
|  | 52 | /* The payload magic may affect the score only between | 
|  | 53 | * zero and 4 bytes. This is done to prevent long | 
|  | 54 | -                             * common strings like "GET / HTTP/1.1\r\n" | 
|  | 55 | +                             * common strings like "GET / HTTP/1.1\r\n" | 
|  | 56 | * increasing the score a lot and cause problems for | 
|  | 57 | * the matching logic. */ | 
|  | 58 | current_score+= MIN(4, fspec->len)*FACTOR_PAYLOAD_MAGIC; | 
|  | 59 | @@ -571,7 +571,7 @@ clientid_t EchoServer::nep_match_headers(IPv4Header *ip4, IPv6Header *ip6, TCPHe | 
|  | 60 | default: | 
|  | 61 | nping_warning(QT_2, "Bogus field specifier found in client #%d context. Please report a bug", ctx->getIdentifier()); | 
|  | 62 | break; | 
|  | 63 | -                } | 
|  | 64 | +                } | 
|  | 65 | } /* End of field specifiers loop */ | 
|  | 66 |  | 
|  | 67 | nping_print(DBG_3, "%s() current_score=%.02f candidate_score=%.02f", __func__, current_score, candidate_score); | 
|  | 68 | @@ -650,7 +650,7 @@ clientid_t EchoServer::nep_match_packet(const u8 *pkt, size_t pktlen){ | 
|  | 69 | }else{ | 
|  | 70 | if( (tcplen=tcp.validate())==OP_FAILURE){ | 
|  | 71 | return CLIENT_NOT_FOUND; | 
|  | 72 | -                    }else{ | 
|  | 73 | +                    }else{ | 
|  | 74 | if( (int)pktlen > (iplen+tcplen) ){ | 
|  | 75 | if( payload.storeRecvData(pkt+iplen+tcplen, pktlen-iplen-tcplen)!=OP_FAILURE) | 
|  | 76 | payload_included=true; |