aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* - Use ng_callout() instead of timeout(9).Gleb Smirnoff2004-12-061-37/+14
| | | | | | | | | | | | | - Do not put/remove node references, since this no longer needed. - Remove timerActive flag, use callout flags. - Schedule next callout after doing current one. Reviewed by: archie Approved by: julian (mentor) Notes: svn path=/head/; revision=138479
* Use ng_callout() instead of timeout(9).Gleb Smirnoff2004-12-051-7/+7
| | | | | | | Approved by: julian (mentor) Notes: svn path=/head/; revision=138420
* - Use uint16_t to pass argument for NGM_NETFLOW_IFINFO, bump cookie.Gleb Smirnoff2004-12-052-6/+12
| | | | | | | | | | | | | - Always check that index number passed from userland is <= NG_NETFLOW_MAXIFACES. [1] - Increase NG_NETFLOW_MAXIFACES up to 512. [2] Noticed by: Roman Palagin [1] Requested by: Yuri Y. Bushmelev [2] MFC after: 1 week Notes: svn path=/head/; revision=138392
* Mechanically rename s/ng_timeout/ng_callout/g, s/ng_untimeout/ng_uncallout/g.Gleb Smirnoff2004-12-018-33/+33
| | | | | | | | | | This is done to keep both versions in RELENG_5 and support both APIs. Reviewed by: scottl Approved by: julian (mentor), implicitly Notes: svn path=/head/; revision=138268
* Move ng_socket and ng_btsocket initialization to SI_SUB_PROTO_DOMAIN as theyMax Laier2004-11-302-2/+3
| | | | | | | | | | | | | | | | | | call net_add_domain(). Calling this function too early (or late) breaks assertations about the global domains list. Actually it should be forbidden to call net_add_domain() outside of SI_SUB_PROTO_DOMAIN completely as there are many places where we traverse the domains list unprotected, but for now we allow late calls (mostly to support netgraph). In order to really fix this we have to lock the domains list in all places or find another way to ensure that we can safely walk the list while another thread might be adding a new domain. Spotted by: se Reviewed by: julian, glebius PR: kern/73321 (partly) Notes: svn path=/head/; revision=138238
* Disable protocol field compression on the inner PPP frame when also doingArchie Cobbs2004-11-271-1/+1
| | | | | | | | | | normal PPP compression, as a workaround for certain (arguably) broken Linux PPP implementations that can't handle this particular case. MFC after: 1 week Notes: svn path=/head/; revision=138138
* Netgraph flow control: change interface status when node receiveGleb Smirnoff2004-11-231-0/+12
| | | | | | | | | | LINK_IS_UP/LINK_IS_DOWN messages. Approved by: julian (mentor), implicitly MFC after: 1 week Notes: svn path=/head/; revision=138011
* Introduce new failure detection algorithm, called NG_ONE2MANY_FAIL_NOTIFY.Gleb Smirnoff2004-11-232-1/+66
| | | | | | | | | | | | | It means, that node listens to flow control messages from downstreams and removes link from list of active links whenever a LINK_IS_DOWN message is received. If LINK_IS_UP message is received, then links is put back into list of active links. Approved by: julian (mentor), implicitly MFC after: 1 week Notes: svn path=/head/; revision=138010
* o Use ng_timeout() instead of timeout(9).Gleb Smirnoff2004-11-231-11/+33
| | | | | | | | | | | | | | o Implement some netgraph flow control: - Whenever status of HDLC heartbeat from pear is timed out, send NGM_LINK_IS_DOWN message. - If HDLC link changes status from down to up, send NGM_LINK_IS_UP message. Approved by: julian (mentor), implicitly MFC after: 1 week Notes: svn path=/head/; revision=138009
* Remove unused macro.Gleb Smirnoff2004-11-191-3/+0
| | | | | | | Approved by: julian (mentor) Notes: svn path=/head/; revision=137899
* Cancel pending timeout before scheduling a new one. This fixesGleb Smirnoff2004-11-191-0/+1
| | | | | | | | | item leak, I've introduced with previous change. Approved by: julian (mentor) Notes: svn path=/head/; revision=137897
* Correct typo. Return ENXIO instead of EIO.Maksim Yevmenkin2004-11-191-1/+1
| | | | Notes: svn path=/head/; revision=137896
* Add myself to copyright.Gleb Smirnoff2004-11-101-0/+1
| | | | | | | Approved by: marks Notes: svn path=/head/; revision=137525
* Initialize struct pr_userreqs in new/sparse style and fill in commonPoul-Henning Kamp2004-11-082-126/+68
| | | | | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities. Notes: svn path=/head/; revision=137386
* Partically backout previous commit. Since _callout_stop_safe() clearsGleb Smirnoff2004-11-041-2/+7
| | | | | | | | | | | | | out c->c_func, we can't take it after callout_stop(). To take it before we need to acquire callout_lock, to avoid race. This commit narrows down area where lock is held, but hack is still present. This should be redesigned. Approved by: julian (mentor) Notes: svn path=/head/; revision=137230
* Adapt to the new ng_timeout/ng_untimeout arguments. These now useHartmut Brandt2004-11-042-17/+11
| | | | | | | | | the callout instead of the timeout interface. Submitted by: glebius Notes: svn path=/head/; revision=137199
* Fix kernel build (caused by recent ng_{un}timeout API change)Maksim Yevmenkin2004-11-035-23/+23
| | | | | | | Submitted by: glebius Notes: svn path=/head/; revision=137163
* - Make ng_timeout() to use callout() interface instead of timeout().Gleb Smirnoff2004-11-023-30/+28
| | | | | | | | | | - Remove callout-hacking from ng_untimeout(). Approved by: julian (mentor) MFC after: 1 month Notes: svn path=/head/; revision=137138
* Fix a harmless error in order of ng_timeout() arguments.Gleb Smirnoff2004-11-021-2/+2
| | | | | | | Approved by: julian (mentor) Notes: svn path=/head/; revision=137136
* Fix broken ng_h4(4). Basically, do not abuse t_sc field and use new t_lscMaksim Yevmenkin2004-11-021-7/+9
| | | | | | | | field created for line disciplne drivers private use. Also add NET_NEEDS_GIANT warning. For whatever reason ng_tty(4) was fixed but ng_h4(4) was not :( Notes: svn path=/head/; revision=137133
* Removed bogus comment.Gleb Smirnoff2004-11-011-2/+0
| | | | Notes: svn path=/head/; revision=137115
* o style changes:Gleb Smirnoff2004-11-011-13/+11
| | | | | | | | | | | | | - tabs after defines - tabs instead of many spaces - sort local variables by size o remove spl(9) calls Approved by: julian (mentor) Notes: svn path=/head/; revision=137114
* Since last change moved ';' from macro to code, we need to embraceGleb Smirnoff2004-10-312-4/+4
| | | | | | | | | | | macros with 'do {} while (0)' to avoid error in case macro is not defined. Prodded by: julian, archie Pointy hat to: glebius Notes: svn path=/head/; revision=137100
* Rename debug macro to DBG and indent it properly.Gleb Smirnoff2004-10-282-35/+34
| | | | | | | | Requested by: maxim Approved by: julian (mentor) Notes: svn path=/head/; revision=137022
* Push acquisition of the accept mutex out of sofree() into the callerRobert Watson2004-10-184-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (sorele()/sotryfree()): - This permits the caller to acquire the accept mutex before the socket mutex, avoiding sofree() having to drop the socket mutex and re-order, which could lead to races permitting more than one thread to enter sofree() after a socket is ready to be free'd. - This also covers clearing of the so_pcb weak socket reference from the protocol to the socket, preventing races in clearing and evaluation of the reference such that sofree() might be called more than once on the same socket. This appears to close a race I was able to easily trigger by repeatedly opening and resetting TCP connections to a host, in which the tcp_close() code called as a result of the RST raced with the close() of the accepted socket in the user process resulting in simultaneous attempts to de-allocate the same socket. The new locking increases the overhead for operations that may potentially free the socket, so we will want to revise the synchronization strategy here as we normalize the reference counting model for sockets. The use of the accept mutex in freeing of sockets that are not listen sockets is primarily motivated by the potential need to remove the socket from the incomplete connection queue on its parent (listen) socket, so cleaning up the reference model here may allow us to substantially weaken the synchronization requirements. RELENG_5_3 candidate. MFC after: 3 days Reviewed by: dwhite Discussed with: gnn, dwhite, green Reported by: Marc UBM Bocklet <ubm at u-boot-man dot de> Reported by: Vlad <marchenko at gmail dot com> Notes: svn path=/head/; revision=136682
* Major overhaul.Gleb Smirnoff2004-10-182-356/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | List of functional changes: - Make a single device per single node with a single hook. This gives us parrallelizm, which can't be achieved on a single node with many devices/hooks. This also gives us flexibility - we can play with a particular device node, not affecting others. - Remove read queue as it is. Use struct ifqueue instead. This change removes a lot of extra memcpy()ing, m_devget()ting and m_copymem()ming. In ng_device_receivedata() we enqueue an mbuf and wake readers. In ngdread() we take one mbuf from qeueue and uiomove() it to userspace. If no mbuf is present we optionally block. [1] - In ngdwrite() we create an mbuf from uio using m_uiotombuf(). This is faster then uiomove() into buffer, and then m_copydata(), and this is much better than huge m_pullup(). - Perform locking of device - Perform locking of connection list. - Clear out _rcvmsg method, since it does nothing good yet. - Implement NGM_DEVICE_GET_DEVNAME message. - #if 0 ioctl method, while nothing is done here yet. - Return immediately from ngdwrite() if uio_resid == 0. List of tidyness changes: - Introduce device2priv(), to remove cut'n'paste. - Use MALLOC/FREE, instead of malloc/free. - Use unit2minor(). - Use UID_ROOT/GID_WHEEL instead of 0/0. - Define NGD_DEVICE_DEVNAME, use it. - Use more nice macros for debugging. [2] - Return Exxx, not -1. style(9) changes: - No "#endif" after short block. - Break long lines. - Remove extra spaces, add needed spaces. [1] Obtained from: if_tun.c [2] Obtained from: ng_pppoe.c Reviewed by: marks Approved by: julian (mentor) MFC after: 1 month Notes: svn path=/head/; revision=136673
* Get rid of device nodes interface. It is useless and confusing.Maksim Yevmenkin2004-10-122-532/+1
| | | | | | | | | | | | | The original idea was to use it for firmware upgrading and similar operations. In real life almost all Bluetooth USB devices do not need firmware download. If device does require firmware download then ugen(4) (or specialized driver like ubtbcmfw(8)) should be used instead. MFC after: 3 days Notes: svn path=/head/; revision=136460
* Fix packet flow when both ng_ether(4) and bridge(4) are in use:Gleb Smirnoff2004-10-121-0/+5
| | | | | | | | | | | | | | | | | | - push all bridge logic from if_ethersubr.c into bridge.c make bridge_in() return mbuf pointer (or NULL). - call only bridge_in() from ether_input(), after ng_ether_input() was optinally called. - call bridge_in() from ng_ether_rcv_upper(). Long description: http://lists.freebsd.org/mailman/htdig/freebsd-net/2004-May/003881.html Reported by: Jian-Wei Wang <jwwang at FreeBSD.csie.NCTU.edu.tw> Tested by: myself, Sergey Lyubka Reviewed by: sam Approved by: julian (mentor) MFC after: 2 months Notes: svn path=/head/; revision=136428
* Return 0, not NULL, from a function declared as returning int.Dag-Erling Smørgrav2004-10-091-1/+1
| | | | Notes: svn path=/head/; revision=136312
* Fix an issue with ng_tty which (ab)used the tty->t_sc field which isPoul-Henning Kamp2004-09-171-6/+6
| | | | | | | | | reserved for the device drivers: Add a t_lsc field for line discipline private use. Notes: svn path=/head/; revision=135406
* - Remove advertising clause from copyright [1]Gleb Smirnoff2004-09-174-32/+4
| | | | | | | | | - Change my email to glebius@FreeBSD.org Requested by: ru [1] Notes: svn path=/head/; revision=135400
* A netgraph node implementing Netflow version 5.Gleb Smirnoff2004-09-164-0/+1670
| | | | | | | | Supported by: Bestcom ISP, Rinet ISP Approved by: julian (mentor) Notes: svn path=/head/; revision=135332
* Remove orphaned comment about Meta data.Gleb Smirnoff2004-09-111-1/+0
| | | | Notes: svn path=/head/; revision=135075
* Increase PPTP_MAX_TIMEOUT up to 3 seconds. 10 prooved too much for high packetGleb Smirnoff2004-09-061-1/+1
| | | | | | | | | | | | | loss links, and 1 second appeared to be too small for high latency links. If we will receive more complaints, we should make this parameter configurable. PR: kern/69536 Approved by: archie, julian (mentor) MFC after: 3 days Notes: svn path=/head/; revision=134865
* In FreeBSD 5.x, curthread is always defined, so we don't need to to testRobert Watson2004-09-021-3/+3
| | | | | | | | | and optionally use &thread0 if it's NULL. Spotted by: julian Notes: svn path=/head/; revision=134651
* Acquire Giant arounds calls into the linker from Netgraph sockets.Robert Watson2004-08-301-0/+2
| | | | | | | | | | | We now no longer hold Giant in send(), so it isn't inheritted by the linker, which calls into VFS. Reported by: glebius Discussed with: glebius, bz Notes: svn path=/head/; revision=134521
* Mark Netgraph TTY, KAME IPSEC, and IPX/SPX as requiring Giant for correctRobert Watson2004-08-281-0/+2
| | | | | | | | | | operation using NET_NEEDS_GIANT(). This will result in a boot-time restoration of Giant-enabled network operation, or run-time warning on dynamic load (applicable only to the Netgraph component). Additional components will likely need to be marked with this in the future. Notes: svn path=/head/; revision=134445
* Apply error and success logic consistently to the function netisr_queue() andAndre Oppermann2004-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | its users. netisr_queue() now returns (0) on success and ERRNO on failure. At the moment ENXIO (netisr queue not functional) and ENOBUFS (netisr queue full) are supported. Previously it would return (1) on success but the return value of IF_HANDOFF() was interpreted wrongly and (0) was actually returned on success. Due to this schednetisr() was never called to kick the scheduling of the isr. However this was masked by other normal packets coming through netisr_dispatch() causing the dequeueing of waiting packets. PR: kern/70988 Found by: MOROHOSHI Akihiko <moro@remus.dti.ne.jp> MFC after: 3 days Notes: svn path=/head/; revision=134391
* Align netgraph message fields ready for 64-bit (and 128 bit :-) machines.Julian Elischer2004-08-203-10/+7
| | | | | | | | | | | | | requires a recompile of netgraph users. Also change the size of a field in the bluetooth code that was waiting for the next change that needed recompiles so it could piggyback its way in. Submitted by: jdp, maksim MFC after: 2 days Notes: svn path=/head/; revision=134057
* Convert ipfw to use PFIL_HOOKS. This is change is transparent to userlandAndre Oppermann2004-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and preserves the ipfw ABI. The ipfw core packet inspection and filtering functions have not been changed, only how ipfw is invoked is different. However there are many changes how ipfw is and its add-on's are handled: In general ipfw is now called through the PFIL_HOOKS and most associated magic, that was in ip_input() or ip_output() previously, is now done in ipfw_check_[in|out]() in the ipfw PFIL handler. IPDIVERT is entirely handled within the ipfw PFIL handlers. A packet to be diverted is checked if it is fragmented, if yes, ip_reass() gets in for reassembly. If not, or all fragments arrived and the packet is complete, divert_packet is called directly. For 'tee' no reassembly attempt is made and a copy of the packet is sent to the divert socket unmodified. The original packet continues its way through ip_input/output(). ipfw 'forward' is done via m_tag's. The ipfw PFIL handlers tag the packet with the new destination sockaddr_in. A check if the new destination is a local IP address is made and the m_flags are set appropriately. ip_input() and ip_output() have some more work to do here. For ip_input() the m_flags are checked and a packet for us is directly sent to the 'ours' section for further processing. Destination changes on the input path are only tagged and the 'srcrt' flag to ip_forward() is set to disable destination checks and ICMP replies at this stage. The tag is going to be handled on output. ip_output() again checks for m_flags and the 'ours' tag. If found, the packet will be dropped back to the IP netisr where it is going to be picked up by ip_input() again and the directly sent to the 'ours' section. When only the destination changes, the route's 'dst' is overwritten with the new destination from the forward m_tag. Then it jumps back at the route lookup again and skips the firewall check because it has been marked with M_SKIP_FIREWALL. ipfw 'forward' has to be compiled into the kernel with 'option IPFIREWALL_FORWARD' to enable it. DUMMYNET is entirely handled within the ipfw PFIL handlers. A packet for a dummynet pipe or queue is directly sent to dummynet_io(). Dummynet will then inject it back into ip_input/ip_output() after it has served its time. Dummynet packets are tagged and will continue from the next rule when they hit the ipfw PFIL handlers again after re-injection. BRIDGING and IPFW_ETHER are not changed yet and use ipfw_chk() directly as they did before. Later this will be changed to dedicated ETHER PFIL_HOOKS. More detailed changes to the code: conf/files Add netinet/ip_fw_pfil.c. conf/options Add IPFIREWALL_FORWARD option. modules/ipfw/Makefile Add ip_fw_pfil.c. net/bridge.c Disable PFIL_HOOKS if ipfw for bridging is active. Bridging ipfw is still directly invoked to handle layer2 headers and packets would get a double ipfw when run through PFIL_HOOKS as well. netinet/ip_divert.c Removed divert_clone() function. It is no longer used. netinet/ip_dummynet.[ch] Neither the route 'ro' nor the destination 'dst' need to be stored while in dummynet transit. Structure members and associated macros are removed. netinet/ip_fastfwd.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code. netinet/ip_fw.h Removed 'ro' and 'dst' from struct ip_fw_args. netinet/ip_fw2.c (Re)moved some global variables and the module handling. netinet/ip_fw_pfil.c New file containing the ipfw PFIL handlers and module initialization. netinet/ip_input.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code. ip_forward() does not longer require the 'next_hop' struct sockaddr_in argument. Disable early checks if 'srcrt' is set. netinet/ip_output.c Removed all direct ipfw handling code and replace it with the new 'ipfw forward' handling code. netinet/ip_var.h Add ip_reass() as general function. (Used from ipfw PFIL handlers for IPDIVERT.) netinet/raw_ip.c Directly check if ipfw and dummynet control pointers are active. netinet/tcp_input.c Rework the 'ipfw forward' to local code to work with the new way of forward tags. netinet/tcp_sack.c Remove include 'opt_ipfw.h' which is not needed here. sys/mbuf.h Remove m_claim_next() macro which was exclusively for ipfw 'forward' and is no longer needed. Approved by: re (scottl) Notes: svn path=/head/; revision=133920
* This is the netgraph node framework for the user side call controlHartmut Brandt2004-08-123-0/+1422
| | | | | | | node for ATM. This node implements the API to the signalling services. Notes: svn path=/head/; revision=133578
* Introduce ng_hci_inquiry_response structure and use it in the hccontrol(8)Maksim Yevmenkin2004-08-101-7/+10
| | | | Notes: svn path=/head/; revision=133415
* Implement minimalistic L2TP sessions statistics and correct man pageBjoern A. Zeeb2004-08-032-3/+104
| | | | | | | | | | for L2TP tunnel statistics (which do not take an argument sessionID). Reviewed by: archie Approved by: pjd (mentor) Notes: svn path=/head/; revision=133060
* add a new control message to set sequence numbers on an uninitialized node.Bjoern A. Zeeb2004-08-032-2/+79
| | | | | | | | Reviewed by: archie Approved by: pjd (mentor) Notes: svn path=/head/; revision=133058
* Correct L2TP header offset handling:Bjoern A. Zeeb2004-08-031-2/+2
| | | | | | | | | | | | - according to RFC2661 an offset size of 0 is allowed. - when skipping offset padding do not forget to also skip the 2 octets of the offset size field. Reviewed by: archie Approved by: pjd (mentor) Notes: svn path=/head/; revision=133056
* Do not change link[n].conf.latency for internal usage but haveBjoern A. Zeeb2004-08-031-3/+5
| | | | | | | | | | | | link[n].latency calculated from user supplied value. This prevents repeated NGM_PPP_SET_CONFIG/NGM_PPP_GET_CONFIG from failing because of link[n].conf.latency being out of range. Reviewed by: archie Approved by: pjd (mentor) Notes: svn path=/head/; revision=133055
* Another stupid error from my side. PPPOE_NONSTANDARD was first definedGleb Smirnoff2004-08-011-9/+9
| | | | | | | | | | | in enum {}, and then redefined with #define. No warnings from compiler, though. Submitted by: bz Pointy hat to: glebius Notes: svn path=/head/; revision=132975
* Fix a stupid error in my previous commit, which broke operationGleb Smirnoff2004-07-311-1/+2
| | | | | | | | | of many nodes. Pointy hat to: glebius Notes: svn path=/head/; revision=132939
* Address node in a less complex way.Gleb Smirnoff2004-07-291-1/+1
| | | | | | | Approved by: julian (mentor) Notes: svn path=/head/; revision=132828
* Avoid casts as lvalues.Alexander Kabaev2004-07-285-10/+14
| | | | Notes: svn path=/head/; revision=132780