requestlist requests;
insp_inaddr myserver;
static int MasterSocket;
+ int currid;
Resolver* Classes[MAX_REQUEST_ID];
int MakePayload(const char* name, const QueryType rr, const unsigned short rr_class, unsigned char* payload);
/* Add a query with a predefined header, and allocate an ID for it. */
DNSRequest* DNS::AddQuery(DNSHeader *header, int &id)
{
- id = rand() % 65536;
+ id = this->currid++;
+ this->currid &= 0xFFFF;
+
DNSRequest* req = new DNSRequest(this->myserver);
header->id[0] = req->id[0] = id >> 8;
/* Clear the Resolver class table */
memset(Classes,0,sizeof(Classes));
- /* Seed random number generator, we use this to generate
- * dns packet id's
+ /* Set the id of the next request to 0
*/
- srand((unsigned int)time(NULL));
+ currid = 0;
/* Clear the namesever address */
memset(&myserver,0,sizeof(insp_inaddr));