aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_tty.c
Commit message (Collapse)AuthorAgeFilesLines
* net: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365071
* tty: convert tty_lock_assert to tty_assert_locked to hide lock typeKyle Evans2020-04-171-2/+2
| | | | | | | | | | | | | | | | | A later change, currently being iterated on in D24459, will in-fact change the lock type to an sx so that TTY drivers can sleep on it if they need to. Committing this ahead of time to make the review in question a little more palatable. tty_lock_assert() is unfortunately still needed for now in two places to make sure that the tty lock has not been recursed upon, for those scenarios where it's supplied by the TTY driver and possibly a mutex that is allowed to recurse. Suggested by: markj Notes: svn path=/head/; revision=360051
* Don't initialize m->m_data to m->m_pktdat, this is already done by theGleb Smirnoff2020-04-171-2/+0
| | | | | | | mbuf allocator. That was the last remnant of such code in the kernel. Notes: svn path=/head/; revision=360034
* sys/netgraph: spelling fixes in comments.Pedro F. Giffuni2016-04-291-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298813
* Remove ifq_drops from struct ifqueue. Now queue drops are accounted inGleb Smirnoff2014-09-191-1/+0
| | | | | | | | | | | | | struct ifnet if_oqdrops. Some netgraph modules used ifqueue w/o ifnet. Accounting of queue drops is simply removed from them. There were no API to read this statistic. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271856
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-051-2/+2
| | | | | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually Notes: svn path=/head/; revision=243882
* Node constructor methods are supposed to be called in syscallGleb Smirnoff2011-04-181-3/+1
| | | | | | | | | | context always. Convert nodes to consistently use M_WAITOK flag for memory allocation. Reviewed by: julian Notes: svn path=/head/; revision=220768
* When calling panic(), always pass a format string.Rui Paulo2010-10-131-2/+2
| | | | Notes: svn path=/head/; revision=213794
* Add new tunable 'net.link.ifqmaxlen' to set default send interfaceMaxim Sobolev2010-05-031-1/+1
| | | | | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month Notes: svn path=/head/; revision=207554
* Remove node shutdown on tty close. This could be easily done by user-levelAlexander Motin2008-12-131-11/+0
| | | | | | | | while it's present implementation with ng_rmnode_flags() is at least incorrect. Notes: svn path=/head/; revision=186059
* Change ttyhook_register() second argument from thread to process pointer.Alexander Motin2008-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). Notes: svn path=/head/; revision=186056
* Don't use curthread to resolve file descriptor. Request may be queued, soAlexander Motin2008-11-081-2/+10
| | | | | | | | thread will be different. Instead require sender to send process ID together with file descriptor. Notes: svn path=/head/; revision=184762
* Don't assign completely meaningless name to the node on creation.Alexander Motin2008-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. Notes: svn path=/head/; revision=184752
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).Dag-Erling Smørgrav2008-10-231-2/+2
| | | | | | | MFC after: 3 months Notes: svn path=/head/; revision=184205
* Update ng_tty for MPSAFE TTY.Andrew Thompson2008-10-031-454/+281
| | | | | | | | | | | | | | | | This changes from a line discipline to the tty_hooks mechanism. Data will come in directly via rint_bypass and sent to the peer node in a single mbuf. As line disciplines are no longer used a new netgraph command called NGM_TTY_SET_TTY is used to attach the tty. This takes a pointer to to the open file descriptor of the tty and registers the tty hooks. When the tty disappears the node will shutdown. Thanks to: ed Sponsored by: Hobnob, Inc Notes: svn path=/head/; revision=183562
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+3
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Use new (inline) functions for calls into driver.Poul-Henning Kamp2005-10-161-2/+1
| | | | Notes: svn path=/head/; revision=151387
* In ngt_input(), do not derefer sc (= (sc_p) tp->t_lsc) before makingSeigo Tanimura2005-10-081-2/+5
| | | | | | | sure sc != NULL. Notes: svn path=/head/; revision=151085
* Locking and cleanup of tty netgraph node. Tty stack is Giant-locked,Gleb Smirnoff2005-01-131-176/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | so we need to acquire Giant in netgraph methods, so that we don't race with line discipline methods. Remove NET_NEEDS_GIANT. - Packets coming into node from netgraph are queued in ifqueue attached to node private data. - Mutex in struct ifqueue is used to lock not only the queue, but the whole private data, and tp->t_lsc field. - tp->t_lsc pointer is used to indicate whether line discipline is attached to netgraph or not. - Use FLG_DIE flag to indicate that node may be destroyed. (This protection doesn't work, and it didn't before. Must be redesigned.) - Increment ngt_unit atomically, removing mutex. - Acquire Giant, when executing ngt_start() from netgraph context. - Acquire Giant, when {,de}registering line discipline. - Uncomment forcing queue mode on peers hook, since this is reasonable. - Force queue mode on our hook, to avoid acquiring Giant when coming from network stack. We may already hold some mutexes at this point. Cleanups: - Use callout_pending() instead of our own flag. - Remove spl(9) calls. Now we can use return() instead of ERROUT(). style(9): - Sort includes. - Sparse initializer for struct linesw. - Remove some empty lines, sort declarations. Reviewed by: julian, phk MFC after: 1 month Notes: svn path=/head/; revision=140164
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-1/+3
| | | | Notes: svn path=/head/; revision=139823
* Use ng_callout() instead of timeout(9).Gleb Smirnoff2004-12-051-7/+7
| | | | | | | Approved by: julian (mentor) Notes: svn path=/head/; revision=138420
* 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
* 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
* Add a mutex ng_tty_mtx to protect the global variable ngt_unit. NoteRobert Watson2004-07-141-0/+10
| | | | | | | | that the locking of globals here isn't complete, and there's also a locking issue relating to calling into and out of the tty code. Notes: svn path=/head/; revision=132163
* Fix line discipline switching issues: If opening a new ldisc fails,Poul-Henning Kamp2004-06-261-9/+2
| | | | | | | | | | | | | | | | we have to revert to TTYDISC which we know will successfully open rather than try the previous ldisc which might also fail to open. Do not let ldisc implementations muck about with ->t_line, and remove code which checks for reopens, it should never happen. Move ldisc->l_hotchar to tty->t_hotchar and have ldisc implementation initialize it in their open routines. Reset to zero when we enter TTYDISC. ("no" should really be -1 since zero could be a valid hotchar for certain old european mainframe protocols.) Notes: svn path=/head/; revision=131130
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-2/+2
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Switch to using C99 sparse initialisers for the type methods array.Julian Elischer2004-05-291-12/+10
| | | | | | | | | | | Should make no binary difference. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Reviewed by: Harti Brandt <harti@freebsd.org> MFC after: 1 week Notes: svn path=/head/; revision=129823
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-2/+2
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-2/+2
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-1/+1
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Get rid of the twisted MFREE() macro entirely.Matthew Dillon2002-02-051-3/+1
| | | | | | | | Reviewed by: dg, bmilekic MFC after: 3 days Notes: svn path=/head/; revision=90227
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-4/+4
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* KSE Milestone 2Julian Elischer2001-09-121-4/+4
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Remove unneeded includes in the i386 case.John Baldwin2001-05-151-5/+0
| | | | Notes: svn path=/head/; revision=76648
* Part 2 of the netgraph rewrite.Julian Elischer2001-01-081-18/+19
| | | | | | | | | This is mostly cosmetic changes, (though I caught a bug or two while makeing them) Reviewed by: archie@freebsd.org Notes: svn path=/head/; revision=70784
* Rewrite of netgraph to start getting ready for SMP.Julian Elischer2001-01-061-25/+21
| | | | | | | | | | | This version is functional and is aproaching solid.. notice I said APROACHING. There are many node types I cannot test I have tested: echo hole ppp socket vjc iface tee bpf async tty The rest compile and "Look" right. More changes to follow. DEBUGGING is enabled in this code to help if people have problems. Notes: svn path=/head/; revision=70700
* Divorce the kernel binary ABI version number from the messageJulian Elischer2000-12-181-1/+1
| | | | | | | | | | | | format version number. (userland programs should not need to be recompiled when the netgraph kernel internal ABI is changed. Also fix modules that don;t handle the fact that a caller may not supply a return message pointer. (benign at the moment because the calling code checks, but that will change) Notes: svn path=/head/; revision=70159
* Reviewed by: Archie@freebsd.orgJulian Elischer2000-12-121-4/+14
| | | | | | | | | | | | | | | | This clears out my outstanding netgraph changes. There is a netgraph change of design in the offing and this is to some extent a superset of soem of the new functionality and some of the old functionality that may be removed. This code works as before, but allows some new features that I want to work with and evaluate. It is the basis for a version of netgraph with integral locking for SMP use. This is running on my test machine with no new problems :-) Notes: svn path=/head/; revision=69922
* Add the use of M_ZERO to netgraph.David Malone2000-11-181-2/+1
| | | | | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Submitted by: archie Approved by: archie Notes: svn path=/head/; revision=68876
* Move suser() and suser_xxx() prototypes and a related #define fromPoul-Henning Kamp2000-10-291-1/+0
| | | | | | | | | | | | <sys/proc.h> to <sys/systm.h>. Correctly document the #includes needed in the manpage. Add one now needed #include of <sys/systm.h>. Remove the consequent 48 unused #includes of <sys/proc.h>. Notes: svn path=/head/; revision=67893
* Since neither archie nor I work at Whistle any more, change our emailJulian Elischer2000-10-241-1/+1
| | | | | | | | | addresses to be the more usefu @freebsd.org ones so we can keep getting bug-reports. - man pages to follow.. Notes: svn path=/head/; revision=67506
* Remove unnecessary #include's as reported by phk's script.Archie Cobbs2000-09-221-1/+0
| | | | Notes: svn path=/head/; revision=66260
* Major update to the way synchronization is done in the kernel. HighlightsJason Evans2000-09-071-13/+1
| | | | | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh Notes: svn path=/head/; revision=65557
* Two simple changes to the kernel internal API for netgraph modules,Julian Elischer2000-04-281-2/+3
| | | | | | | | | | to support future work in flow-control and 'packet reject/replace' processing modes. reviewed by: phk, archie Notes: svn path=/head/; revision=59728
* Use snprintf() instead of sprintf().Archie Cobbs2000-03-131-1/+1
| | | | Notes: svn path=/head/; revision=58012
* Remove a bunch of un-needed includes.Julian Elischer1999-12-071-2/+0
| | | | | | | Submitted by: phk@freebsd.org Notes: svn path=/head/; revision=54249
* Add two new generic control messages, NGM_ASCII2BINARY andArchie Cobbs1999-11-301-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | NGM_BINARY2ASCII, which convert control messages to ASCII and back. This allows control messages to be sent and received in ASCII form using ngctl(8), which makes ngctl a lot more useful. This also allows all the type-specific debugging code in libnetgraph to go away -- instead, we just ask the node itself to do the ASCII translation for us. Currently, all generic control messages are supported, as well as messages associated with the following node types: async, cisco, ksocket, and ppp. See /usr/share/examples/netgraph/ngctl for an example of using this. Also give ngctl(8) the ability to print out incoming data and control messages at any time. Eventually nghook(8) may be subsumed. Several other misc. bug fixes. Reviewed by: julian Notes: svn path=/head/; revision=53913
* When allocating a new PKTHDR mbuf, always set m->m_pkthdr.rcvif = NULL.Archie Cobbs1999-11-171-2/+2
| | | | Notes: svn path=/head/; revision=53284
* Add typedefs for node methodsJulian Elischer1999-11-011-8/+7
| | | | | | | Suggested by phk. Notes: svn path=/head/; revision=52752
* dang, deleted a lineJulian Elischer1999-10-231-1/+2
| | | | Notes: svn path=/head/; revision=52442