Validate IPv4 network mask being passed to ipfw kernel interface.

Incorrect mask can possibly be one of the reasons for kern/127209 existance.

Approved by:        kib(mentor)
MFC after:          3 days
This commit is contained in:
melifaro 2012-06-09 17:39:05 +00:00
parent 6a57329c6f
commit 76ab178d5a

View File

@ -153,6 +153,9 @@ ipfw_add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
case IPFW_TABLE_CIDR:
if (plen == sizeof(in_addr_t)) {
#ifdef INET
/* IPv4 case */
if (mlen > 32)
return (EINVAL);
ent = malloc(sizeof(*ent), M_IPFW_TBL, M_WAITOK | M_ZERO);
ent->value = value;
/* Set 'total' structure length */