diff options
-rw-r--r-- | daemon/fromd/ip_desc_db.c | 3 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/daemon/fromd/ip_desc_db.c b/daemon/fromd/ip_desc_db.c index bd1b85d6..1870a9d3 100644 --- a/daemon/fromd/ip_desc_db.c +++ b/daemon/fromd/ip_desc_db.c @@ -91,9 +91,10 @@ int ip_desc_db_reload(const char * cfgfile) const char * ip_desc_db_lookup(const char * ip) { int i; + uint32_t ipaddr = htonl(ipstr2int(ip)); for (i = 0; i < db_len; i++) { - if (db[i].network == (htonl(ipstr2int(ip)) & db[i].netmask)) { + if (db[i].network == (ipaddr & db[i].netmask)) { return db[i].desc; } } diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 1deaee01..4ae920a4 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -924,9 +924,10 @@ static int where(const char *from) { int i; + uint32_t ipaddr = ipstr2int(from); for (i = 0; i < SHM->home_num; i++) { - if ((SHM->home_ip[i] & SHM->home_mask[i]) == (ipstr2int(from) & SHM->home_mask[i])) { + if ((SHM->home_ip[i] & SHM->home_mask[i]) == (ipaddr & SHM->home_mask[i])) { return i; } } |