summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* MFC r312443:pfg2017-01-231-4/+3
| | | | | | | | | | | | mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. There were several places where reference to compression were left unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID which is not defined in the tree and therefore were sure to break with INVARIANTS: comment them out. Reported by: Eugene Grosbein PR: 216265
* MFH: r309408julian2016-12-272-344/+486
| | | | | | | | | Changes to allow the patching of packets with an offset (and other changes.. see man page) PR: 206185 Submitted by: Dmitry Vagin <daemon-hammer@ya.ru> MFC after: 1 week Relnotes: yes (also ng_checksum node)
* MFC r309404:hselasky2016-12-191-1/+5
| | | | | | | | | | | Fix return value from ng_uncallout(). callout_stop() recently started returning -1 when the callout is already stopped, which is not handled by the netgraph code. Properly filter the return value. Netgraph callers only want to know if the callout was cancelled and not draining or already stopped. Discussed with: julian, glebius
* MFH: r303611julian2016-12-022-25/+28
| | | | | | | | | slite style changes. There is an incoming patch that rewrites a lot of this module and I want to get the style and whitespace changes in a separate commit (or maybe more). PR: 206185 Submitted by: Dmitry Vagin
* MFH: r303612julian2016-12-022-0/+817
| | | | | | | netgraph module for reconstructing checksums PR: 206108 Submitted by: Dmitry Vagin daemon.hammer@ya.ru
* Get closer to a VIMAGE network stack teardown from top to bottom ratherbz2016-06-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than removing the network interfaces first. This change is rather larger and convoluted as the ordering requirements cannot be separated. Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and related modules to their own SI_SUB_PROTO_FIREWALL. Move initialization of "physical" interfaces to SI_SUB_DRIVERS, move virtual (cloned) interfaces to SI_SUB_PSEUDO. Move Multicast to SI_SUB_PROTO_MC. Re-work parts of multicast initialisation and teardown, not taking the huge amount of memory into account if used as a module yet. For interface teardown we try to do as many of them as we can on SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling over a higher layer protocol such as IP. In that case the interface has to go along (or before) the higher layer protocol is shutdown. Kernel hhooks need to go last on teardown as they may be used at various higher layers and we cannot remove them before we cleaned up the higher layers. For interface teardown there are multiple paths: (a) a cloned interface is destroyed (inside a VIMAGE or in the base system), (b) any interface is moved from a virtual network stack to a different network stack ("vmove"), or (c) a virtual network stack is being shut down. All code paths go through if_detach_internal() where we, depending on the vmove flag or the vnet state, make a decision on how much to shut down; in case we are destroying a VNET the individual protocol layers will cleanup their own parts thus we cannot do so again for each interface as we end up with, e.g., double-frees, destroying locks twice or acquiring already destroyed locks. When calling into protocol cleanups we equally have to tell them whether they need to detach upper layer protocols ("ulp") or not (e.g., in6_ifdetach()). Provide or enahnce helper functions to do proper cleanup at a protocol rather than at an interface level. Approved by: re (hrs) Obtained from: projects/vnet Reviewed by: gnn, jhb Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6747
* Disconnect LE socket when the HCI connection associated is disconnected.takawata2016-06-073-3/+10
|
* 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-2938-73/+73
| | | | No functional change.
* sys: extend use of the howmany() macro when available.pfg2016-04-261-2/+2
| | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* sys: use our nitems() macro when param.h is available.pfg2016-04-214-4/+4
| | | | | | This should cover all the remaining cases in the kernel. Discussed in: freebsd-current
* Remove slightly used const values that can be replaced with nitems().pfg2016-04-211-3/+2
| | | | Suggested by: jhb
* sys/net* : for pointers replace 0 with NULL.pfg2016-04-153-4/+4
| | | | | | Mostly cosmetical, no functional change. Found with devel/coccinelle.
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-104-5/+5
| | | | Found with devel/coccinelle.
* Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().jhibbits2016-02-271-2/+2
| | | | | | | | Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370
* These files were getting sys/malloc.h and vm/uma.h with header pollutionglebius2016-02-014-0/+6
| | | | 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
* Make it possible for sbappend() to preserve M_NOTREADY on mbufs, just likeglebius2016-01-081-2/+2
| | | | | | | | | | sbappendstream() does. Although, M_NOTREADY may appear only on SOCK_STREAM sockets, due to sendfile(2) supporting only the latter, there is a corner case of AF_UNIX/SOCK_STREAM socket, that still uses records for the sake of control data, albeit being stream socket. Provide private version of m_clrprotoflags(), which understands PRUS_NOTREADY, similar to m_demote().
* 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.
* - grab ng_btsocket_l2cap_sockets_mtx lock inemax2015-12-231-0/+8
| | | | | | | | | | | ng_btsocket_l2cap_process_l2ca_enc_change() before calling ng_btsocket_l2cap_pcb_by_cid(); - handle possible NULL value returned from ng_btsocket_l2cap_pcb_by_cid(); Submitted by: Hans Petter Selasky; hps at selasky dot org MFC after: 1 week
* Create a USB_PNP_INFO and use it to export the existing PNPimp2015-12-112-7/+9
| | | | | | | | | | | tables. Some drivers needed some slight re-arrangement of declarations to accommodate this. Change the USB pnp tables slightly to allow better compatibility with the system by moving linux driver info from start of each entry to the end. All other PNP tables in the system have the per-device flags and such at the end of the elements rather that at the beginning. Differential Review: https://reviews.freebsd.org/D3458
* Create a generic PCCARD_PNP_INFO from the MODULE_PNP_INFO buildingimp2015-12-111-6/+6
| | | | | | | | | block. Use it in all the PNP drivers to export either the current PNP table. For uart, create a custom table and export it using MODULE_PNP_INFO since it's the only one that matches on function number. Differential Review: https://reviews.freebsd.org/D3461
* Move iflladdr_event eventhandler invocation to if_setlladdr.melifaro2015-11-142-4/+0
| | | | Suggested by: glebius
* Use lladdr_event to propagate gratiotus arp.melifaro2015-11-092-2/+4
| | | | Differential Revision: https://reviews.freebsd.org/D4019
* Fix encryption error handling.takawata2015-11-072-4/+10
| | | | Close l2cap connection on encryption error.
* Bluetooth LE Security Management channel support.takawata2015-10-2716-52/+320
| | | | | | Add a socket option to block until underlying HCI connection encrypted. Differential Revision: https://reviews.freebsd.org/D3981
* Add support for PPP-Max-Payload PPPoE tag (RFC4638).mav2015-09-112-0/+58
| | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks
* * Address review (and add a bit myself).markm2015-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | - Tweek man page. - Remove all mention of RANDOM_FORTUNA. If the system owner wants YARROW or DUMMY, they ask for it, otherwise they get FORTUNA. - Tidy up headers a bit. - Tidy up declarations a bit. - Make static in a couple of places where needed. - Move Yarrow/Fortuna SYSINIT/SYSUNINIT to randomdev.c, moving us towards a single file where the algorithm context is used. - Get rid of random_*_process_buffer() functions. They were only used in one place each, and are better subsumed into those places. - Remove *_post_read() functions as they are stubs everywhere. - Assert against buffer size illegalities. - Clean up some silly code in the randomdev_read() routine. - Make the harvesting more consistent. - Make some requested argument name changes. - Tidy up and clarify a few comments. - Make some requested comment changes. - Make some requested macro changes. * NOTE: the thing calling itself a 'unit test' is not yet a proper unit test, but it helps me ensure things work. It may be a proper unit test at some time in the future, but for now please don't make any assumptions or hold any expectations. Differential Revision: https://reviews.freebsd.org/D2025 Approved by: so (/dev/random blanket)
* Fix rfcomm_sppd regression I could reproduced.takawata2015-07-072-1/+5
| | | | | | | | To reproduce it, Two machine running FreeBSD and run rfcomm_sppd -c 3 -S rfcomm_sppd -a ${PEER} -c 3 on each side.
* Huge cleanup of random(4) code.markm2015-06-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * GENERAL - Update copyright. - Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set neither to ON, which means we want Fortuna - If there is no 'device random' in the kernel, there will be NO random(4) device in the kernel, and the KERN_ARND sysctl will return nothing. With RANDOM_DUMMY there will be a random(4) that always blocks. - Repair kern.arandom (KERN_ARND sysctl). The old version went through arc4random(9) and was a bit weird. - Adjust arc4random stirring a bit - the existing code looks a little suspect. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Redo read_random(9) so as to duplicate random(4)'s read internals. This makes it a first-class citizen rather than a hack. - Move stuff out of locked regions when it does not need to be there. - Trim RANDOM_DEBUG printfs. Some are excess to requirement, some behind boot verbose. - Use SYSINIT to sequence the startup. - Fix init/deinit sysctl stuff. - Make relevant sysctls also tunables. - Add different harvesting "styles" to allow for different requirements (direct, queue, fast). - Add harvesting of FFS atime events. This needs to be checked for weighing down the FS code. - Add harvesting of slab allocator events. This needs to be checked for weighing down the allocator code. - Fix the random(9) manpage. - Loadable modules are not present for now. These will be re-engineered when the dust settles. - Use macros for locks. - Fix comments. * src/share/man/... - Update the man pages. * src/etc/... - The startup/shutdown work is done in D2924. * src/UPDATING - Add UPDATING announcement. * src/sys/dev/random/build.sh - Add copyright. - Add libz for unit tests. * src/sys/dev/random/dummy.c - Remove; no longer needed. Functionality incorporated into randomdev.*. * live_entropy_sources.c live_entropy_sources.h - Remove; content moved. - move content to randomdev.[ch] and optimise. * src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h - Remove; plugability is no longer used. Compile-time algorithm selection is the way to go. * src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h - Add early (re)boot-time randomness caching. * src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h - Remove; no longer needed. * src/sys/dev/random/uint128.h - Provide a fake uint128_t; if a real one ever arrived, we can use that instead. All that is needed here is N=0, N++, N==0, and some localised trickery is used to manufacture a 128-bit 0ULLL. * src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h - Improve unit tests; previously the testing human needed clairvoyance; now the test will do a basic check of compressibility. Clairvoyant talent is still a good idea. - This is still a long way off a proper unit test. * src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h - Improve messy union to just uint128_t. - Remove unneeded 'static struct fortuna_start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch]) * src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h - Improve messy union to just uint128_t. - Remove unneeded 'staic struct start_cache'. - Tighten up up arithmetic. - Provide a method to allow eternal junk to be introduced; harden it against blatant by compress/hashing. - Assert that locks are held correctly. - Fix the nasty pre- and post-read overloading by providing explictit functions to do these tasks. - Turn into self-sufficient module (no longer requires randomdev_soft.[ch]) - Fix some magic numbers elsewhere used as FAST and SLOW. Differential Revision: https://reviews.freebsd.org/D2025 Reviewed by: vsevolod,delphij,rwatson,trasz,jmg Approved by: so (delphij)
* CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenjkim2015-05-222-2/+2
| | | | | | | | | | 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
* Move zlib.c from net to libkern.rodrigc2015-04-221-2/+1
| | | | | | | | | | | | It is not network-specific code and would be better as part of libkern instead. Move zlib.h and zutil.h from net/ to sys/ Update includes to use sys/zlib.h and sys/zutil.h instead of net/ Submitted by: Steve Kiernan stevek@juniper.net Obtained from: Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/28 Relnotes: yes
* Forgot to add default event mask definition.takawata2015-04-181-0/+3
|
* Initial Bluetooth LE support.takawata2015-04-0723-172/+1503
| | | | | | | | | Note that sockaddr_l2cap structure is changed , check socket address to initialize new structure member and define L2CAP_SOCKET_CHECKED before including ng_btsocket.h Differential Revision: https://reviews.freebsd.org/D2021 Reviewed by:emax
* Change the callout to supply -1 to indicate we are not changingrrs2015-03-282-3/+3
| | | | | | | | | | | | | | CPU, also add protection against invalid CPU's as well as split c_flags and c_iflags so that if a user plays with the active flag (the one expected to be played with by callers in MPSAFE) without a lock, it won't adversely affect the callout system by causing a corrupt list. This also means that all callers need to use the macros and *not* play with the falgs directly (like netgraph used to). Differential Revision: htts://reviews.freebsd.org/D1894 Reviewed by: .. timed out but looked at by jhb, imp, adrian hselasky tested by hiren and netflix. Sponsored by: Netflix Inc.
* Revise default limit for maximum of netgraph data items.glebius2015-02-121-1/+1
| | | | | With modern internet speeds the limit can be reached even on a single L2TP link.
* Fix a bunch of -Wcast-qual warnings in netgraph's ng_parse.c, by usingdim2015-01-301-3/+3
| | | | | | __DECONST. No functional change. MFC after: 3 days
* When the node receives NGM_FLOW_COOKIE update the if_link_state, insteadglebius2015-01-121-2/+2
| | | | | | of playing with almost dead IFF_DRV_RUNNING flag. Sponsored by: Nginx, Inc.
* Remove the support for NGM_CISCO_GET_IPADDR message from ng_iface(4). Theglebius2015-01-121-53/+0
| | | | | | | | | | legitimacy of removal is proved by the fact that implementation contained a critical bug: the response allocated was sizeof(pointer), while should had been 2*sizeof(struct ng_cisco_ipaddr). The reason for ng_iface(4) to support ng_cisco(4) message isn't explained anywhere, and code comes from original Whistle import. Sponsored by: Nginx, Inc.
* In order to reduce use of M_EXT outside of the mbuf allocator andrwatson2015-01-065-16/+8
| | | | | | | | | | | | | | | | | | | | | socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value. With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations. NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature. Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division
* In preparation of merging projects/sendfile, transform bare access toglebius2014-11-123-6/+5
| | | | | | | | | | | | sb_cc member of struct sockbuf to a couple of inline functions: sbavail() and sbused() Right now they are equal, but once notion of "not ready socket buffer data", will be checked in, they are going to be different. Sponsored by: Netflix Sponsored by: Nginx, Inc.
* Remove struct arpcom. It is unused by most interface types, that allocateglebius2014-11-071-1/+1
| | | | | | | | it, except Ethernet, where it carried ng_ether(4) pointer. For now carry the pointer in if_l2com directly. Sponsored by: Netflix Sponsored by: Nginx, Inc.
* NG_NODE_NAME(node) is always not NULL. Use correct macro.glebius2014-11-021-1/+1
| | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com>
* Use macro ERROUT() to make code more laconic and follow style of otherglebius2014-10-311-24/+15
| | | | | | netgraph code. Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com>
* This is the much-discussed major upgrade to the random(4) device, known to ↵markm2014-10-301-2/+1
| | | | | | | | | | | | | | | | | | | you all as /dev/random. This code has had an extensive rewrite and a good series of reviews, both by the author and other parties. This means a lot of code has been simplified. Pluggable structures for high-rate entropy generators are available, and it is most definitely not the case that /dev/random can be driven by only a hardware souce any more. This has been designed out of the device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other entropy source. Pluggable modules may be written by third parties for additional sources. The harvesting structures and consequently the locking have been simplified. Entropy harvesting is done in a more general way (the documentation for this will follow). There is some GREAT entropy to be had in the UMA allocator, but it is disabled for now as messing with that is likely to annoy many people. The venerable (but effective) Yarrow algorithm, which is no longer supported by its authors now has an alternative, Fortuna. For now, Yarrow is retained as the default algorithm, but this may be changed using a kernel option. It is intended to make Fortuna the default algorithm for 11.0. Interested parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck, read it anyway. Many thanks to Arthur Mesh who did early grunt work, and who got caught in the crossfire rather more than he deserved to. My thanks also to folks who helped me thresh this out on whiteboards and in the odd "Hallway track", or otherwise. My Nomex pants are on. Let the feedback commence! Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?) Approved by: so(des)
* Fix multiple incorrect SYSCTL arguments in the kernel:hselasky2014-10-213-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies
* Bump ipfw module version.melifaro2014-10-091-1/+1
|
OpenPOWER on IntegriCloud