Commit Graph

1268 Commits

Author SHA1 Message Date
mdodd
41e5cea499 - Use IFP2AC().
- Support IFF_MONITOR.
- Borrow some consistency for if_input() routines from if_ethersubr.c.
- Correct comments regarding fddi_input() that no longer apply.
2003-03-16 00:17:44 +00:00
mdodd
5e42320b6c Fix whitespace issues. 2003-03-15 23:55:33 +00:00
mdodd
30a8fe52b5 Don't strip header from packets before input routine is called. 2003-03-15 23:08:40 +00:00
mdodd
08b4bf73c6 Use if_printf(). 2003-03-15 23:02:36 +00:00
mdodd
3f4c96a9a0 iso88025_ifattach() changes:
- Call if_attach().
- Conditionally call bpfattach() based on second function argument.
2003-03-15 22:52:23 +00:00
mdodd
5ad71fcdc1 - Style(9) changes.
- Remove unneeded assignment.
- Increment if_oerrors as per if_fddisubr.c.
- Wrap ISO code with conditional.
2003-03-15 22:37:11 +00:00
mdodd
425161bc55 Stray } forgotten by manual merging. 2003-03-15 22:28:51 +00:00
mdodd
c1cc7fd6fc - Remove stray ).
- Add missing breaks.
- Add missing if_noproto++.
2003-03-15 22:25:06 +00:00
mdodd
e0526727e5 Revert part of 1.37; use bcopy() like if_fddisubr.c. 2003-03-15 22:09:29 +00:00
mdodd
41dd3f659d - Increment ifp->if_noproto when appropriate.
- Use 'goto dropanyway' when appropriate.
- Move dropanyway label out of switch for readability.
2003-03-15 21:59:11 +00:00
mdodd
d16675cd85 Update interface statistics after MAC and IFF_UP|IFF_RUNNING checks. 2003-03-15 21:51:39 +00:00
mdodd
b4d176598f - Adopt tests for (IFF_UP|IFF_RUNNING) and non local unicast packets
in promiscuous mode from if_fddisubr.c.
- Add comment to reduce diffs.
2003-03-15 21:42:19 +00:00
mdodd
b9f3e4fdb7 Add MAC support.
This is the same code that was added in 1.70 of if_fddisubr.c
2003-03-15 21:30:00 +00:00
mdodd
0e40955002 Use llc_control rather than llc_snap.control. 2003-03-15 20:35:19 +00:00
mdodd
7603a4a452 - Add comment.
- Whitespace fixes.
2003-03-15 20:33:30 +00:00
mdodd
af74801cd5 Reduce code differences. 2003-03-15 19:37:44 +00:00
mdodd
46d76d5c4c Use ISO88025_ADDR_LEN where appropriate. 2003-03-15 19:25:00 +00:00
mdodd
e0b9aba465 Don't use etherbroadcastaddr; use iso88025_broadcastaddr. 2003-03-15 19:16:39 +00:00
mdodd
093d40edb1 - Remove definition of senderr() from iso88025.h.
- Use definition of senderr() from if_ethersubr.c.
2003-03-15 19:10:19 +00:00
mdodd
ce9f489746 Some whitespace/style/readability changes. 2003-03-15 17:54:49 +00:00
mdodd
59ae65862f Add iso88025_resolvemulti().
Cribbed from net/if_fddisubr.c
2003-03-15 16:49:08 +00:00
mdodd
5093ecd00f Fix formatting of iso88025_ifattach(). 2003-03-15 16:41:35 +00:00
mdodd
f1887e0da7 Re-order and prune includes. 2003-03-15 16:37:28 +00:00
mdodd
9cb5290df7 Add module data and version. 2003-03-15 15:38:02 +00:00
mdodd
1c36442d83 s/llc_un.type_snap/llc_snap/g 2003-03-15 15:35:25 +00:00
mdodd
665939da8f Formatting and whitespace changes. 2003-03-15 15:09:11 +00:00
harti
928f52e38a This corrects a longstanding endian bug in processing LLC/SNAP encoded
frames. A comment in if_atm.h suggests that both macros, that for extracting
the ethertype and that for inserting it, handle their argument in host
byte order. In fact, the inserting macro treated its argument as an opposite
host order short and the calling code feeds it the result of htons(). This
happens to work on i386, but fails on sparc. Make the macro use real host
endianess.

Reviewed by:	kjc, atm@
2003-03-13 12:44:06 +00:00
mux
9e54553707 Pass the correct malloc flags to m_tag_alloc(). 2003-03-13 00:30:31 +00:00
sam
e0702e06b4 correct two more flag misuses; m_tag* use malloc flags 2003-03-12 14:45:22 +00:00
phk
2fe1f6204d Note that MAJOR_AUTO is now the default if d_maj is not initialized. This
is more robust and prevents the hijacking of /dev/console for the typical
mistake.

