Date: Tue, 22 Nov 2016 18:43:09 +0000 (UTC) From: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r426848 - head/net/mtr/files Message-ID: <201611221843.uAMIh9XB085319@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sunpoet Date: Tue Nov 22 18:43:09 2016 New Revision: 426848 URL: https://svnweb.freebsd.org/changeset/ports/426848 Log: - Fix build with IPV6 disabled Obtained from: https://github.com/traviscross/mtr/commit/3d1352ca93efca2f8c4be7ccd16cbe2472b4fff0 PR: 214731 [1] Submitted by: <sergey@akhmatov.ru> [1], Iain Grant <iain.grant@stream-technologies.com> (via email) Added: head/net/mtr/files/ head/net/mtr/files/patch-net.c (contents, props changed) Added: head/net/mtr/files/patch-net.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/mtr/files/patch-net.c Tue Nov 22 18:43:09 2016 (r426848) @@ -0,0 +1,66 @@ +--- net.c.orig 2016-08-01 13:07:58 UTC ++++ net.c +@@ -320,9 +320,11 @@ void net_send_tcp(int index) + struct sockaddr_storage local; + struct sockaddr_storage remote; + struct sockaddr_in *local4 = (struct sockaddr_in *) &local; +- struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote; ++#ifdef ENABLE_IPV6 ++ struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote; ++#endif + socklen_t len; + + ttl = index + 1; +@@ -437,9 +439,11 @@ void net_send_sctp(int index) + struct sockaddr_storage local; + struct sockaddr_storage remote; + struct sockaddr_in *local4 = (struct sockaddr_in *) &local; +- struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote; ++#ifdef ENABLE_IPV6 ++ struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote; ++#endif + socklen_t len; + + ttl = index + 1; +@@ -726,8 +730,12 @@ void net_send_query(int index) + + /* sendto() assumes packet length includes the IPv4 header but not the + IPv6 header. */ +- spacketsize = abs(packetsize) - +- ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) ); ++ spacketsize = abs(packetsize) ++#ifdef ENABLE_IPV6 ++ - ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) ) ++#endif ++ ; ++ + rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen); + if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) { + /* Try the first packet again using host byte order. */ +@@ -1529,17 +1537,17 @@ void net_reset(void) + + int net_set_interfaceaddress_udp() + { ++ struct sockaddr_in * sa4; ++ struct sockaddr_storage remote; ++ struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote; + #ifdef ENABLE_IPV6 + struct sockaddr_storage name_struct; ++ struct sockaddr_in6 * sa6; ++ struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote; + #else + struct sockaddr_in name_struct; + #endif +- struct sockaddr_in * sa4; +- struct sockaddr_in6 * sa6; + struct sockaddr * name = (struct sockaddr *) &name_struct; +- struct sockaddr_storage remote; +- struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote; +- struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote; + socklen_t len; + int s; +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611221843.uAMIh9XB085319>