Commit Graph

651 Commits

Author SHA1 Message Date
Jun-ichiro itojun Hagino 686cdd19b1 sync with kame tree as of july00. tons of bug fixes/improvements.
API changes:
- additional IPv6 ioctls
- IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8).
  (also syntax change)
2000-07-04 16:35:15 +00:00
Poul-Henning Kamp 77978ab8bc Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.
Pointed out by:	bde
2000-07-04 11:25:35 +00:00
Poul-Henning Kamp 82d9ae4e32 Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:
Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our
sources:

        -sysctl_vm_zone SYSCTL_HANDLER_ARGS
        +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
2000-07-03 09:35:31 +00:00
Archie Cobbs c38d75f43d Previous commit didn't work; this time really fix it. 2000-06-30 16:38:24 +00:00
Archie Cobbs 44ce4b7dcd Provide forward declarations for struct ifnet and struct mbuf
to avoid compiler warnings.
2000-06-29 22:30:42 +00:00
Archie Cobbs 6ec86086e7 Fix kernel build breakage when 'device ether' was not included. 2000-06-29 19:14:28 +00:00
Archie Cobbs e1e1452d61 Make the ng_ether(4) node type dynamically loadable like the rest.
This means 'options NETGRAPH' is no longer necessary in order to get
netgraph-enabled Ethernet interfaces. This supports loading/unloading
the ng_ether.ko and attaching/detaching the Ethernet interface in any
order.

Add two new hooks 'upper' and 'lower' to allow access to the protocol
demux engine and the raw device, respectively. This enables bridging
to be defined as a netgraph node, if so desired.

Reviewed by:	freebsd-net@freebsd.org
2000-06-26 23:34:54 +00:00
Bill Paul b106252c19 Implement SIOCSIFLLADDR, which allows you to change the link-level
address on an interface. This basically allows you to do what my
little setmac module/utility does via ifconfig. This involves the
following changes:

socket.h: define SIOCSIFLLADDR
if.c: add support for SIOCSIFLLADDR, which resets the values in
      the arpcom struct and sockaddr_dl for the specified interface.
      Note that if the interface is already up, we need to down/up
      it in order to program the underlying hardware's receive filter.
ifconfig.c: add lladdr command
ifconfig.8: document lladdr command

You can now force the MAC address on any ethernet interface to be
whatever you want. (The change is not sticky across reboots of course:
we don't actually reprogram the EEPROM or anything.) Actually, you
can reprogram the MAC address on other kinds of interfaces too; this
shouldn't be ethernet-specific (though at the moment it's limited to
6 bytes of address data).

Nobody ran up to me and said "this is the politically correct way to
do this!" so I don't want to hear any complaints from people who think
I could have done it more elegantly. Consider yourselves lucky I didn't
do it by having ifconfig tread all over /dev/kmem.
2000-06-16 20:14:43 +00:00
Boris Popov 425f741b1d Do not perform any opeartion with mbuf after it placed into
interface queue.

Tested by:	Bosko Milekic <bmilekic@dsuper.net>
2000-06-14 05:56:53 +00:00
Peter Wemm cafa1d6769 Unused include: #include "sl.h" - NSL is no longer used. 2000-06-10 11:21:30 +00:00
Archie Cobbs 756fff0053 Don't try to apply ipfw filtering to non-IP packets.
Reported-by:	"Lachlan O'Dea" <lodea@vet.com.au>
2000-06-02 22:47:53 +00:00
Matt Jacob 60ed92ddd3 fix KASSERT usage 2000-06-02 19:06:33 +00:00
Poul-Henning Kamp 6e891d64ed Don't panic if ifpromisc() returnes ENXIO, it's probably just an pccard
which have been pulled.
2000-06-01 21:57:13 +00:00
Brian Feldman bf095ac10a Make sl(4) SLIP devices dynamically expansible. Yay! =)
PR:		kern/17758
Submitted by:	David Malone <dwmalone@maths.tcd.ie>
2000-05-30 13:47:03 +00:00
Andrew Gallatin fe81f64ffc Rather than checking for hlen causing misalignment, we should do the
m_adj() and then check the resulting mbuf for misalignment, copying
backwards to align the mbuf if required.

