mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
Finally fix lookup (account remaining '\0') and deletion
(provide valid key length for radix lookup). Submitted by: Ihor Kaharlichenko<madkinder at gmail.com> (prev version) Approved by: kib(mentor) MFC after: 3 days Sponsored by: Shtorm ISP
This commit is contained in:
parent
a4156419ca
commit
30835e6d50
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238265
@ -344,9 +344,12 @@ ipfw_del_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
||||
struct xaddr_iface ifname, ifmask;
|
||||
memset(&ifname, 0, sizeof(ifname));
|
||||
|
||||
/* Include last \0 into comparison */
|
||||
mlen++;
|
||||
|
||||
/* Set 'total' structure length */
|
||||
KEY_LEN(ifname) = mlen;
|
||||
KEY_LEN(ifmask) = mlen;
|
||||
KEY_LEN(ifname) = KEY_LEN_IFACE + mlen;
|
||||
KEY_LEN(ifmask) = KEY_LEN_IFACE + mlen;
|
||||
/* Assume direct match */
|
||||
/* FIXME: Add interface pattern matching */
|
||||
#if 0
|
||||
@ -569,7 +572,7 @@ ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
||||
|
||||
case IPFW_TABLE_INTERFACE:
|
||||
KEY_LEN(iface) = KEY_LEN_IFACE +
|
||||
strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE);
|
||||
strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1;
|
||||
/* Assume direct match */
|
||||
/* FIXME: Add interface pattern matching */
|
||||
xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh));
|
||||
|
Loading…
Reference in New Issue
Block a user