Remove unneeded MAJOR_AUTO uses, it is only needed explicitly now if the
driver source has cross-branch compatibility to old releases.
2003-03-09 11:03:45 +00:00
jlemon
d41507bc4f Discard the packet if the netisr queue is null instead of panicing, for
the benefit of modules which are compiled differently than the kernel.
2003-03-08 22:12:32 +00:00
jlemon
95fa81544f Revert last change and insure the driver can support other address families.
Pointed out by: ume, matusita
2003-03-08 17:32:21 +00:00
jlemon
3d6036b6f4 The tun driver is INET only. Don't pretend to support other address families.
Sponsored by: DARPA, NAI Labs
2003-03-08 16:26:34 +00:00
peter
fbc7526e8f Finish driving a stake through the heart of netns and the associated
ifdefs scattered around the place - its dead Jim!

The SMB stuff had stolen AF_NS, make it official.
2003-03-05 19:24:24 +00:00
jlemon
964a2116a0 GC unused files. 2003-03-04 23:28:19 +00:00
jlemon
04e28d5a81 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
phk
b67232b68c Make nokqfilter() return the correct return value.
Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers.
2003-03-03 16:24:47 +00:00
phk
0ae911eb0e Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
mdodd
3b02e497a0 Revert last commit. File tracks NetBSD.
Requested by:	 sam
2003-03-03 06:09:18 +00:00
mdodd
587970fdc3 sizeof(struct llc) -> LLC_SNAPFRAMELEN
sizeof(struct ether_header) -> ETHER_HDR_LEN
 sizeof(struct fddi_header) -> FDDI_HDR_LEN
2003-03-03 05:04:57 +00:00
mdodd
ae4db1f082 Use IFP2AC() rather than casting to struct arpcom * 2003-03-03 00:30:02 +00:00
mdodd
cd44ce8ede De-register. 2003-03-03 00:21:52 +00:00
mdodd
cd4fafb346 Reduce code duplication. This adds the function rt_check() to route.c.
Approved by:	 sam (in principle)
2003-03-02 21:34:37 +00:00
des
2756b6c964 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
des
7b016a11e6 Clean up whitespace, s/register //, refrain from strong urge to ANSIfy. 2003-03-02 15:56:49 +00:00
des
765ebc59b4 uiomove-related caddr_t -> void * (just the low-hanging fruit) 2003-03-02 15:50:23 +00:00
mux
a1b221af52 Make the network /dev entries use MAJOR_AUTO. 2003-02-28 18:04:42 +00:00
phk
2800385f67 NODEVFS cleanup: remove calls to cdevsw_remove() 2003-02-26 20:20:58 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
sam
9c501577a6 remove stray debugging printf
Noted by:	Kasper Steensgaard <steensgaard@person.dk>
2003-02-18 06:25:46 +00:00
maxim
0e0fc7fd7e o Restore an interrupt priority level before return.
Submitted by:	Roman Kurakin <rik@cronyx.ru>
Reviewed by:	joerg
MFC after:	5 days
2003-02-17 13:41:55 +00:00
phk
4bfb37f22e Remove #include <sys/dkstat.h> 2003-02-16 14:13:23 +00:00
peter
a6f0140de9 Do not do an assignment in a truth test (previous commit) or gcc gives a
warning which breaks builds.

