ip_fw_table_value.c (298016) | ip_fw_table_value.c (298995) |
---|---|
1/*- 2 * Copyright (c) 2014 Yandex LLC 3 * Copyright (c) 2014 Alexander V. Chernikov 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2014 Yandex LLC 3 * Copyright (c) 2014 Alexander V. Chernikov 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/netpfil/ipfw/ip_fw_table_value.c 298016 2016-04-14 22:51:23Z ae $"); | 28__FBSDID("$FreeBSD: head/sys/netpfil/ipfw/ip_fw_table_value.c 298995 2016-05-03 18:05:43Z pfg $"); |
29 30/* 31 * Multi-field value support for ipfw tables. 32 * 33 * This file contains necessary functions to convert 34 * large multi-field values into u32 indices suitable to be fed 35 * to various table algorithms. Other machinery like proper refcounting, 36 * internal structures resizing are also kept here. --- 458 unchanged lines hidden (view full) --- 495 found = 0; 496 vlimit = ts->ta->vlimit; 497 vidx = 0; 498 tc = ts->tc; 499 tei = ts->tei; 500 count = ts->count; 501 for (i = 0; i < count; i++) { 502 ptei = &tei[i]; | 29 30/* 31 * Multi-field value support for ipfw tables. 32 * 33 * This file contains necessary functions to convert 34 * large multi-field values into u32 indices suitable to be fed 35 * to various table algorithms. Other machinery like proper refcounting, 36 * internal structures resizing are also kept here. --- 458 unchanged lines hidden (view full) --- 495 found = 0; 496 vlimit = ts->ta->vlimit; 497 vidx = 0; 498 tc = ts->tc; 499 tei = ts->tei; 500 count = ts->count; 501 for (i = 0; i < count; i++) { 502 ptei = &tei[i]; |
503 ptei->value = 0; /* Ensure value is always 0 in the beginnig */ | 503 ptei->value = 0; /* Ensure value is always 0 in the beginning */ |
504 mask_table_value(ptei->pvalue, &tval, ts->vmask); 505 ptv = (struct table_val_link *)ipfw_objhash_lookup_name(vi, 0, 506 (char *)&tval); 507 if (ptv == NULL) 508 continue; 509 /* Deal with vlimit later */ 510 if (vlimit > 0 && vlimit <= ptv->no.kidx) 511 continue; --- 86 unchanged lines hidden (view full) --- 598 pval[vidx].refcnt = 1; 599 ipfw_objhash_add(vi, &ptv->no); 600 } 601 602 return (0); 603} 604 605/* | 504 mask_table_value(ptei->pvalue, &tval, ts->vmask); 505 ptv = (struct table_val_link *)ipfw_objhash_lookup_name(vi, 0, 506 (char *)&tval); 507 if (ptv == NULL) 508 continue; 509 /* Deal with vlimit later */ 510 if (vlimit > 0 && vlimit <= ptv->no.kidx) 511 continue; --- 86 unchanged lines hidden (view full) --- 598 pval[vidx].refcnt = 1; 599 ipfw_objhash_add(vi, &ptv->no); 600 } 601 602 return (0); 603} 604 605/* |
606 * Compability function used to import data from old | 606 * Compatibility function used to import data from old |
607 * IP_FW_TABLE_ADD / IP_FW_TABLE_XADD opcodes. 608 */ 609void 610ipfw_import_table_value_legacy(uint32_t value, struct table_value *v) 611{ 612 613 memset(v, 0, sizeof(*v)); 614 v->tag = value; --- 192 unchanged lines hidden --- | 607 * IP_FW_TABLE_ADD / IP_FW_TABLE_XADD opcodes. 608 */ 609void 610ipfw_import_table_value_legacy(uint32_t value, struct table_value *v) 611{ 612 613 memset(v, 0, sizeof(*v)); 614 v->tag = value; --- 192 unchanged lines hidden --- |