Deleted Added
sdiff udiff text old ( 272840 ) new ( 273274 )
full compact
1/*-
2 * Copyright (c) 2004 Ruslan Ermilov and Vsevolod Lobko.
3 * Copyright (c) 2014 Yandex LLC
4 * Copyright (c) 2014 Alexander V. Chernikov
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/netpfil/ipfw/ip_fw_table.c 272840 2014-10-09 19:32:35Z melifaro $");
30
31/*
32 * Lookup table support for ipfw.
33 *
34 * This file contains handlers for all generic tables' operations:
35 * add/del/flush entries, list/dump tables etc..
36 *
37 * Table data modification is protected by both UH and runtime lock

--- 1446 unchanged lines hidden (view full) ---

1484 ipfw_unref_table_values(ch, tc, tc->ta, tc->astate, &tc->ti_copy);
1485 IPFW_UH_WUNLOCK(ch);
1486
1487 free_table_config(ni, tc);
1488
1489 return (0);
1490}
1491
1492/*
1493 * Grow tables index.
1494 *
1495 * Returns 0 on success.
1496 */
1497int
1498ipfw_resize_tables(struct ip_fw_chain *ch, unsigned int ntables)
1499{
1500 unsigned int ntables_old, tbl;
1501 struct namedobj_instance *ni;
1502 void *new_idx, *old_tablestate, *tablestate;
1503 struct table_info *ti;
1504 struct table_config *tc;
1505 int i, new_blocks;
1506
1507 /* Check new value for validity */
1508 if (ntables > IPFW_TABLES_MAX)
1509 ntables = IPFW_TABLES_MAX;
1510
1511 /* Allocate new pointers */
1512 tablestate = malloc(ntables * sizeof(struct table_info),
1513 M_IPFW, M_WAITOK | M_ZERO);
1514
1515 ipfw_objhash_bitmap_alloc(ntables, (void *)&new_idx, &new_blocks);
1516
1517 IPFW_UH_WLOCK(ch);

--- 2138 unchanged lines hidden ---