{
ldns_pkt *query_pkt;
ldns_pkt *answer_pkt;
+ uint16_t id;
assert(r != NULL);
assert(name != NULL);
printf("Failed to generate pkt\n");
return NULL;
}
+
+ /* TODO: time is a terrible seed */
+ srand((unsigned) time(NULL));
+ id = (uint16_t) rand();
+
+ ldns_pkt_set_id(query_pkt, id);
/* return NULL on error */
answer_pkt = ldns_send(r, query_pkt);
pkt = ldns_pkt_query_new(qname, ldns_get_rr_type_by_name(type), 0, LDNS_RD);
- ldns_pkt_set_id(pkt, 46789);
+ /* if you make packet yourself, set the id yourself */
+ /* you should not use time as the only seed */
+ srand((unsigned) time(NULL));
+ ldns_pkt_set_id(pkt, (uint16_t) rand());
ldns_pkt_tsig_sign(pkt, "jelte.", "vBUWJnkgDw4YTobXtbUD6XED5Qg74tnghYX3tzKzfsI=", 300, "hmac-md5.sig-alg.reg.int", NULL);
mac = ldns_rr_rdf(ldns_pkt_tsig(pkt), 3);