Do not return EINVAL when user does ipfw set N flush on an empty set.

MFC after:	2 weeks
This commit is contained in:
Andrey V. Elsukov 2011-06-06 10:39:38 +00:00
parent 23be782526
commit 1e587bfa32
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222742

View File

@ -349,12 +349,13 @@ del_entry(struct ip_fw_chain *chain, uint32_t arg)
}
if (n == 0) {
/* A flush request (arg == 0) on empty ruleset
* returns with no error. On the contrary,
/* A flush request (arg == 0 or cmd == 1) on empty
* ruleset returns with no error. On the contrary,
* if there is no match on a specific request,
* we return EINVAL.
*/
error = (arg == 0) ? 0 : EINVAL;
if (arg != 0 && cmd != 1)
error = EINVAL;
break;
}