"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dnstap/dnstap.c" between
nsd-4.3.5.tar.gz and nsd-4.3.6.tar.gz

About: NSD is an authoritative only, high performance, simple name server daemon.

dnstap.c  (nsd-4.3.5):dnstap.c  (nsd-4.3.6)
skipping to change at line 295 skipping to change at line 295
dt_fill_buffer(uint8_t* pkt, size_t pktlen, ProtobufCBinaryData *p, protobuf_c_b oolean *has) dt_fill_buffer(uint8_t* pkt, size_t pktlen, ProtobufCBinaryData *p, protobuf_c_b oolean *has)
{ {
p->len = pktlen; p->len = pktlen;
p->data = pkt; p->data = pkt;
*has = 1; *has = 1;
} }
static void static void
dt_msg_fill_net(struct dt_msg *dm, dt_msg_fill_net(struct dt_msg *dm,
#ifdef INET6 #ifdef INET6
struct sockaddr_storage *ss, struct sockaddr_storage *rs,
struct sockaddr_storage *qs,
#else #else
struct sockaddr_in *ss, struct sockaddr_in *rs,
struct sockaddr_in *qs,
#endif #endif
int is_tcp, int is_tcp,
ProtobufCBinaryData *addr, protobuf_c_boolean *has_addr, ProtobufCBinaryData *raddr, protobuf_c_boolean *has_raddr,
uint32_t *port, protobuf_c_boolean *has_port) uint32_t *rport, protobuf_c_boolean *has_rport,
ProtobufCBinaryData *qaddr, protobuf_c_boolean *has_qaddr,
uint32_t *qport, protobuf_c_boolean *has_qport)
{ {
#ifdef INET6 #ifdef INET6
assert(ss->ss_family == AF_INET6 || ss->ss_family == AF_INET); assert(qs->ss_family == AF_INET6 || qs->ss_family == AF_INET);
if (ss->ss_family == AF_INET6) { if (qs->ss_family == AF_INET6) {
struct sockaddr_in6 *s = (struct sockaddr_in6 *) ss; struct sockaddr_in6 *s = (struct sockaddr_in6 *) qs;
/* socket_family */ /* socket_family */
dm->m.socket_family = DNSTAP__SOCKET_FAMILY__INET6; dm->m.socket_family = DNSTAP__SOCKET_FAMILY__INET6;
dm->m.has_socket_family = 1; dm->m.has_socket_family = 1;
/* addr: query_address or response_address */ /* addr: query_address or response_address */
addr->data = s->sin6_addr.s6_addr; qaddr->data = s->sin6_addr.s6_addr;
addr->len = 16; /* IPv6 */ qaddr->len = 16; /* IPv6 */
*has_addr = 1; *has_qaddr = 1;
/* port: query_port or response_port */ /* port: query_port or response_port */
*port = ntohs(s->sin6_port); *qport = ntohs(s->sin6_port);
*has_port = 1; *has_qport = 1;
} else if (ss->ss_family == AF_INET) { } else if (qs->ss_family == AF_INET) {
#else #else
if (ss->sin_family == AF_INET) { if (qs->sin_family == AF_INET) {
#endif /* INET6 */ #endif /* INET6 */
struct sockaddr_in *s = (struct sockaddr_in *) ss; struct sockaddr_in *s = (struct sockaddr_in *) qs;
/* socket_family */ /* socket_family */
dm->m.socket_family = DNSTAP__SOCKET_FAMILY__INET; dm->m.socket_family = DNSTAP__SOCKET_FAMILY__INET;
dm->m.has_socket_family = 1; dm->m.has_socket_family = 1;
/* addr: query_address or response_address */ /* addr: query_address or response_address */
addr->data = (uint8_t *) &s->sin_addr.s_addr; qaddr->data = (uint8_t *) &s->sin_addr.s_addr;
addr->len = 4; /* IPv4 */ qaddr->len = 4; /* IPv4 */
*has_addr = 1; *has_qaddr = 1;
/* port: query_port or response_port */ /* port: query_port or response_port */
*port = ntohs(s->sin_port); *qport = ntohs(s->sin_port);
*has_port = 1; *has_qport = 1;
} }
#ifdef INET6
assert(rs->ss_family == AF_INET6 || rs->ss_family == AF_INET);
if (rs->ss_family == AF_INET6) {
struct sockaddr_in6 *s = (struct sockaddr_in6 *) rs;
/* addr: query_address or response_address */
raddr->data = s->sin6_addr.s6_addr;
raddr->len = 16; /* IPv6 */
*has_raddr = 1;
/* port: query_port or response_port */
*rport = ntohs(s->sin6_port);
*has_rport = 1;
} else if (rs->ss_family == AF_INET) {
#else
if (rs->sin_family == AF_INET) {
#endif /* INET6 */
struct sockaddr_in *s = (struct sockaddr_in *) rs;
/* addr: query_address or response_address */
raddr->data = (uint8_t *) &s->sin_addr.s_addr;
raddr->len = 4; /* IPv4 */
*has_raddr = 1;
/* port: query_port or response_port */
*rport = ntohs(s->sin_port);
*has_rport = 1;
}
if (!is_tcp) { if (!is_tcp) {
/* socket_protocol */ /* socket_protocol */
dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__UDP; dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__UDP;
dm->m.has_socket_protocol = 1; dm->m.has_socket_protocol = 1;
} else { } else {
/* socket_protocol */ /* socket_protocol */
dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__TCP; dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__TCP;
dm->m.has_socket_protocol = 1; dm->m.has_socket_protocol = 1;
} }
} }
void void
dt_msg_send_auth_query(struct dt_env *env, dt_msg_send_auth_query(struct dt_env *env,
#ifdef INET6 #ifdef INET6
struct sockaddr_storage* local_addr,
struct sockaddr_storage* addr, struct sockaddr_storage* addr,
#else #else
struct sockaddr_in* local_addr,
struct sockaddr_in* addr, struct sockaddr_in* addr,
#endif #endif
int is_tcp, uint8_t* zone, size_t zonelen, uint8_t* pkt, size_t pktlen) int is_tcp, uint8_t* zone, size_t zonelen, uint8_t* pkt, size_t pktlen)
{ {
struct dt_msg dm; struct dt_msg dm;
struct timeval qtime; struct timeval qtime;
gettimeofday(&qtime, NULL); gettimeofday(&qtime, NULL);
/* type */ /* type */
skipping to change at line 383 skipping to change at line 419
} }
/* query_time */ /* query_time */
dt_fill_timeval(&qtime, dt_fill_timeval(&qtime,
&dm.m.query_time_sec, &dm.m.has_query_time_sec, &dm.m.query_time_sec, &dm.m.has_query_time_sec,
&dm.m.query_time_nsec, &dm.m.has_query_time_nsec); &dm.m.query_time_nsec, &dm.m.has_query_time_nsec);
/* query_message */ /* query_message */
dt_fill_buffer(pkt, pktlen, &dm.m.query_message, &dm.m.has_query_message) ; dt_fill_buffer(pkt, pktlen, &dm.m.query_message, &dm.m.has_query_message) ;
/* socket_family, socket_protocol, query_address, query_port */ /* socket_family, socket_protocol, query_address, query_port, reponse_add
dt_msg_fill_net(&dm, addr, is_tcp, ress (local_address), response_port (local_port) */
dt_msg_fill_net(&dm, local_addr, addr, is_tcp,
&dm.m.response_address, &dm.m.has_response_address,
&dm.m.response_port, &dm.m.has_response_port,
&dm.m.query_address, &dm.m.has_query_address, &dm.m.query_address, &dm.m.has_query_address,
&dm.m.query_port, &dm.m.has_query_port); &dm.m.query_port, &dm.m.has_query_port);
if (dt_pack(&dm.d, &dm.buf, &dm.len_buf)) if (dt_pack(&dm.d, &dm.buf, &dm.len_buf))
dt_send(env, dm.buf, dm.len_buf); dt_send(env, dm.buf, dm.len_buf);
} }
void void
dt_msg_send_auth_response(struct dt_env *env, dt_msg_send_auth_response(struct dt_env *env,
#ifdef INET6 #ifdef INET6
struct sockaddr_storage* local_addr,
struct sockaddr_storage* addr, struct sockaddr_storage* addr,
#else #else
struct sockaddr_in* local_addr,
struct sockaddr_in* addr, struct sockaddr_in* addr,
#endif #endif
int is_tcp, uint8_t* zone, size_t zonelen, uint8_t* pkt, size_t pktlen) int is_tcp, uint8_t* zone, size_t zonelen, uint8_t* pkt, size_t pktlen)
{ {
struct dt_msg dm; struct dt_msg dm;
struct timeval rtime; struct timeval rtime;
gettimeofday(&rtime, NULL); gettimeofday(&rtime, NULL);
/* type */ /* type */
skipping to change at line 424 skipping to change at line 464
} }
/* response_time */ /* response_time */
dt_fill_timeval(&rtime, dt_fill_timeval(&rtime,
&dm.m.response_time_sec, &dm.m.has_response_time_sec, &dm.m.response_time_sec, &dm.m.has_response_time_sec,
&dm.m.response_time_nsec, &dm.m.has_response_time_nsec); &dm.m.response_time_nsec, &dm.m.has_response_time_nsec);
/* response_message */ /* response_message */
dt_fill_buffer(pkt, pktlen, &dm.m.response_message, &dm.m.has_response_me ssage); dt_fill_buffer(pkt, pktlen, &dm.m.response_message, &dm.m.has_response_me ssage);
/* socket_family, socket_protocol, query_address, query_port */ /* socket_family, socket_protocol, query_address, query_port, response_ad
dt_msg_fill_net(&dm, addr, is_tcp, dress (local_address), response_port (local_port) */
dt_msg_fill_net(&dm, local_addr, addr, is_tcp,
&dm.m.response_address, &dm.m.has_response_address,
&dm.m.response_port, &dm.m.has_response_port,
&dm.m.query_address, &dm.m.has_query_address, &dm.m.query_address, &dm.m.has_query_address,
&dm.m.query_port, &dm.m.has_query_port); &dm.m.query_port, &dm.m.has_query_port);
if (dt_pack(&dm.d, &dm.buf, &dm.len_buf)) if (dt_pack(&dm.d, &dm.buf, &dm.len_buf))
dt_send(env, dm.buf, dm.len_buf); dt_send(env, dm.buf, dm.len_buf);
} }
#endif /* USE_DNSTAP */ #endif /* USE_DNSTAP */
 End of changes. 17 change blocks. 
24 lines changed or deleted 68 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)