From: Wouter Wijngaards Date: Tue, 15 Jan 2008 10:10:22 +0000 (+0000) Subject: test for ancillary data and fixes for lint and doxygen. X-Git-Tag: release-0.9~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76a31aacd3da146bc31e3256e995e5fc6d00cd83;p=thirdparty%2Funbound.git test for ancillary data and fixes for lint and doxygen. git-svn-id: file:///svn/unbound/trunk@848 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index bd39ccd59..1178c8c4f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,7 @@ 15 January 2008: Wouter - interface-automatic feature. experimental. Nice for anycast. + - tpkg test for ip6 ancillary data. + - removed debug prints. 14 January 2008: Wouter - in no debug sets NDEBUG to remove asserts. diff --git a/testcode/readhex.h b/testcode/readhex.h index 599bc4e6f..bdd9aee52 100644 --- a/testcode/readhex.h +++ b/testcode/readhex.h @@ -41,7 +41,11 @@ #ifndef 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); #endif /* TESTCODE_READHEX_H */ diff --git a/testdata/fwd_ancil.tpkg b/testdata/fwd_ancil.tpkg new file mode 100644 index 000000000..e8eaac0ed Binary files /dev/null and b/testdata/fwd_ancil.tpkg differ diff --git a/util/net_help.h b/util/net_help.h index e70502cd6..a34be2484 100644 --- a/util/net_help.h +++ b/util/net_help.h @@ -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 * comparison. * @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 * address is zeroed. */ diff --git a/util/netevent.c b/util/netevent.c index 77b5ed7ef..019b8887c 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -201,20 +201,22 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet, msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_control = control; +#ifndef S_SPLINT_S msg.msg_controllen = sizeof(control); +#endif /* S_SPLINT_S */ msg.msg_flags = 0; cmsg = CMSG_FIRSTHDR(&msg); +#ifndef S_SPLINT_S cmsg->cmsg_level = IPPROTO_IPV6; cmsg->cmsg_type = IPV6_PKTINFO; cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); memset(&((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, 0, sizeof(struct in6_addr)); - ((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_ifindex = - (TYPE_MSGIOVLEN)ifnum; + ((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_ifindex = ifnum; msg.msg_controllen = cmsg->cmsg_len; +#endif /* S_SPLINT_S */ - log_info("using interface to sendmsg %d", ifnum); sent = sendmsg(c->fd, &msg, 0); if(sent == -1) { 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]; ssize_t recv; char ancil[256]; +#ifndef S_SPLINT_S struct cmsghdr* cmsg; +#endif /* S_SPLINT_S */ rep.c = (struct comm_point*)arg; 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_iovlen = 1; msg.msg_control = ancil; +#ifndef S_SPLINT_S msg.msg_controllen = sizeof(ancil); +#endif /* S_SPLINT_S */ msg.msg_flags = 0; recv = recvmsg(fd, &msg, 0); 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_flip(rep.c->buffer); rep.ifnum = 0; +#ifndef S_SPLINT_S for(cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if( cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { - rep.ifnum = (int)((struct in6_pktinfo*)CMSG_DATA( - cmsg))->ipi6_ifindex; + rep.ifnum = ((struct in6_pktinfo*)CMSG_DATA(cmsg))-> + ipi6_ifindex; /* 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)); if((*rep.c->callback)(rep.c, rep.c->cb_arg, NETEVENT_NOERROR, &rep)) { /* send back immediate reply */ diff --git a/validator/val_nsec3.h b/validator/val_nsec3.h index bf7069277..a31c6e190 100644 --- a/validator/val_nsec3.h +++ b/validator/val_nsec3.h @@ -243,6 +243,9 @@ struct nsec3_cached_hash { /** * 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);