Commit Graph

147 Commits

Author SHA1 Message Date
Hartmut Brandt
8f52a59171 Don't remove the first mbuf in the chain if it got empty.
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.
2004-02-21 12:55:07 +00:00
Robert Watson
a557af222b Introduce a MAC label reference in 'struct inpcb', which caches
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
2003-11-18 00:39:07 +00:00
Bruce Evans
f9d801d6f7 Include <sys/malloc.h> for the declaration of malloc(), etc. instead
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).
2003-11-14 21:02:10 +00:00
Sam Leffler
7902224c6b o add a flags parameter to netisr_register that is used to specify
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
2003-11-08 22:28:40 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
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)
2003-10-31 18:32:15 +00:00
Hartmut Brandt
f345f5e020 The number of prefixes can never be negative so use an u_int for this. 2003-07-29 13:46:43 +00:00
Hartmut Brandt
dd937e32bd Make the ioctl() interface cleaner with regard to types: use size_t
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.
2003-07-29 13:32:10 +00:00
Hartmut Brandt
cd7a4fa6eb Silence a gcc-warning. Do this by inlining the macro-call. This is
not very nice - the compiler should just silently optimize away the
unused else clause.
2003-07-26 14:20:37 +00:00
Hartmut Brandt
a327640a9e Print the offending SPANS message only if printing is enabled. 2003-07-25 12:32:08 +00:00
Hartmut Brandt
ebcdc0a12e Add support for VBR and CBR PVCs for IP over ATM.
Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 weeks
2003-07-25 08:35:26 +00:00
Hartmut Brandt
69ba39416a Set the interface type of the network interfaces to IFT_IPOVERATM(114).
This is specified by RFC2320.
2003-07-25 07:16:28 +00:00
Hartmut Brandt
9b18b1f47d Hand the packet to bpf not only in the LLC/SNAP case, but for all
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>
2003-07-25 06:43:41 +00:00
Hartmut Brandt
6c373d607e Make the debugging variable that controls printing of UNI messages
accessible as a sysctl and move the debugging stuff out of DIAGNOSTICS.

Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 weeks
2003-07-25 06:39:46 +00:00
Hartmut Brandt
80366b6d6a Make the debugging variable that controls dumping of IP over ATM packets
accessible as a sysctl.

Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 weeks
2003-07-24 15:25:17 +00:00
Hartmut Brandt
5d53a37cb4 Create a sysctl that allows to enable/disable printing of SPANS messages.
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
2003-07-24 14:37:01 +00:00
Hartmut Brandt
892e9c9b57 Free the UNI vcc to the same zone from where it was allocated from.
This resulted in a panic when detaching the uni31 signalling manager.
2003-07-24 12:24:41 +00:00
Hartmut Brandt
fb4304eca0 Now that we have if_detach() don't try to get rid of all the interface
stuff (routes, ...) by hand - simply use if_detach().

Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 week
2003-07-24 11:17:36 +00:00
Hartmut Brandt
ca4125f7b3 Create a subtree 'harp' of the net sysctl tree. This uses a fixed
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
2003-07-24 10:33:01 +00:00
Hartmut Brandt
56acf6178a Constify the arguments to several pdu_print functions. 2003-07-24 09:13:03 +00:00
Hartmut Brandt
5be9a825e2 Add BPF support to HARP network interfaces. This allows one to see
the traffic on LLC multiplexed connections (like CLIP).

PR:		kern/51831
Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 weeks
2003-07-24 08:15:20 +00:00
Hartmut Brandt
3a1646de2a Handle the new MEDIA definitions. 2003-07-23 15:04:31 +00:00
Hartmut Brandt
06055f52f3 Convert a lot of uma_zalloc() calls to be NOWAIT instead of WAITOK. All
these may be called from contexts where we cannot sleep (callout handlers
for example).
2003-07-23 14:28:57 +00:00
Hartmut Brandt
e717cfbc40 Get rid of the zone for network interfaces. We have converted this to
use malloc(9).
2003-07-23 14:25:53 +00:00
Hartmut Brandt
05ab0ba3b5 Allocate network interfaces from malloc() instead of using a zone.
Usually one needs only a couple of them so using a zone is waste
of memory (esp. on multi-cpu systems).
2003-07-22 15:11:08 +00:00
Hartmut Brandt
b92ba02261 Remove the zone limits for all the zones used in the ATM code.
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.
2003-07-22 12:46:30 +00:00
Hartmut Brandt
3a6052bb2a Add several vendor, API and media definitions. This has been
forgotten in the previous commit to harp and should unbreak world.
2003-07-22 06:31:13 +00:00
Hartmut Brandt
084fb28576 Fix a number of occurences of calling uma_zalloc() with neither
M_WAITOK nor M_NOWAIT.
2003-07-18 16:36:41 +00:00
David E. O'Brien
81a6b595de Use __FBSDID(). 2003-06-11 07:22:30 +00:00
David E. O'Brien
f25de95508 Use __FBSDID(). 2003-06-11 07:11:35 +00:00
David E. O'Brien
f98c8ea46c Use __FBSDID(). 2003-06-11 07:06:31 +00:00
David E. O'Brien
050ae80c6f Use __FBSDID(). 2003-06-11 07:00:30 +00:00
David E. O'Brien
8368cf8f75 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +00:00
Jonathan Lemon
1cafed3941 Update netisr handling; Each SWI now registers its queue, and all queue
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
2003-03-04 23:19:55 +00:00
David E. O'Brien
1e44b62e0d There is no reason to be cute with ntohl(). Just call it directly rather
than use a macro that tries to do conversions in place.

Compile tested on:	sparc64
2003-02-23 22:26:39 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Poul-Henning Kamp
7baee2b7cf Band-XXX-aid an easy to provoke panic.
MFC:	2 weeks
2003-01-28 12:10:11 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Sam Leffler
9967cafc49 Correct mbuf packet header propagation. Previously, packet headers
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>
2002-12-30 20:22:40 +00:00
Jeffrey Hsu
decb81fec7 Indirectly pull in declaration for M_IFADDR. 2002-12-28 21:09:38 +00:00
Jeffrey Hsu
956b0b653c SMP locking for radix nodes. 2002-12-24 03:03:39 +00:00
Jeffrey Hsu
b30a244c34 SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
John Baldwin
672cc99ed3 - Change the ATM stack functions to use intptr_t instead of int for opaque
arguments.
- Fix a few other places that assumed that sizeof(int) == sizeof(void *).

Reviewed by:	mdodd
2002-11-08 18:27:30 +00:00
Matthew N. Dodd
f72e17e233 Add a field to struct cmn_unit to hold a pointer to the driver's softc. 2002-10-01 22:04:31 +00:00
Bruce Evans
65c66e222d Include <sys/systm.h> instead of depending on namespace pollution in
<net/if_var.h>.  But depend on the standard pollution in <sys/param.h>.
Removed unused includes.
2002-09-29 12:01:36 +00:00
Bruce Evans
6364993cd3 Include <sys/systm.h> instead of depending on namespace pollution in
<net/if_var.h>.  But depend on the standard pollution in <sys/param.h>.
2002-09-29 11:59:53 +00:00
Peter Wemm
d223099401 Make netatm/spans compile in the kernel without depending on userland
include files to provide functions for kernel source (spans_kxdr.c)
2002-09-17 08:57:52 +00:00
Philippe Charnier
93b0017f88 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
Maxim Sobolev
62f7648682 Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoid
breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in
SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's.

Reviewed by:	-hackers, -net
2002-08-18 07:05:00 +00:00