Skip to content

Commit

Permalink
Look for the TTL value
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Mar 22, 2013
1 parent e0e6e23 commit 0229c88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ package unbound
#include <stdlib.h>
#include <stdio.h>
#include <unbound.h>
#define offsetof(type, member) __builtin_offsetof (type, member)
int array_elem_int(int *l, int i) { return l[i]; }
char * array_elem_char(char **l, int i) { if (l == NULL) return NULL; return l[i]; }
Expand All @@ -45,7 +46,8 @@ struct ub_result *new_ub_result() {
}
int ub_ttl(struct ub_result *r) {
int *p;
p = (int*) ((unsigned char*)r + sizeof(*r) - 2*sizeof(int));
// Go to why_bogus add the pointer and then we will find the ttl, hopefully.
p = (int*) ((char*)r + offsetof(struct ub_result, why_bogus) + sizeof(char*));
return (int)*p;
}
*/
Expand Down

0 comments on commit 0229c88

Please sign in to comment.