On Thu, Feb 25, 2016 at 09:42:25AM +0200, Imre Oolberg wrote:
> Hi!
> 
> On 2016-02-22 20:08, Stuart Henderson wrote:
> >On 2016-02-21, Imre Oolberg <i...@auul.pri.ee> wrote:
> >>Hi!
> >>
> >>I am in the middle of implementing https://www.dns-oarc.net/tools/dsc/
> >>while on OpenBSD is running nameserver process i.e. there needs to be
> >>also collector part of DSC and I am not succeeding compiling it.
> >>Platform is OpenBSD v 5.8 amd64 and source is dsc-201502251630.tar.gz.
> >>After unpacking i get
> >>
> >>imre-obsd-58-rec:~/dsc/l/dsc-201502251630/collector# make
> >>...
> >>cc -g -Wall -DUSE_IPV6=1 -g -O2  -g -Wall -DUSE_IPV6=1 -g -O2    -c
> >>base64.c
> >>cc -g -Wall -DUSE_IPV6=1 -g -O2  -g -Wall -DUSE_IPV6=1 -g -O2    -c
> >>generic_counter.c
> >>cc -g -Wall -DUSE_IPV6=1 -g -O2  -g -Wall -DUSE_IPV6=1 -g -O2    -c
> >>pcap.c
> >>cc -g -Wall -DUSE_IPV6=1 -g -O2  -g -Wall -DUSE_IPV6=1 -g -O2    -c
> >>ncap.c
> >>cc -g -Wall -DUSE_IPV6=1 -g -O2  -g -Wall -DUSE_IPV6=1 -g -O2    -c
> >>dns_protocol.c
> >>dns_protocol.c:9:33: error: arpa/nameser_compat.h: No such file or
> >>directory
> >>*** Error 1 in dsc (<sys.mk>:87 'dns_protocol.o')
> >>*** Error 1 in /root/dsc/l/dsc-201502251630/collector (Makefile:2
> >>'all')
> >>
> >>So i found that probably i need libbind package and continuing in
> >>collector/dsc directory like this
> >>
> >>imre-obsd-58-rec:~/dsc/l/dsc-201502251630/collector/dsc# ./configure
> >>CFLAGS="-I/usr/local/include/bind" LDFLAGS="-L/usr/local/lib/libbind"
> >>
> >>i get further (it think almost to the end on compilation)
> >>
> >>imre-obsd-58-rec:~/dsc/l/dsc-201502251630/collector/dsc# make
> >>...
> >>cc -g -Wall -DUSE_IPV6=1 -I/usr/local/include/bind       -g -Wall
> >>-DUSE_IPV6=1 -I/usr/local/include/bind         -c config_hooks.c
> >>cc -g -Wall -DUSE_IPV6=1 -I/usr/local/include/bind       -g -Wall
> >>-DUSE_IPV6=1 -I/usr/local/include/bind         -c hashtbl.c
> >>cc -g -Wall -DUSE_IPV6=1 -I/usr/local/include/bind       -g -Wall
> >>-DUSE_IPV6=1 -I/usr/local/include/bind         -c lookup3.c
> >>cc -g -Wall -DUSE_IPV6=1 -I/usr/local/include/bind       -g -Wall
> >>-DUSE_IPV6=1 -I/usr/local/include/bind         -c xmalloc.c
> >>cc -g -Wall -DUSE_IPV6=1 -I/usr/local/include/bind       -g -Wall
> >>-DUSE_IPV6=1 -I/usr/local/include/bind         -c inX_addr.c
> >>c++ -o dsc base64.o  generic_counter.o  pcap.o  ncap.o  dns_protocol.o
> >>dns_message.o  ip_message.o  daemon.o  md_array.o  null_index.o
> >>qtype_index.o  qclass_index.o  tld_index.o  country_index.o
> >>rcode_index.o  qnamelen_index.o  qname_index.o  msglen_index.o
> >>client_ipv4_addr_index.o  client_ipv4_net_index.o
> >>md_array_xml_printer.o  ip_direction_index.o  ip_proto_index.o
> >>ip_version_index.o  certain_qnames_index.o  query_classification_index.o
> >>idn_qname_index.o  edns_version_index.o  edns_bufsiz_index.o
> >>do_bit_index.o  rd_bit_index.o  tc_bit_index.o  qr_aa_bits_index.o
> >>opcode_index.o  transport_index.o  dns_ip_version_index.o
> >>dns_source_port_index.o  ParseConfig.o  config_hooks.o  hashtbl.o
> >>lookup3.o  xmalloc.o  inX_addr.o  -L/usr/local/lib/libbind    -lpcap
> >>             ../TmfBase/Hapy/src/.libs/libHapy.a
> >>dns_protocol.o: In function `grok_question':
> >>/root/dsc/l/dsc-201502251630/collector/dsc/dns_protocol.c:93: warning:
> >>warning: strcpy() is almost always misused, please use strlcpy()
> >>pcap.o: In function `handle_tcp':
> >>/root/dsc/l/dsc-201502251630/collector/dsc/pcap.c:552: warning:
> >>warning: sprintf() is often misused, please use snprintf()
> >>query_classification_index.o: In function `a_for_a':
> >>
> >>/root/dsc/l/dsc-201502251630/collector/dsc/query_classification_index.c:71:
> >>undefined reference to `__inet_aton'
> >>inX_addr.o: In function `inXaddr_ntop':
> >>/root/dsc/l/dsc-201502251630/collector/dsc/inX_addr.c:28: undefined
> >>reference to `__inet_ntop'
> >>/root/dsc/l/dsc-201502251630/collector/dsc/inX_addr.c:31: undefined
> >>reference to `__inet_ntop'
> >>inX_addr.o: In function `inXaddr_pton':
> >>/root/dsc/l/dsc-201502251630/collector/dsc/inX_addr.c:41: undefined
> >>reference to `__inet_pton'
> >>/root/dsc/l/dsc-201502251630/collector/dsc/inX_addr.c:45: undefined
> >>reference to `__inet_pton'
> >>collect2: ld returned 1 exit status
> >>*** Error 1 in /root/dsc/l/dsc-201502251630/collector/dsc (Makefile:65
> >>'dsc')
> >>
> >>For example text around query_classification_index.c:71 reads like this
> >>
> >>static int
> >>a_for_a(const dns_message * m)
> >>{
> >>     struct in_addr a;
> >>     if (m->qtype != T_A)
> >>         return 0;
> >>     if (inet_aton(m->qname, &a))
> >>         return CLASS_A_FOR_A;
> >>     return 0;
> >>}
> >>
> >>I would be very thankful if you could point to me how to solve it and
> >>progress from here to ./dsc binary.
> >>
> >>
> >>Imre
> >>
> >>PS I searched ports collection for similarities and actually found file
> >>
> >>/usr/ports/pobj/dnstop-20140915/dnstop-20140915/inX_addr.c
> >>
> >>which is very similar to
> >>
> >>/root/dsc/l/dsc-201502251630/collector/dsc/inX_addr.c
> >>
> >>and has some inet_* funtsions in it. dnstop from ports compiles and
> >>runs fine. So i think i must be missing something obvious here. Needless
> >>to say i cant compile and read source but still i try to be attentive to
> >>your answer! :)
> >>
> >>
> >
> >You're going to need some things like
> >
> >(cflags/cxxflags)
> >-nostdinc -I/usr/local/include/bind -I/usr/include -I/usr/local/include
> >
> >(ldflags)
> >-L/usr/local/lib/libbind -Wl,-rpath,/usr/local/lib/libbind
> >
> >It may still not work, the BIND resolver and the system resolver have
> >conflicts in some areas. Some programs work like this, but it's more
> >luck than anything else.
> >
> >Alternatively try looking at old versions, they have some code to
> >support OpenBSD's resolver, but it's not clear whether it was
> >unfinished, or whether it used to work and got broken with updates.
> 
> Thank you for the answer, i tried like this and with every dsc .tgz listed
> 
> # ./configure CFLAGS="-nostdinc -I/usr/local/include/bind -I/usr/include
> -I/usr/local/include" LDFLAGS="-L/usr/local/lib/libbind
> -Wl,-rpath,/usr/local/lib/libbind"
> 
> but got same result. I decided to write to dsc-users list and referred to
> here, and good people there reacted and said they will soon look at it and
> most probably can sort it out
> 
> https://lists.dns-oarc.net/pipermail/dsc-users/2016-February/000005.html
>
> I am in no position to expect a solution but of course i would be glad if
> one comes along. I will let know how it goes.

[oliver@daphne] ~/dsc/collector/dsc $ svn diff
Index: inX_addr.c
===================================================================
--- inX_addr.c  (revision 2210)
+++ inX_addr.c  (working copy)
@@ -3,7 +3,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <arpa/inet.h>
+#include "/usr/include/arpa/inet.h"
 #include <string.h>
 
 #include "inX_addr.h"
Index: query_classification_index.c
===================================================================
--- query_classification_index.c        (revision 2210)
+++ query_classification_index.c        (working copy)
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <arpa/nameser.h>
+#include "/usr/include/arpa/inet.h" 
 
 /* OpenBSD does not have nameser_compat.h */
 #ifdef __OpenBSD__
[oliver@daphne] ~/dsc/collector/dsc $ file dsc
dsc: ELF 64-bit LSB shared object, x86-64, version 1

/usr/local/include/bind/arpa/inet.h might be causing that conflict,
patch above works for me but still sucks.


-- 
Oliver PETER       oli...@gfuzz.de       0x456D688F

Reply via email to