fix update_portmapping() missing target when update filter table

This commit is contained in:
Chen Minqiang 2020-04-21 20:49:59 +08:00
parent fca45a6773
commit b44e5e7a83
1 changed files with 5 additions and 1 deletions

View File

@ -1710,7 +1710,7 @@ update_portmapping(const char * ifname, unsigned short eport, int proto,
const struct ipt_entry * e;
struct ipt_entry * new_e = NULL;
size_t entry_len;
const struct ipt_entry_target * target;
struct ipt_entry_target * target;
struct ip_nat_multi_range * mr;
const struct ipt_entry_match *match;
uint32_t iaddr = 0;
@ -1853,6 +1853,10 @@ update_portmapping(const char * ifname, unsigned short eport, int proto,
r = -1;
} else {
memcpy(new_e, e, entry_len);
target = (void *)new_e + new_e->target_offset;
if (target->u.user.name[0] == '\0' && iptc_get_target(e, h)) {
strncpy(target->u.user.name, iptc_get_target(e, h), sizeof(target->u.user.name));
}
}
break;
}