summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/netflow
Commit message (Collapse)AuthorAgeFilesLines
* Fix style(9).jkim2016-05-261-2/+4
|
* Use bit_count(3) instead of four bitcount32() calls.jkim2016-05-261-18/+17
| | | | | Reviewed by: asomers, ngie Differential Revision: https://reviews.freebsd.org/D6543
* sys/netgraph: spelling fixes in comments.pfg2016-04-292-2/+2
| | | | No functional change.
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-101-1/+1
| | | | Found with devel/coccinelle.
* These files were getting sys/malloc.h and vm/uma.h with header pollutionglebius2016-02-013-0/+5
| | | | via sys/mbuf.h
* Make ng_netflow(9) use new routing KPI.melifaro2016-01-141-39/+61
| | | | | | | | | | | Netflow module is supposed to store (along with fields like gateway address and interface index) matched netmask for each record. This (currently) requires returning individual route entries, instead of optimized next-hop structure. Given that, use control-plane rib_lookup_info() function to avoid accessing rtentries directly. While rib_lookup_info() might be slower, than fibX_lookup() flavours, it is more scalable than rtalloc1_fib(), because rtentry mutex is not acquired.
* Remove sys/eventhandler.h from net/route.hmelifaro2016-01-093-0/+3
| | | | Reviewed by: ae
* Do not use 'struct route_in6' inside hash6_insert().melifaro2016-01-071-19/+13
| | | | | | rin6 was used only as sockaddr_in6 storage. Make rtalloc1_fib() use on-stack sin6 and return rtenry directly, instead of doing useless work with 'struct route_in6'.
* Fix route lookup condition: do IPv6 route lookup for source based onmelifaro2016-01-041-1/+1
| | | | NG_NETFLOW_CONF_NOSRCLOOKUP instead of NG_NETFLOW_CONF_NODSTLOOKUP.
* CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenjkim2015-05-221-1/+1
| | | | | | | | | | years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent. Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks
* Fix !INET6 build for various platforms.delphij2014-01-021-0/+2
|
* - Use counter(9) for node stats updated at a high rate.glebius2014-01-014-131/+135
| | | | | | | | | - Use simple ++ for rare events. - Use uma_zone_get_cur() to get knowledge about space left in cache. - Convert many fields of struct ng_netflow_info to 64 bit. Tested by: Viktor Velichkin <avisom yandex.ru> Sponsored by: Nginx, Inc.
* In sys/netgraph/netflow, use __FBSDID() instead of old-style rcs_id[].dim2013-12-293-6/+6
| | | | MFC after: 3 days
* The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareglebius2013-10-261-0/+1
| | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc.
* Make default cache size more modern.glebius2013-09-041-1/+1
| | | | Requested by: Slawa Olhovchenkov <slw zxy.spb.ru>
* Attempt to clean up spacing and long lines.glebius2013-04-121-98/+112
|
* Return ENOMEM if malloc() fails.glebius2013-03-261-1/+1
|
* Cleanup: wrap long lines, cleanup comments, etc.glebius2013-03-262-113/+141
|
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-052-2/+2
| | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually
* Add NG_NETFLOW_V9INFO_TYPE command to be able to request netflowv9-specificmelifaro2012-10-113-0/+56
| | | | | | | data. Submitted by: Dmitry Luhtionov <dmitryluhtionov at gmail.com> MFC after: 2 weeks
* Fix typo: s/unknow/unknownkevlo2012-10-091-1/+1
|
* Make radix lookup on src and dst flow addresses optionalmelifaro2012-06-183-92/+113
| | | | | | | | | | | | | and configurable on per-interface basis. Remove __inline__ for several functions being called once per flow (e.g once per 10-20 packets on common traffic flows). Update manual page to simplify search for BPF data link types. Sponsored by Yandex LLC Reviewed by: glebius Approved by: ae(mentor) MFC after: 2 weeks
* Simplify IP pointer recovery in case of mbuf reallocation.melifaro2012-06-181-53/+15
| | | | | | Reviewed by: glebius (previous version) Approved by: ae(mentor) MFC after: 2 weeks
* Use time_uptime instead of getnanotime for accouting integer number of seconds.melifaro2012-06-161-6/+4
| | | | | | Reviewed by: glebius Approved by: ae(mentor) MFC after: 1 week
* Set netflow v9 observation domain value to fib number instead of node id.melifaro2012-06-161-1/+1
| | | | | | | | This fixes multi-fib netflow v9 export. Reviewed by: glebius Approved by: kib(mentor) MFC after: 1 week
* Fix improper L4 header handling for IPv6 packets passed via DLT_RAW.melifaro2012-06-161-1/+1
| | | | | | | Reported by: Emil Muratov <gpm@hotplug.ru> Reviewed by: glebius Approved by: ae(mentor) MFC after: 1 week
* Use rt_numfibs variable instead of compile-time RT_NUMFIBS.melifaro2012-03-133-4/+13
| | | | | Reviewed by: glebius (previous version) Approved by: kib(mentor), ae(mentor)
* Add missing unlocks.glebius2011-07-061-0/+2
|
* o Eliminate flow6_hash_entry in favor of flow_hash_entry. We don't needglebius2011-07-053-107/+152
| | | | | | | | | | a separate struct to start a slist of semi-opaque structs. This makes some code more compact. o Rewrite ng_netflow_flow_show() and its API/ABI: - Support for IPv6 is added. - Request and response now use same struct. Structure specifies version (6 or 4), index of last retrieved hash, and also index of last retrieved entry in the hash entry.
* Fix double free.glebius2011-07-011-1/+0
| | | | Submitted by: Alexander V. Chernikov <melifaro ipfw.ru>
* ng_netflow_cache_init() can be void.glebius2011-04-183-7/+4
|
* Node constructor methods are supposed to be called in syscallglebius2011-04-181-4/+1
| | | | | | | context always. Convert nodes to consistently use M_WAITOK flag for memory allocation. Reviewed by: julian
* Unbreak the build for no options INET6.bz2011-03-032-0/+8
| | | | | PR: kern/155227 Submitted by: Dmitry Afanasiev (KOT MATPOCKuH.Ru)
* Add support for NetFlow version 9 into ng_netflow(4) node.glebius2011-03-026-132/+1739
| | | | Submitted by: Alexander V. Chernikov <melifaro ipfw.ru>
* Zero padding fields of netflow records. This helps to reduceglebius2010-07-261-0/+3
| | | | | | size of compressed export logs. Requested by: Alexey Illarionov <littlesavage orionet.ru>
* Remove disabled code. In 99% cases exports are send to ng_ksocket(4), whichglebius2010-03-251-9/+0
| | | | | already forces queued mode, so what was suggested in disabled code is already done.
* Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification.mav2009-05-131-1/+1
| | | | | | PR: kern/134220 Submitted by: Eugene Mychlo MFC after: 1 week
* This main goals of this project are:qingli2008-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. separating L2 tables (ARP, NDP) from the L3 routing tables 2. removing as much locking dependencies among these layers as possible to allow for some parallelism in the search operations 3. simplify the logic in the routing code, The most notable end result is the obsolescent of the route cloning (RTF_CLONING) concept, which translated into code reduction in both IPv4 ARP and IPv6 NDP related modules, and size reduction in struct rtentry{}. The change in design obsoletes the semantics of RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland applications such as "arp" and "ndp" have been modified to reflect those changes. The output from "netstat -r" shows only the routing entries. Quite a few developers have contributed to this project in the past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and Andre Oppermann. And most recently: - Kip Macy revised the locking code completely, thus completing the last piece of the puzzle, Kip has also been conducting active functional testing - Sam Leffler has helped me improving/refactoring the code, and provided valuable reviews - Julian Elischer setup the perforce tree for me and has helped me maintaining that branch before the svn conversion
* Fix a number of style issues in the MALLOC / FREE commit. I've tried todes2008-10-231-1/+1
| | | | | be careful not to fix anything that was already broken; the NFSv4 code is particularly bad in this respect.
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-232-5/+4
| | | | MFC after: 3 months
* Add ability to generate egress netflow instead or in addition to ingress.mav2008-10-083-20/+116
| | | | | | | | | | Use mbuf tagging for accounted packets to not account packets twice when both ingress and egress netflow enabled. To keep compatibility new "setconfig" message added to control new functionality. By default node works as before, doing only ingress accounting without using mbuf tags. Reviewed by: glebius
* Add code to allow the system to handle multiple routing tables.julian2008-05-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This particular implementation is designed to be fully backwards compatible and to be MFC-able to 7.x (and 6.x) Currently the only protocol that can make use of the multiple tables is IPv4 Similar functionality exists in OpenBSD and Linux. From my notes: ----- One thing where FreeBSD has been falling behind, and which by chance I have some time to work on is "policy based routing", which allows different packet streams to be routed by more than just the destination address. Constraints: ------------ I want to make some form of this available in the 6.x tree (and by extension 7.x) , but FreeBSD in general needs it so I might as well do it in -current and back port the portions I need. One of the ways that this can be done is to have the ability to instantiate multiple kernel routing tables (which I will now refer to as "Forwarding Information Bases" or "FIBs" for political correctness reasons). Which FIB a particular packet uses to make the next hop decision can be decided by a number of mechanisms. The policies these mechanisms implement are the "Policies" referred to in "Policy based routing". One of the constraints I have if I try to back port this work to 6.x is that it must be implemented as a EXTENSION to the existing ABIs in 6.x so that third party applications do not need to be recompiled in timespan of the branch. This first version will not have some of the bells and whistles that will come with later versions. It will, for example, be limited to 16 tables in the first commit. Implementation method, Compatible version. (part 1) ------------------------------- For this reason I have implemented a "sufficient subset" of a multiple routing table solution in Perforce, and back-ported it to 6.x. (also in Perforce though not always caught up with what I have done in -current/P4). The subset allows a number of FIBs to be defined at compile time (8 is sufficient for my purposes in 6.x) and implements the changes needed to allow IPV4 to use them. I have not done the changes for ipv6 simply because I do not need it, and I do not have enough knowledge of ipv6 (e.g. neighbor discovery) needed to do it. Other protocol families are left untouched and should there be users with proprietary protocol families, they should continue to work and be oblivious to the existence of the extra FIBs. To understand how this is done, one must know that the current FIB code starts everything off with a single dimensional array of pointers to FIB head structures (One per protocol family), each of which in turn points to the trie of routes available to that family. The basic change in the ABI compatible version of the change is to extent that array to be a 2 dimensional array, so that instead of protocol family X looking at rt_tables[X] for the table it needs, it looks at rt_tables[Y][X] when for all protocol families except ipv4 Y is always 0. Code that is unaware of the change always just sees the first row of the table, which of course looks just like the one dimensional array that existed before. The entry points rtrequest(), rtalloc(), rtalloc1(), rtalloc_ign() are all maintained, but refer only to the first row of the array, so that existing callers in proprietary protocols can continue to do the "right thing". Some new entry points are added, for the exclusive use of ipv4 code called in_rtrequest(), in_rtalloc(), in_rtalloc1() and in_rtalloc_ign(), which have an extra argument which refers the code to the correct row. In addition, there are some new entry points (currently called rtalloc_fib() and friends) that check the Address family being looked up and call either rtalloc() (and friends) if the protocol is not IPv4 forcing the action to row 0 or to the appropriate row if it IS IPv4 (and that info is available). These are for calling from code that is not specific to any particular protocol. The way these are implemented would change in the non ABI preserving code to be added later. One feature of the first version of the code is that for ipv4, the interface routes show up automatically on all the FIBs, so that no matter what FIB you select you always have the basic direct attached hosts available to you. (rtinit() does this automatically). You CAN delete an interface route from one FIB should you want to but by default it's there. ARP information is also available in each FIB. It's assumed that the same machine would have the same MAC address, regardless of which FIB you are using to get to it. This brings us as to how the correct FIB is selected for an outgoing IPV4 packet. Firstly, all packets have a FIB associated with them. if nothing has been done to change it, it will be FIB 0. The FIB is changed in the following ways. Packets fall into one of a number of classes. 1/ locally generated packets, coming from a socket/PCB. Such packets select a FIB from a number associated with the socket/PCB. This in turn is inherited from the process, but can be changed by a socket option. The process in turn inherits it on fork. I have written a utility call setfib that acts a bit like nice.. setfib -3 ping target.example.com # will use fib 3 for ping. It is an obvious extension to make it a property of a jail but I have not done so. It can be achieved by combining the setfib and jail commands. 2/ packets received on an interface for forwarding. By default these packets would use table 0, (or possibly a number settable in a sysctl(not yet)). but prior to routing the firewall can inspect them (see below). (possibly in the future you may be able to associate a FIB with packets received on an interface.. An ifconfig arg, but not yet.) 3/ packets inspected by a packet classifier, which can arbitrarily associate a fib with it on a packet by packet basis. A fib assigned to a packet by a packet classifier (such as ipfw) would over-ride a fib associated by a more default source. (such as cases 1 or 2). 4/ a tcp listen socket associated with a fib will generate accept sockets that are associated with that same fib. 5/ Packets generated in response to some other packet (e.g. reset or icmp packets). These should use the FIB associated with the packet being reponded to. 6/ Packets generated during encapsulation. gif, tun and other tunnel interfaces will encapsulate using the FIB that was in effect withthe proces that set up the tunnel. thus setfib 1 ifconfig gif0 [tunnel instructions] will set the fib for the tunnel to use to be fib 1. Routing messages would be associated with their process, and thus select one FIB or another. messages from the kernel would be associated with the fib they refer to and would only be received by a routing socket associated with that fib. (not yet implemented) In addition Netstat has been edited to be able to cope with the fact that the array is now 2 dimensional. (It looks in system memory using libkvm (!)). Old versions of netstat see only the first FIB. In addition two sysctls are added to give: a) the number of FIBs compiled in (active) b) the default FIB of the calling process. Early testing experience: ------------------------- Basically our (IronPort's) appliance does this functionality already using ipfw fwd but that method has some drawbacks. For example, It can't fully simulate a routing table because it can't influence the socket's choice of local address when a connect() is done. Testing during the generating of these changes has been remarkably smooth so far. Multiple tables have co-existed with no notable side effects, and packets have been routes accordingly. ipfw has grown 2 new keywords: setfib N ip from anay to any count ip from any to any fib N In pf there seems to be a requirement to be able to give symbolic names to the fibs but I do not have that capacity. I am not sure if it is required. SCTP has interestingly enough built in support for this, called VRFs in Cisco parlance. it will be interesting to see how that handles it when it suddenly actually does something. Where to next: -------------------- After committing the ABI compatible version and MFCing it, I'd like to proceed in a forward direction in -current. this will result in some roto-tilling in the routing code. Firstly: the current code's idea of having a separate tree per protocol family, all of the same format, and pointed to by the 1 dimensional array is a bit silly. Especially when one considers that there is code that makes assumptions about every protocol having the same internal structures there. Some protocols don't WANT that sort of structure. (for example the whole idea of a netmask is foreign to appletalk). This needs to be made opaque to the external code. My suggested first change is to add routing method pointers to the 'domain' structure, along with information pointing the data. instead of having an array of pointers to uniform structures, there would be an array pointing to the 'domain' structures for each protocol address domain (protocol family), and the methods this reached would be called. The methods would have an argument that gives FIB number, but the protocol would be free to ignore it. When the ABI can be changed it raises the possibilty of the addition of a fib entry into the "struct route". Currently, the structure contains the sockaddr of the desination, and the resulting fib entry. To make this work fully, one could add a fib number so that given an address and a fib, one can find the third element, the fib entry. Interaction with the ARP layer/ LL layer would need to be revisited as well. Qing Li has been working on this already. This work was sponsored by Ironport Systems/Cisco Reviewed by: several including rwatson, bz and mlair (parts each) Obtained from: Ironport systems/Cisco
* Replace callout_init(..., 1) with callout_init(..., CALLOUT_MPSAFE) forkris2008-04-161-1/+1
| | | | | | | better grep-compliance and to standardize with the rest of the kernel. Reviewed by: jhb MFC after: 1 week
* Use rtalloc1() instead of rtalloc_ign(). It returns a lockedglebius2008-02-071-24/+17
| | | | | | rtentry. We quickly copy the fields of interest, and then RTFREE_LOCKED(). This should be faster then lock & unlock the rtentry twice.
* Revert previous commit.mav2008-02-031-4/+8
| | | | glebius@ noticed that it was not a bug, but undocumented feature.
* Run expire even without export hook connected.mav2008-01-271-8/+4
| | | | PR: kern/119839
* Fix memory leak when export hook is not connected.mav2008-01-271-0/+2
|
* Remove one very strange unneded if.mav2008-01-271-7/+2
|
* Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, whichrwatson2007-08-061-1/+0
| | | | | | | | | | | | | | | previously conditionally acquired Giant based on debug.mpsafenet. As that has now been removed, they are no longer required. Removing them significantly simplifies error-handling in the socket layer, eliminated quite a bit of unwinding of locking in error cases. While here clean up the now unneeded opt_net.h, which previously was used for the NET_WITH_GIANT kernel option. Clean up some related gotos for consistency. Reviewed by: bz, csjp Tested by: kris Approved by: re (kensmith)
* Bump maximum number of interface hooks to the maximum possible value.glebius2007-03-282-1/+2
| | | | | | | | This will increase the memory consumption for more than 1 Mb, but this is required for operation on multiinterface access concentrators running mpd. Requested by: Alexander Motin
OpenPOWER on IntegriCloud