mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-23 16:20:26 -05:00
test for ancillary data and fixes for lint and doxygen.
git-svn-id: file:///svn/unbound/trunk@848 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
179273a13a
commit
76a31aacd3
6 changed files with 24 additions and 8 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
15 January 2008: Wouter
|
15 January 2008: Wouter
|
||||||
- interface-automatic feature. experimental. Nice for anycast.
|
- interface-automatic feature. experimental. Nice for anycast.
|
||||||
|
- tpkg test for ip6 ancillary data.
|
||||||
|
- removed debug prints.
|
||||||
|
|
||||||
14 January 2008: Wouter
|
14 January 2008: Wouter
|
||||||
- in no debug sets NDEBUG to remove asserts.
|
- in no debug sets NDEBUG to remove asserts.
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,11 @@
|
||||||
#ifndef TESTCODE_READHEX_H
|
#ifndef TESTCODE_READHEX_H
|
||||||
#define TESTCODE_READHEX_H
|
#define TESTCODE_READHEX_H
|
||||||
|
|
||||||
/** helper to convert hex string to packet buffer */
|
/**
|
||||||
|
* Helper to convert hex string to packet buffer.
|
||||||
|
* @param pkt: buffer to put result in.
|
||||||
|
* @param hex: string of hex data. Spaces and ';...' comments are skipped.
|
||||||
|
*/
|
||||||
void hex_to_buf(ldns_buffer* pkt, const char* hex);
|
void hex_to_buf(ldns_buffer* pkt, const char* hex);
|
||||||
|
|
||||||
#endif /* TESTCODE_READHEX_H */
|
#endif /* TESTCODE_READHEX_H */
|
||||||
|
|
|
||||||
BIN
testdata/fwd_ancil.tpkg
vendored
Normal file
BIN
testdata/fwd_ancil.tpkg
vendored
Normal file
Binary file not shown.
|
|
@ -245,7 +245,7 @@ int addr_is_ip6(struct sockaddr_storage* addr, socklen_t len);
|
||||||
* Make sure the sockaddr ends in zeroes. For tree insertion and subsequent
|
* Make sure the sockaddr ends in zeroes. For tree insertion and subsequent
|
||||||
* comparison.
|
* comparison.
|
||||||
* @param addr: the ip4 or ip6 addr.
|
* @param addr: the ip4 or ip6 addr.
|
||||||
* @Param len: lentgh of addr.
|
* @param len: length of addr.
|
||||||
* @param net: number of bits to leave untouched, the rest of the netblock
|
* @param net: number of bits to leave untouched, the rest of the netblock
|
||||||
* address is zeroed.
|
* address is zeroed.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -201,20 +201,22 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
|
||||||
msg.msg_iov = iov;
|
msg.msg_iov = iov;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
msg.msg_control = control;
|
msg.msg_control = control;
|
||||||
|
#ifndef S_SPLINT_S
|
||||||
msg.msg_controllen = sizeof(control);
|
msg.msg_controllen = sizeof(control);
|
||||||
|
#endif /* S_SPLINT_S */
|
||||||
msg.msg_flags = 0;
|
msg.msg_flags = 0;
|
||||||
|
|
||||||
cmsg = CMSG_FIRSTHDR(&msg);
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
|
#ifndef S_SPLINT_S
|
||||||
cmsg->cmsg_level = IPPROTO_IPV6;
|
cmsg->cmsg_level = IPPROTO_IPV6;
|
||||||
cmsg->cmsg_type = IPV6_PKTINFO;
|
cmsg->cmsg_type = IPV6_PKTINFO;
|
||||||
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
|
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
|
||||||
memset(&((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, 0,
|
memset(&((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, 0,
|
||||||
sizeof(struct in6_addr));
|
sizeof(struct in6_addr));
|
||||||
((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_ifindex =
|
((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_ifindex = ifnum;
|
||||||
(TYPE_MSGIOVLEN)ifnum;
|
|
||||||
msg.msg_controllen = cmsg->cmsg_len;
|
msg.msg_controllen = cmsg->cmsg_len;
|
||||||
|
#endif /* S_SPLINT_S */
|
||||||
|
|
||||||
log_info("using interface to sendmsg %d", ifnum);
|
|
||||||
sent = sendmsg(c->fd, &msg, 0);
|
sent = sendmsg(c->fd, &msg, 0);
|
||||||
if(sent == -1) {
|
if(sent == -1) {
|
||||||
verbose(VERB_OPS, "sendto failed: %s", strerror(errno));
|
verbose(VERB_OPS, "sendto failed: %s", strerror(errno));
|
||||||
|
|
@ -240,7 +242,9 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
|
||||||
struct iovec iov[1];
|
struct iovec iov[1];
|
||||||
ssize_t recv;
|
ssize_t recv;
|
||||||
char ancil[256];
|
char ancil[256];
|
||||||
|
#ifndef S_SPLINT_S
|
||||||
struct cmsghdr* cmsg;
|
struct cmsghdr* cmsg;
|
||||||
|
#endif /* S_SPLINT_S */
|
||||||
|
|
||||||
rep.c = (struct comm_point*)arg;
|
rep.c = (struct comm_point*)arg;
|
||||||
log_assert(rep.c->type == comm_udp);
|
log_assert(rep.c->type == comm_udp);
|
||||||
|
|
@ -259,7 +263,9 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
|
||||||
msg.msg_iov = iov;
|
msg.msg_iov = iov;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
msg.msg_control = ancil;
|
msg.msg_control = ancil;
|
||||||
|
#ifndef S_SPLINT_S
|
||||||
msg.msg_controllen = sizeof(ancil);
|
msg.msg_controllen = sizeof(ancil);
|
||||||
|
#endif /* S_SPLINT_S */
|
||||||
msg.msg_flags = 0;
|
msg.msg_flags = 0;
|
||||||
recv = recvmsg(fd, &msg, 0);
|
recv = recvmsg(fd, &msg, 0);
|
||||||
if(recv == -1) {
|
if(recv == -1) {
|
||||||
|
|
@ -272,16 +278,17 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
|
||||||
ldns_buffer_skip(rep.c->buffer, recv);
|
ldns_buffer_skip(rep.c->buffer, recv);
|
||||||
ldns_buffer_flip(rep.c->buffer);
|
ldns_buffer_flip(rep.c->buffer);
|
||||||
rep.ifnum = 0;
|
rep.ifnum = 0;
|
||||||
|
#ifndef S_SPLINT_S
|
||||||
for(cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
|
for(cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
|
||||||
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
||||||
if( cmsg->cmsg_level == IPPROTO_IPV6 &&
|
if( cmsg->cmsg_level == IPPROTO_IPV6 &&
|
||||||
cmsg->cmsg_type == IPV6_PKTINFO) {
|
cmsg->cmsg_type == IPV6_PKTINFO) {
|
||||||
rep.ifnum = (int)((struct in6_pktinfo*)CMSG_DATA(
|
rep.ifnum = ((struct in6_pktinfo*)CMSG_DATA(cmsg))->
|
||||||
cmsg))->ipi6_ifindex;
|
ipi6_ifindex;
|
||||||
/* ignored ipi6_addr with the dest ipv6 address */
|
/* ignored ipi6_addr with the dest ipv6 address */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_info("recvmsg if %d", rep.ifnum);
|
#endif /* S_SPLINT_S */
|
||||||
log_assert(fptr_whitelist_comm_point(rep.c->callback));
|
log_assert(fptr_whitelist_comm_point(rep.c->callback));
|
||||||
if((*rep.c->callback)(rep.c, rep.c->cb_arg, NETEVENT_NOERROR, &rep)) {
|
if((*rep.c->callback)(rep.c, rep.c->cb_arg, NETEVENT_NOERROR, &rep)) {
|
||||||
/* send back immediate reply */
|
/* send back immediate reply */
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,9 @@ struct nsec3_cached_hash {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rbtree for hash cache comparison function
|
* Rbtree for hash cache comparison function
|
||||||
|
* @param c1: key 1.
|
||||||
|
* @param c2: key 2.
|
||||||
|
* @return comparison code, -1, 0, 1, of the keys.
|
||||||
*/
|
*/
|
||||||
int nsec3_hash_cmp(const void* c1, const void* c2);
|
int nsec3_hash_cmp(const void* c1, const void* c2);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue