Adding rdataset to a List

Jun Xiang X Tee jtee at
Fri Jul 1 02:56:48 UTC 2016

Dear all,

  I set up named server, and my dig client can connect to the server successfully. For a UDP packet, I wish to add an artificial rdataset to name list of Additional Section. Note that this question may look similar to my previous posts, but it is a total different question (I have solved the old questions):

  This is all I wrote so far:

        dns_message_t *msg = client->message;
        dns_namelist_t *section = &msg->sections[DNS_SECTION_ADDITIONAL];
        dns_name_t *name = ISC_LIST_HEAD(*section);

        if(name != NULL) {
                dns_rdata_t myrdata = DNS_RDATA_INIT;
                dns_rdataset_t myrdataset;
                dns_rdatalist_t myrdatalist;


                myrdatalist.rdclass = dns_rdataclass_in;
                myrdatalist.type = dns_rdatatype_txt;
                myrdatalist.ttl = 0;

                unsigned char mydata[] = "abc";
       = (unsigned char *)mydata;
                myrdata.length = 4;
                myrdata.rdclass = dns_rdataclass_in;
                myrdata.type = dns_rdatatype_txt;

                RUNTIME_CHECK(dns_rdatalist_tordataset(&myrdatalist, &myrdataset) == ISC_R_SUCCESS);

                ISC_LIST_PREPEND(name->list, &myrdataset, link); //segmentation fault!

  I am able to compile successfully without any warning. There was a segmentation fault happened due to ISC_LIST_APPEND. Does anyone have an idea of the error?

  I apologize if this question should not be asked here. If so, can anyone point me to a forum for asking the question? Thanks!

Jun Xiang Tee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the bind-users mailing list