FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Checks if we're able to insert/update entry @tei into table
 * w.r.t @tc limits.
 * May alter @tei to indicate insertion error / insert
 * options.
 *
 * Returns 0 if operation can be performed/
 */
Checks if we're able to insert/update entry @tei into table
w.r.t @tc limits.
May alter @tei to indicate insertion error / insert
options.

Returns 0 if operation can be performed
Checks if we ' re able to insert / update entry @tei into table w . r . t @tc limits . May alter @tei to indicate insertion error / insert options . Returns 0 if operation can be performed
static int
check_table_limit(struct table_config *tc, struct tentry_info *tei)
{
	if (tc->limit == 0 || tc->count < tc->limit)
		return (0);
	if ((tei->flags & TEI_FLAGS_UPDATE) == 0) {
		tei->flags |= TEI_FLAGS_LIMIT;
		return (EFBIG);
	}
	tei->flags |= TEI_FLAGS_DONTADD;
	return (0);
}
static int check_table_limit ( struct table_config * tc , struct tentry_info * tei ) { if ( tc -> limit == 0 || tc -> count < tc -> limit ) return ( 0 ) ; if ( ( tei -> flags & TEI_FLAGS_UPDATE ) == 0 ) { tei -> flags |= TEI_FLAGS_LIMIT ; return ( EFBIG ) ; } tei -> flags |= TEI_FLAGS_DONTADD ; return ( 0 ) ; }
Checks if we're able to insert/update entry @tei into table
 w.r.t @tc limits.
Checks if we ' re able to insert / update entry @tei into table w . r . t @tc limits .
/* Notify userland on error cause */ /*
	 * We have UPDATE flag set.
	 * Permit updating record (if found),
	 * but restrict adding new one since we've
	 * already hit the limit.
	 */