This fixes a longstanding problem where an mbuf which would have been
properly aligned after an m_adj() was being misaligned and causing an
unaligned access trap in ip_input().  This bug only triggered when booting
diskless.

Reviewed by:	dfr
2000-05-26 13:47:02 +00:00
Jake Burkholder e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Archie Cobbs 06a429a3c8 Just need to pass the address family to if_simloop(), not the whole sockaddr. 2000-05-24 21:16:56 +00:00
Jake Burkholder 740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Archie Cobbs 2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Darren Reed 08aa4ea3b8 patch from Alexey Zelkin 2000-05-11 00:44:35 +00:00
Darren Reed e9c7bebf95 Add pfil(9) subroutines and manpage from NetBSD. 2000-05-10 13:37:51 +00:00
Poul-Henning Kamp eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Julian Elischer 0beebe3a2e OOps forgot to check in this one...
API chage for netgraph.
2000-04-28 17:43:04 +00:00
Bill Paul da626c171a Add a bpfdetach() stub routine to bpf.c. Without this, you'll get an
unresolved symbol error if you try to load a network driver into a kernel
which doesn't have bpf enabled.

Forgotten by: rwatson
Found by: peter
2000-04-27 15:11:41 +00:00
Boris Popov 5accfb8c14 Fix support for 802.2 and SNAP frames. Bug was introduced during
initial import.

Tested by:	Jorge P Vasquez <jorge@acron.ind.br>
2000-04-27 10:13:52 +00:00
Kenjiro Cho 0a48a6902d remove "register" specifiers to supress compiler warning. 2000-04-26 02:40:33 +00:00
David E. O'Brien b0e56cde37 * Use sys/sys/random.h rather than a i386 specific one.
* There was nothing that should be machine dependant about
  i386/isa/random_machdep.c, so it is now sys/kern/kern_random.c.
2000-04-24 17:30:08 +00:00
Garrett Wollman 1a11e63e1d A couple months ago, Kirk and I were doing a walkthrough of the radix-tree
search routine, and scratching our heads over why it was so obfuscated.
This delta fixes a number of confusing style bugs and renames several
structure members to have more meaningful names.  There remain a number
of odd control-flow structures.  These changes do not affect the generated
code.
2000-04-23 04:00:00 +00:00
Guido van Rooij d91a068efb IOCGIFCONF once and for all. Sometimes the ifc_len variable
would be returned with a wrong value.
While we're here, get rid of unnecessary panic call.

PR:		17311, 12996, 14457
Submitted by:	Patrick Bihan-Faou <patrick@mindstep.com>,
		Kris Kennaway <kris@FreeBSD.org>
2000-04-21 17:48:48 +00:00
Poul-Henning Kamp 3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Warner Losh 0d5c223da4 Awi driver, ported from NetBSD from Atsushi Once-san.
From the README:
	Any IEEE 802.11 cards use AMD Am79C930 and Harris (Intersil) Chipset
	with PCnetMobile firmware by AMD.
	   BayStack 650   1Mbps Frequency Hopping PCCARD adapter
	   BayStack 660   2Mbps Direct Sequence PCCARD adapter
	   Icom SL-200    2Mbps Direct Sequence PCCARD adapter
	   Melco WLI-PCM  2Mbps Direct Sequence PCCARD adapter
	   NEL SSMagic    2Mbps Direct Sequence PCCARD adapter
	   Netwave AirSurfer Plus
			  1Mbps Frequency Hopping PCCARD adapter
	   Netwave AirSurfer Pro
			  2Mbps Direct Sequence PCCARD adapter

Known Problems:
	WEP is not supported.
	Does not create IBSS itself.
	Cannot configure the following on FreeBSD:
		selection of infrastructure/adhoc mode
		ESSID
		...

Submitted by: Atsushi Onoe <onoe@sm.sony.co.jp>
2000-04-06 02:48:48 +00:00
Gary Jennejohn 27173c13e8 Pass me the pointy hat.
It was not a good idea to remove csu_header from struct cspace, it had
ramifications which I didn't notice.

Restore src/usr.sbin/ppp/slcompress.h to the way it was, since MAX_HDR
was already defined as 128 there and it's a user program anyway.

In sys/net/slcompress.h make MAX_HDR 128 intead of MLEN to avoid
bloat.

My apologies for any inconvenience.
2000-04-04 09:20:53 +00:00
Gary Jennejohn 8810489433 Nuke csu_hdr from struct cspace. csu_hdr is not used anywhere in the
tree. This considerably reduces unnecessary bloat in struct slcompress.

I'm running with this change right now and have seen no negative
side-effects.

On my sytem this reduced kernel BSS by about 25KB.

Submitted by:	bde
Approved by:	brian for user-ppp
2000-04-03 19:54:33 +00:00
Jonathan Lemon db4f9cc703 Add support for offloading IP/TCP/UDP checksums to NIC hardware which
supports them.
2000-03-27 19:14:27 +00:00
Philippe Charnier 46a32e616a Remove duplicate word 2000-03-26 15:24:53 +00:00
Larry Lile b149dd6c66 o Replace most magic numbers related to token ring with #defines
from iso88025.h.

o Add minimal llc support to iso88025_input.

o Clean up most of the source routing code.

* Submitted by: Nikolai Saoukh <nms@otdel-1.org>
2000-03-19 21:34:39 +00:00
Robert Watson de5d99354f The advent of if_detach, allowing interface removal at runtime, makes it
possible for a panic to occur if BPF is in use on the interface at the
time of the call to if_detach.  This happens because BPF maintains pointers
to the struct ifnet describing the interface, which is freed by if_detach.

To correct this problem, a new call, bpfdetach, is introduced.  bpfdetach
locates BPF descriptor references to the interface, and NULLs them.  Other
BPF code is modified so that discovery of a NULL interface results in
ENXIO (already implemented for some calls).  Processes blocked on a BPF
call will also be woken up so that they can receive ENXIO.

Interface drivers that invoke bpfattach and if_detach must be modified to
also call bpfattach(ifp) before calling if_detach(ifp).  This is relevant
for buses that support hot removal, such as pccard and usb.  Patches to
all effected devices will not be committed, only to if_wi.c, due to
testing limitations.  To reproduce the crash, load up tcpdump on you
favorite pccard ethernet card, and then eject the card.  As some pccard
drivers do not invoke if_detach(ifp), this bug will not manifest itself
for those drivers.

Reviewed by:	wes
2000-03-19 05:42:34 +00:00
Robert Watson 8ed3828c3b Introduce a new bd_seesent flag to the BPF descriptor, indicating whether or
not the current BPF device should report locally generated packets or not.
This allows sniffing applications to see only packets that are not generated
locally, which can be useful for debugging bridging problems, or other
situations where MAC addresses are not sufficient to identify locally
sourced packets.  Default to true for this flag, so as to provide existing
behavior by default.

Introduce two new ioctls, BIOCGSEESENT and BIOCSSEESENT, which may be used
to manipulate this flag from userland, given appropriate privilege.

Modify bpf.4 to document these two new ioctl arguments.

Reviewed by:	asmodai
2000-03-18 06:30:42 +00:00
Yoshinobu Inoue 4739b8076f IPv6 6to4 support.
Now most big problem of IPv6 is getting IPv6 address
   assignment.
   6to4 solve the problem. 6to4 addr is defined like below,

          2002: 4byte v4 addr : 2byte SLA ID : 8byte interface ID

   The most important point of the address format is that an IPv4 addr
   is embeded in it. So any user who has IPv4 addr can get IPv6 address
   block with 2byte subnet space. Also, the IPv4 addr is used for
   semi-automatic IPv6 over IPv4 tunneling.

   With 6to4, getting IPv6 addr become dramatically easy.
   The attached patch enable 6to4 extension, and confirmed to work,
   between "Richard Seaman, Jr." <dick@tar.com> and me.