cc1: warnings being treated as errors
src/sys/net/bridge.c: In function `bdg_forward':
sys/net/bridge.c:931: warning: suggest parentheses around assignment used as truth value
*** Error code 1
2003-02-12 19:34:34 +00:00
sam
b65dfed25b PFIL_HOOKS optimization: check if at least one hook is present before
munging the IP header to pass to the hooks
2003-02-11 21:48:20 +00:00
hsu
7d8a20cfb4 Make the radix tree code compilable in userland. Requested by ru.
Some style fixes requested by bde.
2003-02-08 01:44:09 +00:00
phk
0f2a6b3b40 A minor stylistic change to make it more clear to lint-like tools. 2003-02-02 18:15:28 +00:00
alfred
499b47780f chase more of the MIN/MAX mess. *sigh* 2003-02-02 13:52:25 +00:00
alfred
b5c0015ac9 Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
2003-02-02 13:17:30 +00:00
fjoe
8bfc65ceab - bpf is now working (tested with tcpdump)
- fix promiscious mode

MFC after:	3 days
2003-01-30 15:55:02 +00:00
phk
2cccc29f2e NODEVFS cleanup: unifdef 2003-01-30 13:13:11 +00:00
hsu
251a68e729 Avoid lock order reversal by expanding the scope of the
AF_INET radix tree lock to cover the ARP data structures.
2003-01-28 20:22:19 +00:00
fjoe
fc2f60400f - add support for IPX (tested with mount -t nwfs and mars_nwe),
IP fast forwarding, SIOCGIFADDR, setting hardware address (not currently
enabled in cm driver), multicasts (experimental)
- add ARC_MAX_DATA, use IF_HANDOFF, remove arc_sprintf() and some unused
variables
- if_simloop logic is made more similar to ethernet
- drop not ours packets early (if we are not in promiscous mode)

Submitted by:	mark tinguely (partially)
2003-01-24 01:32:20 +00:00
fenner
9451b78569 Implement SIOCGIFMEDIA for vlan devices by passing the request to the
parent device, if there is a parent configured.  Modify the result
 returned by the parent to indicate that the only supported media
 is the currently configured one.

Reviewed by:	brooks
2003-01-22 23:30:26 +00:00
alfred
bf8e8a6e8f 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
sam
e74e7998d8 o add BIOCGDLTLIST and BIOCSDLT ioctls to get the data link type list
and set the link type for use by libpcap and tcpdump
o move mtx unlock in bpfdetach up; it doesn't need to be held so long
o change printf in bpf_detach to distinguish it from the same one in bpfsetdlt

Note there are locking issues here related to ioctl processing; they
have not been addressed here.

Submitted by:	Guy Harris <guy@alum.mit.edu>
Obtained from:	NetBSD (w/ locking modifications)
2003-01-20 19:08:46 +00:00
sam
31d113863a accept short WEP keys for backward compatibility 2003-01-19 20:13:43 +00:00
phk
24596ddb76 Originally when DEVFS was added, a global variable "devfs_present"
was used to control code which were conditional on DEVFS' precense
since this avoided the need for large-scale source pollution with
#include "opt_geom.h"

Now that we approach making DEVFS standard, replace these tests
with an #ifdef to facilitate mechanical removal once DEVFS becomes
non-optional.

No functional change by this commit.
2003-01-19 11:03:07 +00:00
sam
b08ba87858 fix ioctl handling for setting wep keys 2003-01-19 07:08:03 +00:00
suz
c5f56c61a9 sync with KAME to simplify rev 1.28's patch (no functional changes)
Obtained from: KAME
Reviewd by: fenner
Approved by: re (jhb)
2003-01-15 20:09:52 +00:00
sam
5e8fe5ba3b 802.11 link layer support. This code implements the basic 802.11
state machine to provide station and host ap functionality for drivers.

More work will follow to split out the state machine and protocol
support from the ioctl interfaces to ease portability/sharing with
NetBSD and forthcoming ports to other systems.

Reviewed by:	imp
Obtained from:	NetBSD (originally)
2003-01-15 20:01:50 +00:00
sam
01e5d3cdfd don't reference a pkthdr after M_MOVE_PKTHDR has "remove it"; instead
reference the pkthdr now in the destination of the move

Sponsored by:	Vernier Networks
2003-01-06 21:33:54 +00:00
fenner
24aad6f8c0 Fix alignment problems -- the embedded v4 address is guaranteed to
be only 16-bit aligned, so only do byte operations to compare with it.
2003-01-05 14:03:26 +00:00
schweikh
d3367c5f5d Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
schweikh
86f7487fb6 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
b16cb0a948 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
phk
7ca9207489 Remove cdevw_add() calls, they are deprecated. 2002-12-28 21:40:20 +00:00
kbyanc
6b9088d956 Remove useless local variable from raw_input().
Sponsored by:	NTT Multimedia Communications Labs
MFC after:	3 days
2002-12-28 02:29:19 +00:00
iedowse
f6258ba488 Oops, I misread the purpose of the NULL check in EH_RESTORE() in
revision 1.62. It was checking for M_PREPEND() failing, not for the
case of a NULL mbuf pointer being supplied to the macro. Back out
that revision, and fix the NULL dereference by not calling EH_RESTORE()
in the case where the mbuf pointer is NULL because the firewall
rejected the packet.
2002-12-27 17:15:16 +00:00
iedowse
c2502c00ea Fix a bug introduced by revision 1.59 that would cause an immediate
NULL dereference if a bridged packet was rejected by ipfw.
2002-12-27 16:27:45 +00:00
hsu
da4baeac50 Long chain of calls starting with bridge_on(), going through IPv6, and
ending up at ifa_ifwithdstaddr() could lead to a recursive lock of
the ifnet list mutex.
2002-12-27 00:24:35 +00:00
hsu
b694af1793 Disable radix node locking for sysctl until we fix the sysctl infrastructure
to not sleep.
2002-12-26 03:35:57 +00:00
ru
49cf357a3a Typo in function name. 2002-12-25 11:40:53 +00:00
ru
b76b929c69 I'm not sure what was the problem at the time of revision 1.37
when julian@ added it, but the commented out code had at least
one bug -- not freeing the allocated mbuf.

Anyway, this comment no longer applies as of revision 1.67, so
remove it.
2002-12-25 10:55:44 +00:00
hsu
909e09e1f0 Range-check the address family parameter passed in to the sysctl handler.
Submitted by:	ru
2002-12-25 10:51:20 +00:00
ru
1a22b7a8aa Revision 1.67 changes correspond to CSRG revision 8.3.1.1 changes. 2002-12-25 10:50:08 +00:00
ru
2719b5ea8c If the caller of rtrequest*(RTM_DELETE, ...) asked for a copy of
the entry being removed (ret_nrt != NULL), increment the entry's
rt_refcnt like we do it for RTM_ADD and RTM_RESOLVE, rather than
messing around with 1->0 transitions for rtfree() all over.
2002-12-25 10:21:02 +00:00
ru
94490dce08 A month after pst@ has committed his revision 1.8, it was
incorporated by UCB as revision 8.5.  Do a diff reduction.
2002-12-25 09:16:58 +00:00
hsu
32436a25c0 SMP locking for radix nodes. 2002-12-24 03:03:39 +00:00
ru
6b01296394 rn_walktree*() compute the next leaf before applying a function
to current leaves because function may vanish the current node.

If parent RTA_GENMASK route has a clone (a "cloning clone"), an
rn_walktree_from() starting from parent will cause another walk
starting from clone.  If a function is either rt_fixdelete() or
rt_fixchange(), this recursive walk may vanish the leaf that is
remembered by an outer walk (the "next leaf" above), panicing a
system when it resumes with an outer walk.

The following script paniced my single-user mode booted system:

: sysctl net.inet.ip.forwarding=1
: ipfw add 1 allow ip from any to any
: ifconfig lo0 127.1
: route add -net 10 -genmask 255.255.255.0 127.1
: telnet 10.1			# rt_fixchange() panic
: telnet 10.2
: telnet 10.1
: route delete -net 10		# rt_fixdelete() panic

For the time being, avoid these races by disallowing recursive
walks in rt_fixchange() and rt_fixdelete().

Also, make a slight optimization in the rtrequest(RTM_RESOLVE)
case: there is no reason to call rt_fixchange() in this case.

PR:		kern/37606
MFC after:	5 days
2002-12-23 13:12:41 +00:00
hsu
82e1e3bab0 SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
hsu
54f0b4be8b Swap the order of a free and a use of an ifaddr structure. 2002-12-20 11:21:07 +00:00
bmilekic
514c635ee6 o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}.
o Fix a bpf_compat issue where malloc() was defined to just call
  bpf_alloc() and pass the 'canwait' flag(s) along.  It's been changed
  to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT
  flag (and only one of those two).

Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
2002-12-19 22:58:27 +00:00
rwatson
bd8533b1a2 Under some circumstances, the loopback interface will allocate a new
mbuf for a packet looping back to provide alignment guarantees for
KAME.  Unfortunately, this code performs a direct copy of the header
rather than using a header copying primitive (largely because we have
sucky header copying primitives).  This results in a multiple free
of the MAC label in the header when the same label data is freed
twice when the two mbufs with that header are freed.  As a temporary
work-around, clear the initialized flag on the label to prevent the
duplicate free, which prevents panics on large unaligned loopback
IP and IPv6 data.  The real fix is to improve and make use of proper
packet header copying routines here.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-12-18 15:34:17 +00:00
hsu
160081aef6 Switch to the conventional reference counting scheme. 2002-12-18 12:41:03 +00:00
hsu
c3153934cb Lock up ifaddr reference counts. 2002-12-18 11:46:59 +00:00
sobomax
6da27e4c8e MFS: recognize gre packets used in the WCCP protocol.
Approved by:	re
2002-12-07 14:22:05 +00:00
luigi
f51d989644 Move fw_one_pass from ip_fw2.c to ip_input.c so that neither
bridge.c nor if_ethersubr.c depend on IPFIREWALL.
Restore the use of fw_one_pass in if_ethersubr.c

ipfw.8 will be updated with a separate commit.

Approved by: re
2002-11-20 19:07:27 +00:00
luigi
abbf6b6090 Back out some style changes. They are not urgent,
I will put them back in after 5.0 is out.

Requested by: sam
Approved by: re
2002-11-20 19:00:54 +00:00
sam
b34e17ef8c correct function declarations of stubs used for building w/o device bpf 2002-11-19 02:50:46 +00:00
luigi
7b7b521d96 Replace m_copy() with m_copypacket() where applicable.
Replace 0 with NULL where appropriate.
Fix indentation and function headers.
2002-11-17 18:14:04 +00:00