summaryrefslogtreecommitdiffstats
path: root/sys/netatm
Commit message (Collapse)AuthorAgeFilesLines
* Initialize struct pr_userreqs in new/sparse style and fill in commonphk2004-11-082-42/+27
| | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities.
* Push acquisition of the accept mutex out of sofree() into the callerrwatson2004-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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>
* Avoid casts as lvalues.kan2004-07-281-4/+4
|
* Fix a typo that could provoke a panic or access to random memory.harti2004-07-191-1/+1
| | | | | PR: kern/67012 Submitted by: Zhenmin <zli4@cs.uiuc.edu>
* The socket field so_state is used to hold a variety of socket relatedrwatson2004-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | flags relating to several aspects of socket functionality. This change breaks out several bits relating to send and receive operation into a new per-socket buffer field, sb_state, in order to facilitate locking. This is required because, in order to provide more granular locking of sockets, different state fields have different locking properties. The following fields are moved to sb_state: SS_CANTRCVMORE (so_state) SS_CANTSENDMORE (so_state) SS_RCVATMARK (so_state) Rename respectively to: SBS_CANTRCVMORE (so_rcv.sb_state) SBS_CANTSENDMORE (so_snd.sb_state) SBS_RCVATMARK (so_rcv.sb_state) This facilitates locking by isolating fields to be located with other identically locked fields, and permits greater granularity in socket locking by avoiding storing fields with different locking semantics in the same short (avoiding locking conflicts). In the future, we may wish to coallesce sb_state and sb_flags; for the time being I leave them separate and there is no additional memory overhead due to the packing/alignment of shorts in the socket buffer structure.
* Extend coverage of SOCK_LOCK(so) to include so_count, the socketrwatson2004-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
* Remove an #if section originally written for Sun compilers.stefanf2004-06-081-8/+0
|
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)trhodes2004-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to build the kernel. It doesn't affect the operation if gcc. Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as icc v8 may define __GNUC__ some parts may look strange but are necessary. Additional changes: - in_cksum.[ch]: * use a generic C version instead of the assembly version in the !gcc case (ASM code breaks with the optimizations icc does) -> no bad checksums with an icc compiled kernel Help from: andre, grehan, das Stolen from: alpha version via ppc version The entire checksum code should IMHO be replaced with the DragonFly version (because it isn't guaranteed future revisions of gcc will include similar optimizations) as in: ---snip--- Revision Changes Path 1.12 +1 -0 src/sys/conf/files.i386 1.4 +142 -558 src/sys/i386/i386/in_cksum.c 1.5 +33 -69 src/sys/i386/include/in_cksum.h 1.5 +2 -0 src/sys/netinet/igmp.c 1.6 +0 -1 src/sys/netinet/in.h 1.6 +2 -0 src/sys/netinet/ip_icmp.c 1.4 +3 -4 src/contrib/ipfilter/ip_compat.h 1.3 +1 -2 src/sbin/natd/icmp.c 1.4 +0 -1 src/sbin/natd/natd.c 1.48 +1 -0 src/sys/conf/files 1.2 +0 -1 src/sys/conf/files.amd64 1.13 +0 -1 src/sys/conf/files.i386 1.5 +0 -1 src/sys/conf/files.pc98 1.7 +1 -1 src/sys/contrib/ipfilter/netinet/fil.c 1.10 +2 -3 src/sys/contrib/ipfilter/netinet/ip_compat.h 1.10 +1 -1 src/sys/contrib/ipfilter/netinet/ip_fil.c 1.7 +1 -1 src/sys/dev/netif/txp/if_txp.c 1.7 +1 -1 src/sys/net/ip_mroute/ip_mroute.c 1.7 +1 -2 src/sys/net/ipfw/ip_fw2.c 1.6 +1 -2 src/sys/netinet/igmp.c 1.4 +158 -116 src/sys/netinet/in_cksum.c 1.6 +1 -1 src/sys/netinet/ip_gre.c 1.7 +1 -2 src/sys/netinet/ip_icmp.c 1.10 +1 -1 src/sys/netinet/ip_input.c 1.10 +1 -2 src/sys/netinet/ip_output.c 1.13 +1 -2 src/sys/netinet/tcp_input.c 1.9 +1 -2 src/sys/netinet/tcp_output.c 1.10 +1 -1 src/sys/netinet/tcp_subr.c 1.10 +1 -1 src/sys/netinet/tcp_syncache.c 1.9 +1 -2 src/sys/netinet/udp_usrreq.c 1.5 +1 -2 src/sys/netinet6/ipsec.c 1.5 +1 -2 src/sys/netproto/ipsec/ipsec.c 1.5 +1 -1 src/sys/netproto/ipsec/ipsec_input.c 1.4 +1 -2 src/sys/netproto/ipsec/ipsec_output.c and finally remove sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h ---snip--- - endian.h: * DTRT in C++ mode - quad.h: * we don't use gcc v1 anymore, remove support for it Suggested by: bde (long ago) - assym.h: * avoid zero-length arrays (remove dependency on a gcc specific feature) This change changes the contents of the object file, but as it's only used to generate some values for a header, and the generator knows how to handle this, there's no impact in the gcc case. Explained by: bde Submitted by: Marius Strobl <marius@alchemy.franken.de> - aicasm.c: * minor change to teach it about the way icc spells "-nostdinc" Not approved by: gibbs (no reply to my mail) - bump __FreeBSD_version (lang/icc needs to know about the changes) Incarnations of this patch survive gcc compiles since a loooong time, I use it on my desktop. An icc compiled kernel works since Nov. 2003 (exceptions: snd_* if used as modules), it survives a build of the entire ports collection with icc. Parts of this commit contains suggestions or submissions from Marius Strobl <marius@alchemy.franken.de>. Reviewed by: -arch Submitted by: netchild
* Don't remove the first mbuf in the chain if it got empty.harti2004-02-211-7/+6
| | | | | | | | This removes the packet header in certain cases which later on will give panic. Clarify what the atm_intr expects in the comment and de-obscurify the code a little bit by replacing the portability macros with the BSD names. The code isn't maintained externally anymore so there's no point in keeping the extra level of obscurity.
* Introduce a MAC label reference in 'struct inpcb', which cachesrwatson2003-11-182-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the MAC label referenced from 'struct socket' in the IPv4 and IPv6-based protocols. This permits MAC labels to be checked during network delivery operations without dereferencing inp->inp_socket to get to so->so_label, which will eventually avoid our having to grab the socket lock during delivery at the network layer. This change introduces 'struct inpcb' as a labeled object to the MAC Framework, along with the normal circus of entry points: initialization, creation from socket, destruction, as well as a delivery access control check. For most policies, the inpcb label will simply be a cache of the socket label, so a new protocol switch method is introduced, pr_sosetlabel() to notify protocols that the socket layer label has been updated so that the cache can be updated while holding appropriate locks. Most protocols implement this using pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use the the worker function in_pcbsosetlabel(), which calls into the MAC Framework to perform a cache update. Biba, LOMAC, and MLS implement these entry points, as do the stub policy, and test policy. Reviewed by: sam, bms Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Include <sys/malloc.h> for the declaration of malloc(), etc. insteadbde2003-11-141-3/+5
| | | | | | of depending on namespace pollution 2 layers deep in <vm/uma.h>. Fixed most nearby include messes (another like this, several the opposite of this, and some formatting).
* o add a flags parameter to netisr_register that is used to specifysam2003-11-081-1/+3
| | | | | | | | | | | | | | | | whether or not the isr needs to hold Giant when running; Giant-less operation is also controlled by the setting of debug_mpsafenet o mark all netisr's except NETISR_IP as needing Giant o add a GIANT_REQUIRED assertion to the top of netisr's that need Giant o pickup Giant (when debug_mpsafenet is 1) inside ip_input before calling up with a packet o change netisr handling so swi_net runs w/o Giant; instead we grab Giant before invoking handlers based on whether the handler needs Giant o change netisr handling so that netisr's that are marked MPSAFE may have multiple instances active at a time o add netisr statistics for packets dropped because the isr is inactive Supported by: FreeBSD Foundation
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-318-30/+22
| | | | | | | | | | | | | 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)
* The number of prefixes can never be negative so use an u_int for this.harti2003-07-291-1/+1
|
* Make the ioctl() interface cleaner with regard to types: use size_tharti2003-07-2911-46/+54
| | | | | | instead of int where the variable has to hold buffer lengths, use u_int for things like number of network interfaces which in principle can never be negative.
* Silence a gcc-warning. Do this by inlining the macro-call. This isharti2003-07-261-2/+1
| | | | | not very nice - the compiler should just silently optimize away the unused else clause.
* Print the offending SPANS message only if printing is enabled.harti2003-07-251-1/+2
|
* Add support for VBR and CBR PVCs for IP over ATM.harti2003-07-255-6/+205
| | | | | Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Set the interface type of the network interfaces to IFT_IPOVERATM(114).harti2003-07-251-1/+1
| | | | This is specified by RFC2320.
* Hand the packet to bpf not only in the LLC/SNAP case, but for allharti2003-07-252-13/+13
| | | | | | | connections. While this confuses tcpdump, it enables other applications to see and analyze non-IP traffic (signalling, for example). Pointed out by: Vincent Jardin <vjardin@wanadoo.fr>
* Make the debugging variable that controls printing of UNI messagesharti2003-07-255-15/+29
| | | | | | | accessible as a sysctl and move the debugging stuff out of DIAGNOSTICS. Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Make the debugging variable that controls dumping of IP over ATM packetsharti2003-07-244-10/+19
| | | | | | | accessible as a sysctl. Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Create a sysctl that allows to enable/disable printing of SPANS messages.harti2003-07-243-17/+15
| | | | | | | While here delete to sys/types.h includes when sys/param.h is also included. Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Free the UNI vcc to the same zone from where it was allocated from.harti2003-07-242-3/+3
| | | | This resulted in a panic when detaching the uni31 signalling manager.
* Now that we have if_detach() don't try to get rid of all the interfaceharti2003-07-241-95/+5
| | | | | | | stuff (routes, ...) by hand - simply use if_detach(). Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 week
* Create a subtree 'harp' of the net sysctl tree. This uses a fixedharti2003-07-243-3/+31
| | | | | | | | | OID as the other protocol family sub-trees do, that is equal to the protocol family identifier. Make the ATM layer debugging flags available under this tree. Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Constify the arguments to several pdu_print functions.harti2003-07-249-33/+18
|
* Add BPF support to HARP network interfaces. This allows one to seeharti2003-07-243-0/+37
| | | | | | | | the traffic on LLC multiplexed connections (like CLIP). PR: kern/51831 Submitted by: Vincent Jardin <vjardin@wanadoo.fr> MFC after: 2 weeks
* Handle the new MEDIA definitions.harti2003-07-231-0/+9
|
* Convert a lot of uma_zalloc() calls to be NOWAIT instead of WAITOK. Allharti2003-07-239-30/+48
| | | | | these may be called from contexts where we cannot sleep (callout handlers for example).
* Get rid of the zone for network interfaces. We have converted this toharti2003-07-231-7/+0
| | | | use malloc(9).
* Allocate network interfaces from malloc() instead of using a zone.harti2003-07-221-6/+6
| | | | | Usually one needs only a couple of them so using a zone is waste of memory (esp. on multi-cpu systems).
* Remove the zone limits for all the zones used in the ATM code.harti2003-07-2213-21/+14
| | | | | | | | | | | These were a left over from when the private memory pools were converted to use uma zones. The limit of UMA zones, however, works differently. When a zone is limited to only one or two pages than, on multi-cpu systems, processes can get stuck on the zonelimit, because all remaining free items are in caches of other CPUs. Also add rudimentary error handling in some places (panic) when a zone cannot be created.
* Add several vendor, API and media definitions. This has beenharti2003-07-221-5/+27
| | | | forgotten in the previous commit to harp and should unbreak world.
* Fix a number of occurences of calling uma_zalloc() with neitherharti2003-07-182-13/+13
| | | | M_WAITOK nor M_NOWAIT.
* Use __FBSDID().obrien2003-06-1136-355/+108
|
* Use __FBSDID().obrien2003-06-119-81/+26
|
* Use __FBSDID().obrien2003-06-112-19/+6
|
* Use __FBSDID().obrien2003-06-1116-155/+48
|
* Use __FBSDID rather than rcsid[].obrien2003-04-031-9/+3
|
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-044-49/+30
| | | | | | | | | | 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
* There is no reason to be cute with ntohl(). Just call it directly ratherobrien2003-02-235-22/+8
| | | | | | than use a macro that tries to do conversions in place. Compile tested on: sparc64
* Back out M_* changes, per decision of the TRB.imp2003-02-1922-71/+71
| | | | Approved by: trb
* Band-XXX-aid an easy to provoke panic.phk2003-01-281-0/+7
| | | | MFC: 2 weeks
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-2123-83/+83
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,schweikh2003-01-013-3/+3
| | | | especially in troff files.
* Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/schweikh2002-12-303-5/+5
| | | | Add FreeBSD Id tag where missing.
* Correct mbuf packet header propagation. Previously, packet headerssam2002-12-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | were sometimes propagated using M_COPY_PKTHDR which actually did something between a "move" and a "copy" operation. This is replaced by M_MOVE_PKTHDR (which copies the pkthdr contents and "removes" it from the source mbuf) and m_dup_pkthdr which copies the packet header contents including any m_tag chain. This corrects numerous problems whereby mbuf tags could be lost during packet manipulations. These changes also introduce arguments to m_tag_copy and m_tag_copy_chain to specify if the tag copy work should potentially block. This introduces an incompatibility with openbsd which we may want to revisit. Note that move/dup of packet headers does not handle target mbufs that have a cluster bound to them. We may want to support this; for now we watch for it with an assert. Finally, M_COPYFLAGS was updated to include M_FIRSTFRAG|M_LASTFRAG. Supported by: Vernier Networks Reviewed by: Robert Watson <rwatson@FreeBSD.org>
* Indirectly pull in declaration for M_IFADDR.hsu2002-12-281-0/+1
|
* SMP locking for radix nodes.hsu2002-12-241-0/+2
|
OpenPOWER on IntegriCloud