summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* Rework socket upcalls to close some races with setup/teardown of upcalls.jhb2009-06-012-27/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Each socket upcall is now invoked with the appropriate socket buffer locked. It is not permissible to call soisconnected() with this lock held; however, so socket upcalls now return an integer value. The two possible values are SU_OK and SU_ISCONNECTED. If an upcall returns SU_ISCONNECTED, then the soisconnected() will be invoked on the socket after the socket buffer lock is dropped. - A new API is provided for setting and clearing socket upcalls. The API consists of soupcall_set() and soupcall_clear(). - To simplify locking, each socket buffer now has a separate upcall. - When a socket upcall returns SU_ISCONNECTED, the upcall is cleared from the receive socket buffer automatically. Note that a SO_SND upcall should never return SU_ISCONNECTED. - All this means that accept filters should now return SU_ISCONNECTED instead of calling soisconnected() directly. They also no longer need to explicitly clear the upcall on the new socket. - The HTTP accept filter still uses soupcall_set() to manage its internal state machine, but other accept filters no longer have any explicit knowlege of socket upcall internals aside from their return value. - The various RPC client upcalls currently drop the socket buffer lock while invoking soreceive() as a temporary band-aid. The plan for the future is to add a new flag to allow soreceive() to be called with the socket buffer locked. - The AIO callback for socket I/O is now also invoked with the socket buffer locked. Previously sowakeup() would drop the socket buffer lock only to call aio_swake() which immediately re-acquired the socket buffer lock for the duration of the function call. Discussed with: rwatson, rmacklem
* s/usb2_/usb_/ on all typedefs for the USB stack.thompsa2009-05-292-16/+16
|
* s/usb2_/usb_/ on all C structs for the USB stack.thompsa2009-05-283-42/+42
|
* Hook ubt and ubtbcmfw back up to the build.thompsa2009-05-271-2/+1
|
* move ng_ubt_var.h back to its original placethompsa2009-05-271-0/+131
|
* move ng_ubt.c back to its original placethompsa2009-05-271-0/+1722
|
* move ubtbcmfw.c back to its original placethompsa2009-05-271-0/+427
|
* Delete the bluetooth drivers for the old usb stack.thompsa2009-05-274-3091/+0
|
* 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
* Unbreak LINT build, caused by a change in struct ng_node layout introducedzec2009-05-051-0/+1
| | | | | | with r191816, which become uncovered only with NETGRAPH_DEBUG defined. NOT approved by mentor (julian) due to emergency.
* Change the curvnet variable from a global const struct vnet *,zec2009-05-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | previously always pointing to the default vnet context, to a dynamically changing thread-local one. The currvnet context should be set on entry to networking code via CURVNET_SET() macros, and reverted to previous state via CURVNET_RESTORE(). Recursions on curvnet are permitted, though strongly discuouraged. This change should have no functional impact on nooptions VIMAGE kernel builds, where CURVNET_* macros expand to whitespace. The curthread->td_vnet (aka curvnet) variable's purpose is to be an indicator of the vnet context in which the current network-related operation takes place, in case we cannot deduce the current vnet context from any other source, such as by looking at mbuf's m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc. Moreover, so far curvnet has turned out to be an invaluable consistency checking aid: it helps to catch cases when sockets, ifnets or any other vnet-aware structures may have leaked from one vnet to another. The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros was a result of an empirical iterative process, whith an aim to reduce recursions on CURVNET_SET() to a minimum, while still reducing the scope of CURVNET_SET() to networking only operations - the alternative would be calling CURVNET_SET() on each system call entry. In general, curvnet has to be set in three typicall cases: when processing socket-related requests from userspace or from within the kernel; when processing inbound traffic flowing from device drivers to upper layers of the networking stack, and when executing timer-driven networking functions. This change also introduces a DDB subcommand to show the list of all vnet instances. Approved by: julian (mentor)
* In preparation to make options VIMAGE operational, where needed,zec2009-04-265-15/+159
| | | | | | | | | | | | | initialize / release netgraph related state in iattach() / idetach() functions called via the vnet module registration / initialization framework, instead of initialization / cleanups being done in mod_event handlers. While here, introduce a crude hack aimed at preventing ng_ether to autoattach to ng_eiface ifnets, which are also netgraph nodes already. Reviewed by: bz Approved by: julian (mentor)
* Lock the interface address list while building replies torwatson2009-04-191-0/+2
| | | | | | NGM_CISCO_COOKIE messages in ng_iface. MFC after: 2 weeks
* Lock interface address list when building a reply to NGM_EIFACE_GET_IFADDRSrwatson2009-04-191-0/+3
| | | | | | messages in ng_eiface. MFC after: 2 weeks
* Switch ubtbcmfw(4) to use si_drv1 instead of storing the unit number.ed2009-04-171-39/+21
| | | | | | The unit number is still used to store the type of the device node. Approved by: emax
* Change if_output to take a struct route as its fourth argument in orderkmacy2009-04-162-6/+8
| | | | | | to allow passing a cached struct llentry * down to L2 Reviewed by: rwatson
* Make Netgraph compile with Clang.ed2009-03-033-14/+12
| | | | | | | | | | | | | | | | Clang disallows structs with variable length arrays to be nested inside other structs, because this is in violation with ISO C99. Even though we can keep bugging the LLVM folks about this issue, we'd better just fix our code to not do this. This code seems to be the only code in the entire source tree that does this. I haven't tested this patch by using the kernel modules in question, but Diane Bruce and I have compared disassembled versions of these kernel modules. We would have expected them to be exactly the same, but due to randomness in the register allocator and reordering of instructions, there were some minor differences. Approved by: julian
* Add memmove() to the kernel, making the kernel compile with Clang.ed2009-02-282-5/+0
| | | | | | | | | | | | When copying big structures, LLVM generates calls to memmove(), because it may not be able to figure out whether structures overlap. This caused linker errors to occur. memmove() is now implemented using bcopy(). Ideally it would be the other way around, but that can be solved in the future. On ARM we don't do add anything, because it already has memmove(). Discussed on: arch@ Reviewed by: rdivacky
* For all files including net/vnet.h directly include opt_route.h andbz2009-02-273-0/+7
| | | | | | | | | | | | | | net/route.h. Remove the hidden include of opt_route.h and net/route.h from net/vnet.h. We need to make sure that both opt_route.h and net/route.h are included before net/vnet.h because of the way MRT figures out the number of FIBs from the kernel option. If we do not, we end up with the default number of 1 when including net/vnet.h and array sizes are wrong. This does not change the list of files which depend on opt_route.h but we can identify them now more easily.
* Update comment. soalloc() is no longer performing M_WAITOK memory allocations.emax2009-02-101-14/+6
| | | | | Submitted by: ru MFC after: 3 days
* Allow unprivileged users to run l2ping(8).emax2009-02-041-5/+0
| | | | MFC after: 1 month
* Check for infinite recursion possible on some broken PPTP/L2TP/... VPN setups.mav2009-01-202-0/+21
| | | | | | | Mark packets with mbuf_tag on first interface passage and drop on second. PR: ports/129625, ports/125303, MFC after: 2 weeks
* Properly return error code to the caller. This should fix the followingemax2009-01-191-20/+26
| | | | | | | | | | panic in ng_l2cap(4). panic: ng_l2cap_l2ca_con_req: ubt0l2cap - could not find connection! While i'm here get rid of few goto's. MFC after: 1 week
* If source mbuf chain consists of only one mbuf, use it directly as sourcemav2009-01-181-34/+51
| | | | buffer to avoid extra copying.
* Use m_unshare()+m_copyback() instead of m_freem()+m_devget() to keepmav2009-01-183-49/+80
| | | | | original mbuf chain headers. It can be less efficient in some cases, but it looks better then mess of copying headers into the nonempty chain.
* Remove strict limitation on minimal multilink MRRU. RFC claims that MRRUmav2009-01-181-5/+6
| | | | | | | of 1500 must be supported, but allows smaller values to be negotiated. Enforce specified MRRU for outgoing frames. MFC after: 2 weeks
* Mark ng_vjc node as FORCE_WRITER to protect slcompress state.mav2009-01-081-0/+3
| | | | | | | I think it can be the reason of livelock in netgraph reported by some mpd users. MFC after: 3 days
* shave about 7% off the overhead of ng_ether by using per-hookjulian2008-12-251-17/+23
| | | | receive data methods.
* Add a trivial node to reflect ethernet frames to whence they came.julian2008-12-252-0/+196
| | | | MFC after: 1 month
* Change message severity level from WARN to INFO. This should reduceemax2008-12-241-1/+1
| | | | | | amount of messages sent to syslog MFC after: 1 week
* Unroll two loops of SHA1Update(). 60 bytes of static memory is not a price.mav2008-12-161-9/+12
|
* 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
* To avoid one doubtless netgraph SMP scalability limitation point, switchmav2008-12-141-13/+32
| | | | | | | | node queues processing from single swi:net thread to several specialized threads. Reviewed by: julian Tested with: Netperf Cluster
* Revert rev. 183277:mav2008-12-132-9/+2
| | | | | | | | | | Remove ng_rmnode_flags() function. ng_rmnode_self() was made to be called only while having node locked. When node is properly locked, any function call sent to it will always be queued. So turning ng_rmnode_self() into the ng_rmnode_flags() is not just meaningless, but incorrent, as it violates node locking when called outside. No objections: julian, thompsa
* Remove node shutdown on tty close. This could be easily done by user-levelmav2008-12-131-11/+0
| | | | | while it's present implementation with ng_rmnode_flags() is at least incorrect.
* Change ttyhook_register() second argument from thread to process pointer.mav2008-12-131-5/+5
| | | | | Thread was not really needed there, while previous ng_tty implementation that used thread pointer had locking issues (using sx while holding mutex).
* Conditionally compile out V_ globals while instantiating the appropriatezec2008-12-106-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | container structures, depending on VIMAGE_GLOBALS compile time option. Make VIMAGE_GLOBALS a new compile-time option, which by default will not be defined, resulting in instatiations of global variables selected for V_irtualization (enclosed in #ifdef VIMAGE_GLOBALS blocks) to be effectively compiled out. Instantiate new global container structures to hold V_irtualized variables: vnet_net_0, vnet_inet_0, vnet_inet6_0, vnet_ipsec_0, vnet_netgraph_0, and vnet_gif_0. Update the VSYM() macro so that depending on VIMAGE_GLOBALS the V_ macros resolve either to the original globals, or to fields inside container structures, i.e. effectively #ifdef VIMAGE_GLOBALS #define V_rt_tables rt_tables #else #define V_rt_tables vnet_net_0._rt_tables #endif Update SYSCTL_V_*() macros to operate either on globals or on fields inside container structs. Extend the internal kldsym() lookups with the ability to resolve selected fields inside the virtualization container structs. This applies only to the fields which are explicitly registered for kldsym() visibility via VNET_MOD_DECLARE() and vnet_mod_register(), currently this is done only in sys/net/if.c. Fix a few broken instances of MODULE_GLOBAL() macro use in SCTP code, and modify the MODULE_GLOBAL() macro to resolve to V_ macros, which in turn result in proper code being generated depending on VIMAGE_GLOBALS. De-virtualize local static variables in sys/contrib/pf/net/pf_subr.c which were prematurely V_irtualized by automated V_ prepending scripts during earlier merging steps. PF virtualization will be done separately, most probably after next PF import. Convert a few variable initializations at instantiation to initialization in init functions, most notably in ipfw. Also convert TUNABLE_INT() initializers for V_ variables to TUNABLE_FETCH_INT() in initializer functions. Discussed at: devsummit Strassburg Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Carefully handle memory errors to keep peers compression/encryption statemav2008-12-061-11/+24
| | | | | consistent. There are some cases reported where peers fatally getting out of sync without any visible reason. I hope this solve the problem.
* Rather than using hidden includes (with cicular dependencies),bz2008-12-024-0/+4
| | | | | | | | | | | directly include only the header files needed. This reduces the unneeded spamming of various headers into lots of files. For now, this leaves us with very few modules including vnet.h and thus needing to depend on opt_route.h. Reviewed by: brooks, gnn, des, zec, imp Sponsored by: The FreeBSD Foundation
* Unhide declarations of network stack virtualization structs fromzec2008-11-283-4/+11
| | | | | | | | | | | | | | | | | | underneath #ifdef VIMAGE blocks. This change introduces some churn in #include ordering and nesting throughout the network stack and drivers but is not expected to cause any additional issues. In the next step this will allow us to instantiate the virtualization container structures and switch from using global variables to their "containerized" counterparts. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Remove unused variable.mav2008-11-221-3/+2
| | | | | Found with: Coverity Prevent(tm) CID: 3682
* Fix typo. Clear session stats instead of config and part of stats.mav2008-11-221-1/+1
| | | | | Found with: Coverity Prevent(tm) CID: 2472
* Remove unneeded NULL check. At first msg can't be null here and and at secondmav2008-11-221-2/+1
| | | | | | NG_FREE_MSG() also checks it. Found with: Coverity Prevent(tm)
* convert calls to IFQ_HANDOFF to if_transmitkmacy2008-11-221-1/+1
|
* Don't use curthread to resolve file descriptor. Request may be queued, somav2008-11-081-2/+10
| | | | | thread will be different. Instead require sender to send process ID together with file descriptor.
* Assign new cookie to the node to reflect API change.mav2008-11-081-1/+1
| | | | All applications will have to be adapted and rebuilt.
* Don't assign completely meaningless name to the node on creation.mav2008-11-071-11/+0
| | | | | As soon as node is created from the netgraph side now, it can be found without using this. Allow application to assign whatever name it want later.
* Fix a number of style issues in the MALLOC / FREE commit. I've tried todes2008-10-237-11/+18
| | | | | 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-2354-248/+233
| | | | 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
OpenPOWER on IntegriCloud