Approved by: jkh

Reviewed by: itojun
2000-03-11 11:17:24 +00:00
Archie Cobbs 33d0e2a76d The "sdl_family" field in a "struct sockaddr_dl" will be equal
to AF_LINK, not AF_DLI, as stated in the comment. Fix the comment.

Reviewed by:	wollman
2000-03-01 02:46:25 +00:00
Guido van Rooij b3f1e629e9 This fixes a problem where the SIOCGIFCONF ioctl goes wrong. This
is triggered when qmail is used with INET6 enabled.  The bug
manifests itself in that the space variable can become negative
and that in the comparison in the guards of the 2 loops, this was
not noticed because sizeof() returns an unsigned and thus the signed
variable gets promoted to unsigned. I decided not to make space
unsigned because I think we should guard against this from happening.
Thus panic() in case space becomes negative.

Approved by:	jkh
2000-02-28 19:30:25 +00:00
Yoshinobu Inoue 90da21c697 Wrap if_up() by splnet.
Approved by: jkh

Submitted by: peter
2000-02-27 18:36:30 +00:00
Andrey A. Chernov df2ef4c180 Fix possible SLIOCSUNIT panic
PR:		16564
Submitted by:	ru
Approved by:	jkh
2000-02-20 21:03:53 +00:00
Matthew N. Dodd 8d5d0412c0 Track if_i{bytes,packets,errors}.
Approved by: 	jkh
2000-02-16 04:04:36 +00:00
Peter Wemm 242c5536ea Clean up some loose ends in the network code, including the X.25 and ISO
#ifdefs.  Clean out unused netisr's and leftover netisr linker set gunk.
Tested on x86 and alpha, including world.

Approved by:	jkh
2000-02-13 03:32:07 +00:00
Luigi Rizzo 25a3a898ca Update bridging code to the one already in -stable (this was
forgotten some time ago...).

Approved-by: jordan
2000-02-08 14:53:55 +00:00
Matthew N. Dodd 5326b23cd6 m_pullup() frees the supplied mbuf on failure; we don't need to try
and do this ourselves.

Approved by:	jkh
Noticed by:	Mike Spengler <mks@networkcs.com>
2000-02-07 06:18:38 +00:00
Matthew N. Dodd 4af90a4da4 Make sure that the entire header is in the first mbuf before we
attempt to copy the ethernet header forward and otherwise encapsulate
a packet for output.

This fixes the panic when using VLAN devices on hardware that doesn't
do 802.1Q tagging onboard.  (That is to say, all drivers except the Tigon.)

My tests consisted of telnet, ttcp, and a pingflood of packets
between 1 and 1600 (plus headers) bytes.

MFC to follow in 1 week.

Approved by:	jkh
2000-02-03 07:44:39 +00:00
Yoshinobu Inoue 3411310dfb Add workaround for fxp issue at interface initialization with IPv6.
Some LAN card chip for fxp is known to cause problem at
  interface initialization with IPv6 enabled. It happens at
  some delicate timing.
  And also, just adding some DELAY before IPv6 address
  autoconfiguration is known to avoid the problem.

  Complete fix is changing the driver not to use interrupt at
  multicast filter initialization, but trying such change in
  this stage will be dangerous.

  So I add some DELAY() only inside #ifdef INET6 part,
  as temporal workaround only for 4.0.

Approbed by: jkh

Noticed by: Mattias Pantzare <pantzer@ludd.luth.se>

Obtained from: openbsd-tech mailing list
2000-02-01 15:49:37 +00:00
Peter Wemm e0c121beaf Remove #if NGIF > 0 and #if NFAITH > 0 as config already checks this. 2000-01-29 18:10:39 +00:00