mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix compile of test tools without protobuf.
This commit is contained in:
parent
28e6c86e61
commit
59fe188954
2 changed files with 21 additions and 0 deletions
|
|
@ -61,8 +61,10 @@
|
||||||
#include "services/listen_dnsport.h"
|
#include "services/listen_dnsport.h"
|
||||||
#include "sldns/sbuffer.h"
|
#include "sldns/sbuffer.h"
|
||||||
#include "sldns/wire2str.h"
|
#include "sldns/wire2str.h"
|
||||||
|
#ifdef USE_DNSTAP
|
||||||
#include <protobuf-c/protobuf-c.h>
|
#include <protobuf-c/protobuf-c.h>
|
||||||
#include "dnstap/dnstap.pb-c.h"
|
#include "dnstap/dnstap.pb-c.h"
|
||||||
|
#endif /* USE_DNSTAP */
|
||||||
#include "util/config_file.h"
|
#include "util/config_file.h"
|
||||||
|
|
||||||
/** listen backlog on TCP connections for dnstap logs */
|
/** listen backlog on TCP connections for dnstap logs */
|
||||||
|
|
@ -406,6 +408,7 @@ static int tap_socket_list_addevs(struct tap_socket_list* list,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_DNSTAP
|
||||||
/** log control frame contents */
|
/** log control frame contents */
|
||||||
static void log_control_frame(uint8_t* pkt, size_t len)
|
static void log_control_frame(uint8_t* pkt, size_t len)
|
||||||
{
|
{
|
||||||
|
|
@ -633,6 +636,7 @@ static void log_data_frame(uint8_t* pkt, size_t len)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
dnstap__dnstap__free_unpacked(d, NULL);
|
dnstap__dnstap__free_unpacked(d, NULL);
|
||||||
}
|
}
|
||||||
|
#endif /* USE_DNSTAP */
|
||||||
|
|
||||||
/** receive bytes from fd, prints errors if bad,
|
/** receive bytes from fd, prints errors if bad,
|
||||||
* returns 0: closed/error, -1: continue, >0 number of bytes */
|
* returns 0: closed/error, -1: continue, >0 number of bytes */
|
||||||
|
|
@ -768,6 +772,7 @@ void tap_data_free(struct tap_data* data)
|
||||||
* returns 0 on error */
|
* returns 0 on error */
|
||||||
static int reply_with_accept(int fd)
|
static int reply_with_accept(int fd)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DNSTAP
|
||||||
/* len includes the escape and framelength */
|
/* len includes the escape and framelength */
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
void* acceptframe = fstrm_create_control_frame_accept(
|
void* acceptframe = fstrm_create_control_frame_accept(
|
||||||
|
|
@ -794,12 +799,18 @@ static int reply_with_accept(int fd)
|
||||||
fd_set_nonblock(fd);
|
fd_set_nonblock(fd);
|
||||||
free(acceptframe);
|
free(acceptframe);
|
||||||
return 1;
|
return 1;
|
||||||
|
#else
|
||||||
|
log_err("no dnstap compiled, no reply");
|
||||||
|
(void)fd;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** reply with FINISH control frame to bidirectional client,
|
/** reply with FINISH control frame to bidirectional client,
|
||||||
* returns 0 on error */
|
* returns 0 on error */
|
||||||
static int reply_with_finish(int fd)
|
static int reply_with_finish(int fd)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DNSTAP
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
void* finishframe = fstrm_create_control_frame_finish(&len);
|
void* finishframe = fstrm_create_control_frame_finish(&len);
|
||||||
if(!finishframe) {
|
if(!finishframe) {
|
||||||
|
|
@ -823,6 +834,11 @@ static int reply_with_finish(int fd)
|
||||||
fd_set_nonblock(fd);
|
fd_set_nonblock(fd);
|
||||||
free(finishframe);
|
free(finishframe);
|
||||||
return 1;
|
return 1;
|
||||||
|
#else
|
||||||
|
log_err("no dnstap compiled, no reply");
|
||||||
|
(void)fd;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
|
|
@ -1007,9 +1023,11 @@ void dtio_tap_callback(int fd, short ATTR_UNUSED(bits), void* arg)
|
||||||
/* we are done with a frame */
|
/* we are done with a frame */
|
||||||
if(verbosity>=3) log_info("received %sframe len %d",
|
if(verbosity>=3) log_info("received %sframe len %d",
|
||||||
(data->control_frame?"control ":""), (int)data->len);
|
(data->control_frame?"control ":""), (int)data->len);
|
||||||
|
#ifdef USE_DNSTAP
|
||||||
if(data->control_frame)
|
if(data->control_frame)
|
||||||
log_control_frame(data->frame, data->len);
|
log_control_frame(data->frame, data->len);
|
||||||
else log_data_frame(data->frame, data->len);
|
else log_data_frame(data->frame, data->len);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(data->len >= 4 && sldns_read_uint32(data->frame) ==
|
if(data->len >= 4 && sldns_read_uint32(data->frame) ==
|
||||||
FSTRM_CONTROL_FRAME_READY) {
|
FSTRM_CONTROL_FRAME_READY) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
12 March 2020: Wouter
|
||||||
|
- Fix compile of test tools without protobuf.
|
||||||
|
|
||||||
11 March 2020: Ralph
|
11 March 2020: Ralph
|
||||||
- Add check to make sure RPZ records are subdomains of configured
|
- Add check to make sure RPZ records are subdomains of configured
|
||||||
zone origin.
|
zone origin.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue