diff options
author | 2022-01-09 22:20:35 -0500 | |
---|---|---|
committer | 2022-01-09 22:20:35 -0500 | |
commit | 55b986d253fcae830d4a5daeaee6b1a784bebef0 (patch) | |
tree | a85eb60ecba674771e5dc35dbc39b5ccf5ea400d /src/fnettrace/hostnames.c | |
parent | Merge branch 'master' of ssh://github.com/netblue30/firejail (diff) | |
download | firejail-55b986d253fcae830d4a5daeaee6b1a784bebef0.tar.gz firejail-55b986d253fcae830d4a5daeaee6b1a784bebef0.tar.zst firejail-55b986d253fcae830d4a5daeaee6b1a784bebef0.zip |
nettrace
Diffstat (limited to 'src/fnettrace/hostnames.c')
-rw-r--r-- | src/fnettrace/hostnames.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fnettrace/hostnames.c b/src/fnettrace/hostnames.c index e1ad45f81..733d13853 100644 --- a/src/fnettrace/hostnames.c +++ b/src/fnettrace/hostnames.c | |||
@@ -21,8 +21,14 @@ | |||
21 | #include "radix.h" | 21 | #include "radix.h" |
22 | #define MAXBUF 1024 | 22 | #define MAXBUF 1024 |
23 | 23 | ||
24 | int geoip_calls = 0; | ||
25 | static int geoip_not_found = 0; | ||
24 | 26 | ||
25 | char *retrieve_hostname(uint32_t ip) { | 27 | char *retrieve_hostname(uint32_t ip) { |
28 | if (geoip_not_found) | ||
29 | return NULL; | ||
30 | geoip_calls++; | ||
31 | |||
26 | char *rv = NULL; | 32 | char *rv = NULL; |
27 | char *cmd; | 33 | char *cmd; |
28 | if (asprintf(&cmd, "/usr/bin/geoiplookup %d.%d.%d.%d", PRINT_IP(ip)) == -1) | 34 | if (asprintf(&cmd, "/usr/bin/geoiplookup %d.%d.%d.%d", PRINT_IP(ip)) == -1) |
@@ -47,6 +53,10 @@ char *retrieve_hostname(uint32_t ip) { | |||
47 | fclose(fp); | 53 | fclose(fp); |
48 | return rv; | 54 | return rv; |
49 | } | 55 | } |
56 | else | ||
57 | geoip_not_found = 1; | ||
58 | |||
59 | free(cmd); | ||
50 | 60 | ||
51 | return NULL; | 61 | return NULL; |
52 | } | 62 | } |