Browse files

More dtrace probes.

  • Loading branch information...
1 parent 0f9ba99 commit ddbee52efbcdbe6feca83ea9006a702ddf01579f @jedisct1 jedisct1 committed Jun 19, 2012
View
2 src/dnscrypt-proxy/probes_dnscrypt_proxy.d
@@ -38,9 +38,11 @@ provider dnscrypt_proxy {
probe request__tcp__timeout(void *);
probe request__curve_start(void *, size_t);
+ probe request__curve_error(void *);
probe request__curve_done(void *, size_t);
probe request__uncurve_start(void *, size_t);
+ probe request__uncurve_error(void *);
probe request__uncurve_done(void *, size_t);
probe status__requests__active(unsigned int, unsigned int);
View
8 src/dnscrypt-proxy/probes_no_dtrace.h
@@ -34,6 +34,10 @@ do { \
do { \
} while (0)
#define DNSCRYPT_PROXY_REQUEST_CURVE_DONE_ENABLED() (0)
+#define DNSCRYPT_PROXY_REQUEST_CURVE_ERROR(arg0) \
+do { \
+ } while (0)
+#define DNSCRYPT_PROXY_REQUEST_CURVE_ERROR_ENABLED() (0)
#define DNSCRYPT_PROXY_REQUEST_CURVE_START(arg0, arg1) \
do { \
} while (0)
@@ -134,6 +138,10 @@ do { \
do { \
} while (0)
#define DNSCRYPT_PROXY_REQUEST_UNCURVE_DONE_ENABLED() (0)
+#define DNSCRYPT_PROXY_REQUEST_UNCURVE_ERROR(arg0) \
+do { \
+ } while (0)
+#define DNSCRYPT_PROXY_REQUEST_UNCURVE_ERROR_ENABLED() (0)
#define DNSCRYPT_PROXY_REQUEST_UNCURVE_START(arg0, arg1) \
do { \
} while (0)
View
6 src/dnscrypt-proxy/tcp_request.c
@@ -153,7 +153,7 @@ resolver_proxy_read_cb(struct bufferevent * const proxy_resolver_bev,
tcp_request->dns_reply_len);
return;
}
- DNSCRYPT_PROXY_REQUEST_TCP_PROXY_RESOLVER_GOT_INVALID_REPLY(tcp_request);
+ DNSCRYPT_PROXY_REQUEST_TCP_PROXY_RESOLVER_REPLIED(tcp_request);
assert(available_size >= tcp_request->dns_reply_len);
uncurved_len = tcp_request->dns_reply_len;
dns_reply = evbuffer_pullup(input, uncurved_len);
@@ -165,7 +165,7 @@ resolver_proxy_read_cb(struct bufferevent * const proxy_resolver_bev,
if (dnscrypt_client_uncurve(&proxy_context->dnscrypt_client,
tcp_request->client_nonce,
dns_reply, &uncurved_len) != 0) {
- DNSCRYPT_PROXY_REQUEST_UNCURVE_DONE(tcp_request, uncurved_len);
+ DNSCRYPT_PROXY_REQUEST_UNCURVE_ERROR(tcp_request);
DNSCRYPT_PROXY_REQUEST_TCP_PROXY_RESOLVER_GOT_INVALID_REPLY(tcp_request);
logger_noformat(tcp_request->proxy_context, LOG_WARNING,
"Received a suspicious reply from the resolver");
@@ -284,9 +284,11 @@ client_proxy_read_cb(struct bufferevent * const client_proxy_bev,
tcp_request->client_nonce,
dns_query, tcp_request->dns_query_len, max_len);
if (curve_ret <= (ssize_t) 0) {
+ DNSCRYPT_PROXY_REQUEST_CURVE_ERROR(tcp_request);
tcp_request_kill(tcp_request);
return;
}
+ DNSCRYPT_PROXY_REQUEST_CURVE_DONE(tcp_request, (size_t) curve_ret);
dns_curved_query_len_buf[0] = (curve_ret >> 8) & 0xff;
dns_curved_query_len_buf[1] = curve_ret & 0xff;
if (bufferevent_write(tcp_request->proxy_resolver_bev,
View
3 src/dnscrypt-proxy/udp_request.c
@@ -118,7 +118,7 @@ resolver_to_proxy_cb(evutil_socket_t proxy_resolver_handle, short ev_flags,
if (dnscrypt_client_uncurve
(&udp_request->proxy_context->dnscrypt_client,
udp_request->client_nonce, dns_packet, &uncurved_len) != 0) {
- DNSCRYPT_PROXY_REQUEST_UNCURVE_DONE(udp_request, uncurved_len);
+ DNSCRYPT_PROXY_REQUEST_UNCURVE_ERROR(udp_request);
DNSCRYPT_PROXY_REQUEST_UDP_PROXY_RESOLVER_GOT_INVALID_REPLY(udp_request);
logger_noformat(udp_request->proxy_context, LOG_WARNING,
"Received a suspicious reply from the resolver");
@@ -294,6 +294,7 @@ client_to_proxy_cb(evutil_socket_t client_proxy_handle, short ev_flags,
udp_request->client_nonce, dns_packet,
dns_packet_len, max_len);
if (curve_ret <= (ssize_t) 0) {
+ DNSCRYPT_PROXY_REQUEST_CURVE_ERROR(udp_request);
return;
}
dns_packet_len = (size_t) curve_ret;

0 comments on commit ddbee52

Please sign in to comment.