<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear all,</p>
<p><br>
</p>
<p> 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):</p>
<p><br>
</p>
<p> This is all I wrote so far:</p>
<p><br>
</p>
<p></p>
<div> dns_message_t *msg = client->message;</div>
<div> dns_namelist_t *section = &msg->sections[DNS_SECTION_ADDITIONAL];</div>
<div> dns_name_t *name = ISC_LIST_HEAD(*section);</div>
<div><br>
</div>
<div> if(name != NULL) {</div>
<div> dns_rdata_t myrdata = DNS_RDATA_INIT;</div>
<div> dns_rdataset_t myrdataset;</div>
<div> dns_rdatalist_t myrdatalist;</div>
<div><br>
</div>
<div> dns_rdata_init(&myrdata);</div>
<div> dns_rdataset_init(&myrdataset);</div>
<div> dns_rdatalist_init(&myrdatalist);</div>
<div><br>
</div>
<div> myrdatalist.rdclass = dns_rdataclass_in;</div>
<div> myrdatalist.type = dns_rdatatype_txt;</div>
<div> myrdatalist.ttl = 0;</div>
<div><br>
</div>
<div> unsigned char mydata[] = "abc";</div>
<div> myrdata.data = (unsigned char *)mydata;</div>
<div> myrdata.length = 4;</div>
<div> myrdata.rdclass = dns_rdataclass_in;</div>
<div> myrdata.type = dns_rdatatype_txt;</div>
<div><br>
</div>
<div> RUNTIME_CHECK(dns_rdatalist_tordataset(&myrdatalist, &myrdataset) == ISC_R_SUCCESS);</div>
<div><br>
</div>
<div> ISC_LIST_PREPEND(name->list, &myrdataset, link); //segmentation fault!</div>
<div> }</div>
<div><br>
</div>
<div> 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?</div>
<div><br>
</div>
<div> I apologize if this question should not be asked here. If so, can anyone point me to a forum for asking the question? Thanks!</div>
<div><br>
</div>
<div>Regards,</div>
<div>Jun Xiang Tee</div>
<p></p>
<p> </p>
</div>
</body>
</html>