diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-04-26 10:53:35 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-04-26 10:53:35 +0000 |
commit | bf6ce87002c3a5f1c9946e1c513ca3b06fe3e1eb (patch) | |
tree | e1643ea5a62b4fe3504a32818d8af218a7ae75a6 /sbin/ipfw/tables.c | |
parent | bc06730b948e6316b517efe6b0b3ae5f29d29089 (diff) | |
download | FreeBSD-src-bf6ce87002c3a5f1c9946e1c513ca3b06fe3e1eb.zip FreeBSD-src-bf6ce87002c3a5f1c9946e1c513ca3b06fe3e1eb.tar.gz |
Generalize object reference handling in ipfw rules.
No ABI changes.
Diffstat (limited to 'sbin/ipfw/tables.c')
-rw-r--r-- | sbin/ipfw/tables.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 4ea5b7b..08f4731 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -1937,73 +1937,6 @@ ipfw_list_values(int ac, char *av[]) } int -compare_ntlv(const void *_a, const void *_b) -{ - ipfw_obj_ntlv *a, *b; - - a = (ipfw_obj_ntlv *)_a; - b = (ipfw_obj_ntlv *)_b; - - if (a->set < b->set) - return (-1); - else if (a->set > b->set) - return (1); - - if (a->idx < b->idx) - return (-1); - else if (a->idx > b->idx) - return (1); - - return (0); -} - -int -compare_kntlv(const void *k, const void *v) -{ - ipfw_obj_ntlv *ntlv; - uint16_t key; - - key = *((uint16_t *)k); - ntlv = (ipfw_obj_ntlv *)v; - - if (key < ntlv->idx) - return (-1); - else if (key > ntlv->idx) - return (1); - - return (0); -} - -/* - * Finds table name in @ctlv by @idx. - * Uses the following facts: - * 1) All TLVs are the same size - * 2) Kernel implementation provides already sorted list. - * - * Returns table name or NULL. - */ -char * -table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx) -{ - ipfw_obj_ntlv *ntlv; - - ntlv = bsearch(&idx, (ctlv + 1), ctlv->count, ctlv->objsize, - compare_kntlv); - - if (ntlv != 0) - return (ntlv->name); - - return (NULL); -} - -void -table_sort_ctlv(ipfw_obj_ctlv *ctlv) -{ - - qsort(ctlv + 1, ctlv->count, ctlv->objsize, compare_ntlv); -} - -int table_check_name(char *tablename) { int c, i, l; |