diff options
author | melifaro <melifaro@FreeBSD.org> | 2014-07-28 19:01:25 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2014-07-28 19:01:25 +0000 |
commit | fa3f38a6a0f5431577dbb7d336d2468cd60edab8 (patch) | |
tree | fb3bd0df0e64c28992f517fedc78a93ce0002cca /sbin/ipfw/tables.c | |
parent | 505e5ae08158dae524fad92308b69c209a5f69d9 (diff) | |
download | FreeBSD-src-fa3f38a6a0f5431577dbb7d336d2468cd60edab8.zip FreeBSD-src-fa3f38a6a0f5431577dbb7d336d2468cd60edab8.tar.gz |
* Add generic ipfw interface tracking API
* Rewrite interface tables to use interface indexes
Kernel changes:
* Add generic interface tracking API:
- ipfw_iface_ref (must call unlocked, performs lazy init if needed, allocates
state & bumps ref)
- ipfw_iface_add_ntfy(UH_WLOCK+WLOCK, links comsumer & runs its callback to
update ifindex)
- ipfw_iface_del_ntfy(UH_WLOCK+WLOCK, unlinks consumer)
- ipfw_iface_unref(unlocked, drops reference)
Additionally, consumer callbacks are called in interface withdrawal/departure.
* Rewrite interface tables to use iface tracking API. Currently tables are
implemented the following way:
runtime data is stored as sorted array of {ifidx, val} for existing interfaces
full data is stored inside namedobj instance (chained hashed table).
* Add IP_FW_XIFLIST opcode to dump status of tracked interfaces
* Pass @chain ptr to most non-locked algorithm callbacks:
(prepare_add, prepare_del, flush_entry ..). This may be needed for better
interaction of given algorithm an other ipfw subsystems
* Add optional "change_ti" algorithm handler to permit updating of
cached table_info pointer (happens in case of table_max resize)
* Fix small bug in ipfw_list_tables()
* Add badd (insert into sorted array) and bdel (remove from sorted array) funcs
Userland changes:
* Add "iflist" cmd to print status of currently tracked interface
* Add stringnum_cmp for better interface/table names sorting
Diffstat (limited to 'sbin/ipfw/tables.c')
-rw-r--r-- | sbin/ipfw/tables.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index c0393e1..bd46dc3 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -767,19 +767,11 @@ static int tablename_cmp(const void *a, const void *b) { ipfw_xtable_info *ia, *ib; - int la, lb; ia = (ipfw_xtable_info *)a; ib = (ipfw_xtable_info *)b; - la = strlen(ia->tablename); - lb = strlen(ib->tablename); - if (la > lb) - return (1); - else if (la < lb) - return (-01); - - return (strcmp(ia->tablename, ib->tablename)); + return (stringnum_cmp(ia->tablename, ib->tablename)); } /* |