summaryrefslogtreecommitdiffstats
path: root/src/openvpn/socket.c
Commit message (Collapse)AuthorAgeFilesLines
* Move res_init() call to inner openvpn_getaddrinfo() loopGert Doering2015-06-021-4/+3
| | | | | | | | | | | | | | | | | | A non-working nameserver in /etc/resolv.conf could lead to endless loops inside openvpn_getaddrinfo(), because many systems will only pick up changes to resolv.conf if res_init() is called again. To reproduce, run openvpn with --resolv-retry infinite (2.3) or --resolv-retry "a high number" (master) on a BSD system. Linux glibc seems to stat() resolv.conf on calls to getaddrinfo() and pick up changes automatically. Trac #523 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1433080749-6892-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9763
* Use EAI_AGAIN instead of EAI_SYSTEM for openvpn_getaddrinfo().Gert Doering2015-06-011-1/+1
| | | | | | | | | | | | Windows has no EAI_SYSTEM (introduced by 5f6c01ea6172ed), but everyone has EAI_AGAIN - which also fits ("a temporary failure in name resolution"). Trac #276 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Steffan Karger <steffan.karger@fox-it.com> Message-Id: <1433178914-7842-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9768
* On signal reception, return EAI_SYSTEM from openvpn_getaddrinfo().Gert Doering2015-06-011-1/+4
| | | | | | | | | | | | | | | | | | A signal (except SIGUSR1) received while waiting for getaddrinfo() is considered fatal, so openvpn_getaddrinfo() is destroying the returned information with freeaddrinfo(), but still signalled "success" (0) to the caller - so if the caller accessed *res before checking *signal_received, it would access just-free()ed memory, which on some platforms still worked and on others caused a crash. Also, ensure that *ai is also NULLed in the caller now. Trac #276 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1433104918-9523-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9764
* assume res_init() is always there.Gert Doering2015-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | Previously, the code tried to find res_init(), and on some systems got it wrong in configure, silently not-using res_init(), leading to unexpected failures to re-init the resolver. We know that all supported OSes (except Windows) have res_init(), so change the call to "#ifndef WIN32", and adjust configure.ac to just find the library to link (if any). With that, failures to find res_init() are no longer "hidden" but clearly visible at link time. AC_SEARCH_LIBS() bits inspired by CUPS' cups_network.m4 (GPLv2) Fix (part of) trac #523 Signed-off-by: Gert Doering <gert@greenie.muc.de> Lazy-ACK-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1430162841-5840-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9614
* Fix leftover 'if (false) ;' statementsGert Doering2015-04-221-6/+2
| | | | | | | | | | | Commit a4b8f653ee5be9c2292c removed the #ifdefs for ENABLE_HTTP_PROXY and ENABLE_SOCKS, thus making this "if (false) ; else if (...)" construct superfluous. Spotted by David Sommerseth. Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1429649352-21034-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9603
* Print remote IPv4 address on a dual-stack v6 socket in IPv4 formatGert Doering2015-02-151-3/+13
| | | | | | | | | | | | | | | | | | | Previously, the code would print IPv4-mapped format ("::ffff:1.2.3.4"), which is technically correct but adds no extra value, and is confusingly different from the output if using a v4 socket. Print "1.2.3.4" instead, whatever socket type is used. Affects client IP address in log file, status output (mroute_addr_print_ex), and environment (setenv_sockaddr). The fact that a dual-stack socket was used is still visible in the initial peer connect message in the log: '... Peer Connection Initiated with [AF_INET6]::ffff:1.1.3.4:53779' Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1419875325-96015-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9363
* socket: remove duplicate expressionYegor Yefremov2014-11-231-1/+1
| | | | | | | | | | | Found via cppcheck and compile-tested. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Acked-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1416687215-26904-1-git-send-email-yegorslists@googlemail.com> URL: http://article.gmane.org/gmane.network.openvpn.devel/9263 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix windows build on older mingw versions.Gert Doering2014-11-181-1/+9
| | | | | | | | | | | | Add missing #define for IPV6_V6ONLY sockopt. Fix last remaining fallout of dual-stack patch set in connect() call for "not CONNECT_NONBLOCK" case. Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1416257903-24629-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/9246
* fix warnings on WindowsHeiko Hund2014-11-171-2/+2
| | | | | | | | | | Just add a few valid casts that shut up mingw gcc. Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1416068708-6871-2-git-send-email-heiko.hund@sophos.com> URL: http://article.gmane.org/gmane.network.openvpn.devel/9229 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix compilation on WindowsHeiko Hund2014-11-171-8/+7
| | | | | | | | | | | | | | | The local member in struct link_socket_address went away a while ago. Fixing the code to compile again under Windows. While there, also fix the code to deal with struct link_socket_info.af == AF_UNSPEC (The breakage this fixes was introduced by the dual-stack socket rework, most likely commit 6c5db192c30ff0c6b89e2e0aefec00329de39302) Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1416068708-6871-1-git-send-email-heiko.hund@sophos.com> URL: http://article.gmane.org/gmane.network.openvpn.devel/9228 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix some unintialized variable warningsSteffan Karger2014-09-151-2/+2
| | | | | | | | | | | Does not actually change behaviour, but fixes compiler warnings and properly initializing is good habit anyway. Signed-off-by: Steffan Karger <steffan@karger.me> Acked-by: David Sommerseth <dazo@users.sourceforge.net> Message-Id: <1408568426-19601-1-git-send-email-steffan@karger.me> URL: http://article.gmane.org/gmane.network.openvpn.devel/9003 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Always enable http-proxy and socks-proxyArne Schwabe2014-07-181-37/+0
| | | | | | | | Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1404735142-31420-2-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8840 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Repair --multihome on FreeBSD for IPv4 sockets.Gert Doering2014-04-251-2/+6
| | | | | | | | | | | | | | | | The code in link_socket_write_udp_posix_sendmsg() for the IP_RECVDESTADDR case was sending a too-large control message (sizeof openvpn_pktinfo, which is a union for IPv4+IPv6) instead of just openvpn_in4_pktinfo, leading to sendmsg() refusing to send the packet. Use RFC 2292 macros for alignment + size calculation. Fix trac#327 Signed-off-by: Gert Doering <gert@greenie.muc.de> Lazy-Ack-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1390164697-1590-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/8250
* Work around Solaris getaddrinfo() returing ai_protocol=0Arne Schwabe2014-04-101-5/+2
| | | | | | | | | | | | | | | | Create_socket() and sub-functions assume that the ai_protocol value returned by getaddrinfo() is IPPROTO_UDP or IPPROTO_TCP. On Solaris, it is "0", because Solaris's socket() call will then "select the right protocol" - but it breaks our code. So remove ASSERT()s on ai_protocol, and also accept properly set ai_socktype (SOCK_DGRAM/SOCK_STREAM) values if ai_protocol is not set. Signed-off-by: Gert Doering <gert@greenie.muc.de> Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <20140407201711.GN16637@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/8428
* Fix crash when using --inetd.Gert Doering2014-03-301-5/+6
| | | | | | | | | | | | | | | | | | Change "local" argument to socket_do_listen() to avoid calling "local->ai_addr" in the caller for the "do_listen == FALSE" case, in which case it could be NULL. Also, ensure "ai" is always initialized in socket_listen_accept() for the "!remote_dynamic" case - otherwise it will sometimes(!) crash in addrlist_match() later on. Get rid of spurious operator precedence warning concerning GETADDR_CACHE_MASK. Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1396181376-32022-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/8412
* Clean up of socket code.Arne Schwabe2014-03-261-96/+92
| | | | | | | | | | | Let socket_create take struct addrinfo as argument and use the entries of addrinfo to create the socket. Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1395407925-25518-11-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8370 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix for server selecting address familyArne Schwabe2014-03-231-12/+12
| | | | | | | | Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1395407925-25518-7-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8371 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Introduce an option to resolve dns names in advance for --remote, --local ↵Arne Schwabe2014-03-231-119/+279
| | | | | | | | | | | | | | | and --http-proxy Also introduce x_gc_addspeical function that allows to add objects with a custom free function to the gc. Some additional addrinfo cleanup Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1395576786-17507-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8386 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix connecting to localhost on AndroidArne Schwabe2014-03-211-3/+18
| | | | | | | | | | Do not protect the link socket when connecting to localhost. Also only call the protect function on valid socket Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1395407925-25518-2-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8375 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix IPv6_V6ONLY logic.Gert Doering2013-12-011-1/+2
| | | | | | | | | | | The "ipv6only" setsockopt logic introduced by 8832c6c4cf was inverted, fix. Also add a msg() to show what value is set, as that makes strange v4/v6 connectivity problems much easier to spot. Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1385847508-32248-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/8079
* Implement listing on IPv4/IPv6 dual socket on all platformArne Schwabe2013-11-291-8/+23
| | | | | | | | | | With this patch OpenVPN will listen on Ipv4 as well as IPv6 when an IPv6 socket is used. Using bind ipv6only will disable this behavior Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-7-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8052 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Implement dual stack client support for OpenVPNArne Schwabe2013-11-291-377/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains a number of changes. I did not further spit this since some changes make only sense being changed together. Always use connection_list, simplifies the reconnection logic. Change meaning of --connect-retry-max and --connect-retry to be used all connections. This now allows OpenVPN to quit after n unsuccessful udp connection attempts Remove the tcp reconnection logic. Failing a TCP connection will now cause a USR1 like a UDP connection. Also extend sig->source from bool to int to specify signal source. This allows a finer grained reconnection logic if necessary in the future. Dual-Stack support: if an address resolves to multiple records each address is tried in sequential order. Then proceed to next connection entry. Introduce the field current_remote to represent the current connecting remote. Also change some fields to struct addrinfo* form openvn_addr to store multiple addresses needed for the dual stack support. Change meaning from udp and tcp to allow both IPv4 and IPv6. Introducue new udp4 and tcp4 to force IPv4. Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-6-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8058 Signed-off-by: Gert Doering <gert@greenie.muc.de> Message-ID: <20131129194258.GL161@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8071 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* When resolving fails print the error message from socket layerArne Schwabe2013-11-271-5/+7
| | | | | | | | Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-5-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8059 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* change the type of 'remote' to addrinfo*, and rename to 'remote_list'.Arne Schwabe2013-11-271-24/+27
| | | | | | | | | | | | | | | | | Warning: this is work in progress, preparing for the full dual-stack client patch. With this commit in place, connecting via "--proto udp" or "--proto tcp-client" to a host that has IPv4+IPv6 in place, on an OS that will prefer IPv6 to IPv4 will always fail. The remote_list will have IPv6 in it's first entry, while the socket will try to do AF_INET, and that will not work. This will be fixed by the upcoming change to handle multiple remote IP addresses (as returned by getaddrinfo()) as multiple <connection> blocks, with appropriate retry and AF selection logic. Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-4-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8053 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Change proto_remote() function to return a constant stringArne Schwabe2013-11-261-10/+12
| | | | | | | | | | | | | Instead of using the implicit protocol string that is returned by the proto/af to names function return a constant string. The strings have become part of the wire protocl and we do not want them to change if the printing of proto/af changes. Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-2-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8055 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Split link_socket_init_phase1 and link_socket_init_phase2 intoArne Schwabe2013-11-261-207/+256
| | | | | | | | | smaller more managable/readable functions. No functional changes Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385382680-5912-1-git-send-email-arne@rfc2549.org> Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix assertion when SIGUSR1 is received while getaddrinfo is successfulArne Schwabe2013-11-241-6/+8
| | | | | | | | Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385064495-25877-4-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8019 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix two instances of asserting AF_INETArne Schwabe2013-11-241-3/+2
| | | | | | | | | The http-proxy and socks-proxy work fine with IPv6 but assert having IPv4 Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385064495-25877-6-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8010 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Split the PROTO_UDP_xx options into AF_INET/AF_INET6 and PROTO_TCP/PROTO_UDP ↵Arne Schwabe2013-11-241-98/+82
| | | | | | | | | | | | | part. Splitting will make the code a little bit cleaner and prepares for dual stack Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385236624-3776-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8043 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Simplify print_sockaddr_ex function, merge duplicate ipv4/ipv6 logic.Arne Schwabe2013-11-231-61/+51
| | | | | | | | Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385064495-25877-2-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8023 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Change the type of all ports in openvpn to const char* and let getaddrinfo ↵Arne Schwabe2013-11-221-69/+58
| | | | | | | | | | | | | | | | | resolve the port together with the hostname. This delays error reporting from config parsing to resolving of host addresses. But it allows statements like remote openvpn.example.org openvpn port https management localhost ntp Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1385064495-25877-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/8018 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* MSVC fixesJames Yonan2013-08-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes to allow compilation with Microsoft Visual Studio 2008 * Fixed several instances of declarations after statements. * In socket.c, fixed issue where uninitialized value (err) is being passed to to gai_strerror. * ssl.c is trying to access multi_output_peer_info_env function in multi.c, causing an undefined symbol warning at compile time. ssl.c is strictly a client of multi.c (but not the other way around), therefore ssl.c does not include multi.h and should not depend on multi.h API. To fix, moved validate_peer_info_line and multi_output_peer_info_env from multi.c to misc.c. * MSVC doesn't support %z as a printf format specifier for size_t * MSVC doesn't support a const variable being used to dimension an array. * Explicitly cast the third parameter to setsockopt to const void * Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1375049135-21444-1-git-send-email-james@openvpn.net> URL: http://article.gmane.org/gmane.network.openvpn.devel/7777 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix problem with UDP tunneling due to mishandled pktinfo structures.Gert Doering2013-05-301-6/+5
| | | | | | | | | | | | | | | | In link_socket_write_udp_posix_sendmsg(), pktinfo structures for ipv4 and ipv6 are going out of scope before actually calling sendmsg(), so depending on compiler optimization, garbage is passed to sendmsg() - fix by using "union openvpn_pktinfo" and having that in scope all the time. Problem reported and patch provided by "danta" in trac#297 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> URL: https://community.openvpn.net/openvpn/ticket/297 Message-ID: <20130530184427.GP20843@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/7629
* Android platform specific changes.Arne Schwabe2013-05-011-0/+10
| | | | | | | | | | | | | On Android 4.0 (TARGET_ANDROID) the real opening of the tun is handled by the (Java) application controlling OpenVPN. Instead of calling ifconfig/route call the management to do the work. When running openvpn as root openvpn should be compiled as TARGET_LINUX Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1367350151-23089-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/7570 Signed-off-by: Gert Doering <gert@greenie.muc.de>
* Fix the proto is used inconsistently warningArne Schwabe2012-12-131-4/+18
| | | | | | | | | | | | | | Fix the "WARNING: 'proto' is used inconsistently, local='proto UDP', remote='proto UDPv6'." message. Note that the on wire strings are now always TCPv4 and UDPv4 to be compatible to pre2.3 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1354650174-25601-1-git-send-email-arne@rfc2549.org URL: http://article.gmane.org/gmane.network.openvpn.devel/7175 Signed-off-by: David Sommerseth <davids@redhat.com>
* Remove dnsflags_to_socktype, it is not used anywhereArne Schwabe2012-12-131-1/+1
| | | | | | | | Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1354303076-13606-1-git-send-email-arne@rfc2549.org URL: http://article.gmane.org/gmane.network.openvpn.devel/7160 Signed-off-by: David Sommerseth <davids@redhat.com>
* Merge getaddr_multi and getaddr6 into one functionArne Schwabe2012-09-021-357/+138
| | | | | | | | | | | | | | | | | | | the getaddr6 and getaddr_mutli functions are duplicates of each other. Since we always require getaddrinfo to be present both function are merge into one openvpn_getaddrinfo. This functions also returns a standard struct addrinfo* so our resolve interface is closer to the standard unix interface. The getaddr function is a wrapper which provides backward compatibility for IPv4 addresses. Ipv6 calls and calls to getaddr_multi are replaced with the new interface. Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1344333837-22076-1-git-send-email-arne@rfc2549.org URL: http://article.gmane.org/gmane.network.openvpn.devel/6959 Signed-off-by: David Sommerseth <davids@redhat.com> [DS: Applied proper indenting on the changes wherever needed]
* Merge almost identical create_socket_tcp and create_socket_tcp6Arne Schwabe2012-08-061-46/+7
| | | | | | | | Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1343914619-10576-1-git-send-email-arne@rfc2549.org URL: http://article.gmane.org/gmane.network.openvpn.devel/6942 Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* don't treat socket related errors special anymoreHeiko Hund2012-07-191-28/+28
| | | | | | | | | | | | | | WSAGetLastError() is just a wrapper for GetLastError(). So, there's no need to differentiate between socket related and other errors. This patch removes all special handling of socket errors in favor of simplifying the codebase somewhat. Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1342542316-32563-1-git-send-email-heiko.hund@sophos.com URL: http://article.gmane.org/gmane.network.openvpn.devel/6876 Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* make non-blocking connect work on WindowsHeiko Hund2012-07-191-1/+7
| | | | | | | | | | | Instead of EINPROGRESS WinSock2 returns WSAEWOULDBLOCK if a non-blocking connect(2) cannot be completed immediately. Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: 1342541993-32462-1-git-send-email-heiko.hund@sophos.com URL: http://article.gmane.org/gmane.network.openvpn.devel/6875 Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Fix reported compile issues on OSX 10.6.8Frank de Brabander2012-06-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not the a problem when building using the latest Mac OS X SDK. I've did a quick search and it seems to be a more common issue on some (old) Darwin platforms. [ Additional review note from Gert Doering: IPV6_PKTINFO is part of the "extended socket API" defined in RFC2292. That RFC used IPV6_PKTINFO both for receiving the destination IPv6 address in UDP packets, and for setting the source address for outgoing packets. RFC2292 was updated by RFC3542, which renamed the "receive" function to IPV6_RECVPKTINFO, leaving the "sending" function as IPV6_PKTINFO - and, subsequently, in FreeBSD they have different "setsockopt()" opcodes. So, on a system that has *both*, we need to use IPV6_RECVPKTINFO for receving (turning it on with setsockopt) to make --multihome work, and IPV6_PKTINFO for sending (which we don't actually do). On a system that only has IPV6_PKTINFO, because it's API only implements 2292 (MacOS up until 10.6), use IPV6_PKTINFO for setsockopt(). Now, the interesting question is whether a 10.5-compiled openvpn.exe will behave correctly under 10.7 if --multihome is active... ] Signed-off-by: Frank de Brabander <debrabander@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: eb2837a3-ce55-4f52-b2fe-f822efc661f7@l14g2000vbe.googlegroups.com URL: http://article.gmane.org/gmane.network.openvpn.devel/5591 Signed-off-by: David Sommerseth <davids@redhat.com>
* cleanup: flags should not be boolAlon Bar-Lev2012-03-301-3/+3
| | | | | | | | | | | | Discussed at [1][2][3]. [1] https://bugs.gentoo.org/show_bug.cgi?id=297854#c2 [2] https://297854.bugs.gentoo.org/attachment.cgi?id=214304 [3] http://sourceforge.net/mailarchive/forum.php?thread_name=20120325111517.GI1359%40greenie.muc.de&forum_name=openvpn-devel Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Signed-off-by: David Sommerseth <davids@redhat.com>
* build: move inet_ntop(), inet_pton() emulation into compatAlon Bar-Lev2012-03-221-55/+0
| | | | | | | Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: Samuli Seppänen <samuli@openvpn.net> Acked-by: David Sommerseth <davids@redhat.com> Signed-off-by: David Sommerseth <davids@redhat.com>
* build: move out config.h include from sysheadAlon Bar-Lev2012-03-221-0/+6
| | | | | | | | | | | Yet another step in reducing the syshead.h content. Conditional compilation of sources needs to be based on a minimum program prefix (config.h only). Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: David Sommerseth <davids@redhat.com> Signed-off-by: David Sommerseth <davids@redhat.com>
* build: standard directory layoutAlon Bar-Lev2012-03-221-0/+3641
Suitable for mature project. root - administrative stuff doc - documents src - sources tests - tests distro - distro specific files sample - samples SIDE EFFECT: many changes to rpm spec. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: Adriaan de Jong <dejong@fox-it.com> Signed-off-by: David Sommerseth <davids@redhat.com>