summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_iface.c
Commit message (Collapse)AuthorAgeFilesLines
* Check for infinite recursion possible on some broken PPTP/L2TP/... VPN setups.mav2009-01-201-0/+18
| | | | | | | Mark packets with mbuf_tag on first interface passage and drop on second. PR: ports/129625, ports/125303, MFC after: 2 weeks
* Conditionally compile out V_ globals while instantiating the appropriatezec2008-12-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* convert calls to IFQ_HANDOFF to if_transmitkmacy2008-11-221-1/+1
|
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-231-3/+3
| | | | MFC after: 3 months
* Step 1.5 of importing the network stack virtualization infrastructurezec2008-10-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs. Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT(). Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.). All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*). (*) netipsec/keysock.c did not validate depending on compile time options. Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* Back out r180370. It was not discussed with subsystem maintainers.gonzo2008-07-081-1/+1
|
* Queue decapsulated packed instead of performing direct dispatch. Somegonzo2008-07-081-1/+1
| | | | | | | | execution pathes might hit stack limit under certain circumstances (e.g. ng_mppc). PR: kern/125314 Reported by: Illya Klymov <ilia dot klimov at gmail dot com>
* Implement stack protection based on GET_STACK_USAGE() macro.mav2008-01-311-0/+1
| | | | | This fixes system panics possible with complicated netgraph setups and allows to avoid unneded extra queueing for stack unwrapping.
* add missed calls to bpf_peers_presentsam2006-06-021-1/+1
|
* Style and other fixes for the last commit.glebius2005-10-111-7/+9
| | | | Submitted by: ru
* ALTQ support for ng_iface(4). Before turning on please consult manual page.glebius2005-10-101-26/+68
|
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-10/+13
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* Fix some long standing bugs in writing to the BPF device attached todwmalone2005-06-261-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | a DLT_NULL interface. In particular: 1) Consistently use type u_int32_t for the header of a DLT_NULL device - it continues to represent the address family as always. 2) In the DLT_NULL case get bpf_movein to store the u_int32_t in a sockaddr rather than in the mbuf, to be consistent with all the DLT types. 3) Consequently fix a bug in bpf_movein/bpfwrite which only permitted packets up to 4 bytes less than the MTU to be written. 4) Fix all DLT_NULL devices to have the code required to allow writing to their bpf devices. 5) Move the code to allow writing to if_lo from if_simloop to looutput, because it only applies to DLT_NULL devices but was being applied to other devices that use if_simloop possibly incorrectly. PR: 82157 Submitted by: Matthew Luckie <mjl@luckie.org.nz> Approved by: re (scottl)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Don't init ifp->if_addrhead, if_attach() does it for us.brooks2005-04-031-1/+0
|
* Use subr_unit allocator instead of own functions.glebius2005-03-141-92/+5
|
* Create a per-module mutex on MOD_LOAD, and destroy it on MOD_UNLOAD.ru2005-02-051-1/+23
| | | | | | (This fixes witness_destroy() panic after module unload.) OK'ed by: rwatson, julian
* Parse "getifname" using the standard parse string type.ru2005-02-031-23/+6
| | | | | | | Fixed an off-by-one error when dealing with interface name (if_xname is NUL-terminated). Don't waste time making a copy of if_xname in constructor.
* Consider IFF_UP as "administratively up" flag, and IFF_RUNNING asglebius2005-01-141-2/+2
| | | | "operationally up" flag. Hence this, revert 1.35 to use IFF_RUNNING.
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+3
|
* Netgraph flow control: change interface status when node receiveglebius2004-11-231-0/+12
| | | | | | | LINK_IS_UP/LINK_IS_DOWN messages. Approved by: julian (mentor), implicitly MFC after: 1 week
* Introduce a new mutex, ng_iface_mtx, to protect the global unit listrwatson2004-07-141-1/+12
| | | | | | | | lock used to synchronize allocation of unit numbers for new netgraph interfaces. Reviewed by: glebius Tested by: glebius
* Consistently use __inline instead of __inline__ as the former is an empty macrostefanf2004-07-041-6/+6
| | | | in <sys/cdefs.h> for compilers without support for inline.
* Having moved metadata usage to mbuf tags, remove code that supportsjulian2004-06-261-2/+1
| | | | | | the old way of doing it. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Make the frameworkl responsible for not passing the nodes a NULL mbuf pointer.julian2004-06-251-2/+0
| | | | | | this allows the nodes to not test for this.. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Switch to using C99 sparse initialisers for the type methods array.julian2004-05-291-12/+9
| | | | | | | | Should make no binary difference. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Reviewed by: Harti Brandt <harti@freebsd.org> MFC after: 1 week
* Implemented the "getifindex" control message.ru2004-03-071-0/+16
| | | | | PR: kern/63864 Submitted by: Gleb Smirnoff
* o eliminate widespread on-stack mbuf use for bpf by introducingsam2003-12-281-8/+2
| | | | | | | | | | | | | a new bpf_mtap2 routine that does the right thing for an mbuf and a variable-length chunk of data that should be prepended. o while we're sweeping the drivers, use u_int32_t uniformly when when prepending the address family (several places were assuming sizeof(int) was 4) o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated mbufs have been eliminated; this may better be moved to the bpf routines Reviewed by: arch@ and several others
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-9/+8
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Introduce an M_ASSERTPKTHDR() macro which performs the very common taskdes2003-04-081-1/+1
| | | | | | | of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable. Submitted by: Hiten Pandya <hiten@unixdaemons.com>
* Include correct opt_* headers for supported address families. Dike outjlemon2003-03-081-10/+5
| | | | | | the unused ATM cases. Sponsored by: DARPA, NAI Labs
* Finish driving a stake through the heart of netns and the associatedpeter2003-03-051-6/+0
| | | | | | ifdefs scattered around the place - its dead Jim! The SMB stuff had stolen AF_NS, make it official.
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-041-3/+48
| | | | | | | | | | drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs
* o track changes to ethernet input packet handlingsam2002-11-141-1/+1
| | | | | | | | o track changes to bpf o track changes to make ng hooks more private Reviewed by: many Approved by: re
* Use if_printf(ifp, "blah") instead ofbrooks2002-10-211-1/+1
| | | | printf("%s%d: blah", ifp->if_name, ifp->if_xname).
* Fix GCC warnings caused by initializing a zero length array. In the process,archie2002-05-311-3/+3
| | | | | | | simply things a bit by getting rid of 'struct ng_parse_struct_info' which was useless because it only contained one field. MFC after: 2 weeks
* Update to C99, s/__FUNCTION__/__func__/,obrien2001-12-101-8/+8
| | | | also don't use ANSI string concatenation.
* Fix some memory leaksjulian2001-01-101-8/+25
| | | | Add memory leak detection assitance.
* Part 2 of the netgraph rewrite.julian2001-01-081-8/+8
| | | | | | This is mostly cosmetic changes, (though I caught a bug or two while makeing them) Reviewed by: archie@freebsd.org
* Rewrite of netgraph to start getting ready for SMP.julian2001-01-061-29/+14
| | | | | | | | 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.
* Divorce the kernel binary ABI version number from the messagejulian2000-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)
* Reviewed by: Archie@freebsd.orgjulian2000-12-121-2/+1
| | | | | | | | | | | | | 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 :-)
* Add the use of M_ZERO to netgraph.dwmalone2000-11-181-4/+2
| | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Submitted by: archie Approved by: archie
* Since neither archie nor I work at Whistle any more, change our emailjulian2000-10-241-1/+1
| | | | | | addresses to be the more usefu @freebsd.org ones so we can keep getting bug-reports. - man pages to follow..
* Allocate all memory (including within node constructors) with M_NOWAITarchie2000-09-211-3/+3
| | | | instead of M_WAITOK, to allow for maximum flexibility.
* Two simple changes to the kernel internal API for netgraph modules,julian2000-04-281-2/+3
| | | | | | | to support future work in flow-control and 'packet reject/replace' processing modes. reviewed by: phk, archie
* Call bpfdetach() before going away.archie2000-03-211-0/+1
|
* Updates to the ng_iface(8) netgraph node type:archie2000-03-131-176/+210
| | | | | | | | | | | - Make iface nodes removable on shutdown since FreeBSD now supports removable interfaces - Simplify supporting new protocols using family_enqueue(); add a few new ones including IPv6 - Add support for configurable interface mode using new NGM_IFACE_POINT2POINT and NGM_IFACE_BROADCAST control messages - Remove NGM_IFACE_GET_IFADDRS control message; it just duplicates the functionality of SIOCGIFCONF
* Remove a bunch of un-needed includes.julian1999-12-071-6/+0
| | | | Submitted by: phk@freebsd.org
OpenPOWER on IntegriCloud