diff --git a/miniupnpd/upnppermissions.c b/miniupnpd/upnppermissions.c index 75a7adf..4a96db4 100644 --- a/miniupnpd/upnppermissions.c +++ b/miniupnpd/upnppermissions.c @@ -265,7 +265,7 @@ check_upnp_rule_against_permissions(const struct upnpperm * permary, void get_permitted_ext_ports(uint32_t * allowed, const struct upnpperm * permary, int n_perms, - struct in_addr address, u_short iport) + in_addr_t addr, u_short iport) { int i, j; @@ -274,7 +274,7 @@ get_permitted_ext_ports(uint32_t * allowed, for (i = n_perms - 1; i >= 0; i--) { - if( (address.s_addr & permary[i].mask.s_addr) + if( (addr & permary[i].mask.s_addr) != (permary[i].address.s_addr & permary[i].mask.s_addr) ) continue; if( (iport < permary[i].iport_min) || (permary[i].iport_max < iport)) diff --git a/miniupnpd/upnppermissions.h b/miniupnpd/upnppermissions.h index 1fb100a..958e760 100644 --- a/miniupnpd/upnppermissions.h +++ b/miniupnpd/upnppermissions.h @@ -51,7 +51,7 @@ check_upnp_rule_against_permissions(const struct upnpperm * permary, void get_permitted_ext_ports(uint32_t * allowed, const struct upnpperm * permary, int n_perms, - struct in_addr address, u_short iport); + in_addr_t addr, u_short iport); #ifdef USE_MINIUPNPDCTL void diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c index 5ddad33..818c6d2 100644 --- a/miniupnpd/upnpsoap.c +++ b/miniupnpd/upnpsoap.c @@ -685,7 +685,7 @@ AddAnyPortMapping(struct upnphttp * h, const char * action, const char * ns) syslog(LOG_ERR, "inet_aton(%s) FAILED", int_ip); } get_permitted_ext_ports(allowed_eports, upnppermlist, num_upnpperm, - address, iport); + address.s_addr, iport); eport_above = eport_below = eport; for(;;) { /* loop invariant