]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
* bugfix #351: fix udp_send hang if UDP checksum error.
authorWouter Wijngaards <wouter@NLnetLabs.nl>
Thu, 20 Jan 2011 10:48:42 +0000 (10:48 +0000)
committerWouter Wijngaards <wouter@NLnetLabs.nl>
Thu, 20 Jan 2011 10:48:42 +0000 (10:48 +0000)
Changelog
net.c

index ee56f6f062bc2101a8becb693b265419f1ef7c24..46157a360117df4571adb45159972f312fd1042a 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,7 @@
        * ldns-test-edns: new example tool that detects EDNS support.
        * fix ldns_resolver_send without openssl.
        * bugfix #342: patch for support for more CERT key types (RFC4398).
+       * bugfix #351: fix udp_send hang if UDP checksum error.
 
 1.6.7  2010-11-08
        * EXPERIMENTAL ecdsa implementation, please do not enable on real
diff --git a/net.c b/net.c
index f6a51bf4a68f2df09f2bf6c3957300fc199e5b57..85a8f506be89cf20c467bb0e0899b756857b77f2 100644 (file)
--- a/net.c
+++ b/net.c
@@ -305,6 +305,11 @@ ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage
                return LDNS_STATUS_NETWORK_ERR;
        }
 
+        /* set to nonblocking, so if the checksum is bad, it becomes
+         * an EGAIN error and the ldns_udp_send function does not block,
+         * but returns a 'NETWORK_ERROR' much like a timeout. */
+        ldns_sock_nonblock(sockfd);
+
        answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL);
 #ifndef USE_WINSOCK
        close(sockfd);