//fprintf (stderr, "making query %s\n", tIP->IP); fflush(stderr);
if (lwres_context_create(&ctx, NULL, NULL, NULL, 0) != 0) {
fprintf (stderr, "Couldn't create context\n");
//fprintf (stderr, "making query %s\n", tIP->IP); fflush(stderr);
if (lwres_context_create(&ctx, NULL, NULL, NULL, 0) != 0) {
fprintf (stderr, "Couldn't create context\n");
} else {
lwres_conf_parse(ctx, lwres_resolv_conf);
//pthread_mutex_lock(mutexoutput);
} else {
lwres_conf_parse(ctx, lwres_resolv_conf);
//pthread_mutex_lock(mutexoutput);
- n = lwres_getrdatabyname(ctx, tIP->IP, ns_c_in, ns_t_a, 0, &response);
+ n = lwres_getrdatabyname(ctx, tIP->IP, ns_c_in, ns_t_a, 0, &response);
- if (n == LWRES_R_SUCCESS) {
- printf ("%s,%d.%d.%d.%d,%d\n", tIP->IP,
- response->rdatas[0][0], response->rdatas[0][1],
- response->rdatas[0][2], response->rdatas[0][3],
- response->ttl);
- //fprintf (stderr, "freeing response\n"); fflush(stderr);
- lwres_grbnresponse_free(ctx, &response);
- } else {
- //fprintf (stderr, "Nothing found\n");
+ if (n == LWRES_R_SUCCESS) {
+ printf ("%s,%d.%d.%d.%d,%d\n", tIP->IP,
+ response->rdatas[0][0], response->rdatas[0][1],
+ response->rdatas[0][2], response->rdatas[0][3],
+ response->ttl);
+ //fprintf (stderr, "freeing response\n"); fflush(stderr);
+ lwres_grbnresponse_free(ctx, &response);
+ } else {
+ //fprintf (stderr, "Nothing found\n");
printf ("%s, %s, %d\n", tIP->IP, tIP->IP, defttl);
printf ("%s, %s, %d\n", tIP->IP, tIP->IP, defttl);
- }
- //fprintf (stderr, "freeing context\n"); fflush(stderr);
- lwres_context_destroy(&ctx);
- //fprintf (stderr, "done freeing\n"); fflush(stderr);
+ }
+ //fprintf (stderr, "freeing context\n"); fflush(stderr);
+ lwres_context_destroy(&ctx);
+ //fprintf (stderr, "done freeing\n"); fflush(stderr);
dnsrbls[numrbls] = (char *) malloc(strlen(instr)+1);
if (dnsrbls[numrbls] == NULL) {
fprintf (stderr, "Couldn't allocate memory for %d DNS RBLs\n", numrbls);
dnsrbls[numrbls] = (char *) malloc(strlen(instr)+1);
if (dnsrbls[numrbls] == NULL) {
fprintf (stderr, "Couldn't allocate memory for %d DNS RBLs\n", numrbls);
tIP = (iplist)malloc(sizeof(struct ipnode));
tIP->IP = (char *)malloc(strlen(instr)+strlen(dnsrbls[loop1])+2);
strcpy (tIP->IP, instr);
tIP = (iplist)malloc(sizeof(struct ipnode));
tIP->IP = (char *)malloc(strlen(instr)+strlen(dnsrbls[loop1])+2);
strcpy (tIP->IP, instr);
for (loop1 = 0; ((loop1<MAXTHREADS) && (loop1<numqueries)); loop1++) {
if (pthread_create(&threads[loop1], NULL,
(void *) do_queries, NULL) != 0) {
for (loop1 = 0; ((loop1<MAXTHREADS) && (loop1<numqueries)); loop1++) {
if (pthread_create(&threads[loop1], NULL,
(void *) do_queries, NULL) != 0) {