44 |
#include <stdlib.h> |
#include <stdlib.h> |
45 |
#include <sys/time.h> |
#include <sys/time.h> |
46 |
#include <time.h> |
#include <time.h> |
47 |
|
#include <sys/types.h> |
48 |
|
#include <sys/socket.h> |
49 |
|
#include <netinet/in.h> |
50 |
|
#include <arpa/inet.h> |
51 |
|
|
52 |
#include "irc.h" |
#include "irc.h" |
53 |
#include "negcache.h" |
#include "negcache.h" |
199 |
*/ |
*/ |
200 |
void negcache_insert(const char *ipstr) |
void negcache_insert(const char *ipstr) |
201 |
{ |
{ |
202 |
struct bopm_sockaddr ip; |
struct sockaddr_in ip; |
203 |
struct cnode *n; |
struct cnode *n; |
204 |
|
|
205 |
if (inet_pton(AF_INET, ipstr, &(ip.sa4.sin_addr)) <= 0) |
if (inet_pton(AF_INET, ipstr, &ip.sin_addr) <= 0) |
206 |
{ |
{ |
207 |
log_printf("NEGCACHE -> Invalid IPv4 address '%s'", ipstr); |
log_printf("NEGCACHE -> Invalid IPv4 address '%s'", ipstr); |
208 |
return; |
return; |
209 |
} |
} |
210 |
|
|
211 |
n = nc_insert(nc_head, ip.sa4.sin_addr.s_addr); |
n = nc_insert(nc_head, ip.sin_addr.s_addr); |
212 |
|
|
213 |
if (n) |
if (n) |
214 |
n->seen = time(NULL); |
n->seen = time(NULL); |