Commit Graph

608 Commits

Author SHA1 Message Date
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
Peter Wemm
cef8bf096f Remove some #if NFOO > 0 that are always true because of config rules. 2000-01-29 16:56:24 +00:00
Peter Wemm
ff76332c49 Fix this so LINT compiles. There is no way this could have worked if
tested with LINT.  I've put back netatm/kern_include.h and maked it
with a fixme!, otherwise NETISR_ATM isn't defined as ATM_KERNEL isn't
defined.  Defining that exposes a whole bunch of other dependencies.. :-(
2000-01-29 16:13:08 +00:00
Brian Somers
2108d4bd92 Remove unused includes 2000-01-29 01:10:24 +00:00
Yoshinobu Inoue
899ce4f40c Count AF_INET6 attachement to routing socket.
Obtained from: KAME project
2000-01-28 20:10:51 +00:00
Brian Somers
6af3fd8d22 Redo the intrq.c idea as
int family_enqueue(sa_family_t, struct mbuf *);
2000-01-27 23:37:39 +00:00
Brian Somers
367d34f853 Move the *intrq variables into net/intrq.c and unconditionally
include this in all kernels.  Declare some const *intrq_present
variables that can be checked by a module prior to using *intrq
to queue data.

Make the if_tun module capable of processing atm, ip, ip6, ipx,
natm and netatalk packets when TUNSIFHEAD is ioctl()d on.

Review not required by: freebsd-hackers
2000-01-24 20:39:02 +00:00
Ruslan Ermilov
48f71763a8 Notify user processes about interface's MTU change.
Reviewed by:	wollman, freebsd-net
2000-01-24 08:53:39 +00:00
Boris Popov
5d94d71cd9 Allow if_ef driver to be compiled into kernel. 2000-01-23 03:35:11 +00:00
Brian Somers
43e8def200 Implement TUN[GS]IFHEAD ioctls. Passing a non-zero int to TUNSIFHEAD
tells that tun unit to prepend a four byte address family to packets
queued for tunread() and to expect a four byte address family at the
front of data received by tunwrite().

We queue any protocol received from the interface for tunread(), but
only accept INET, INET6, IPX and NETATALK from tunwrite().  There is
support for Xerox's NS stuff, but AFAICT config(8) doesn't ever
define NS.
2000-01-23 01:47:12 +00:00
Brian Somers
bbdecb957c Add a new TUNSIFPID ioctl to update the tun_pid (recorded in
tunopen) with the current pid.
2000-01-21 00:31:43 +00:00
Poul-Henning Kamp
eba2a1aeb9 |The hard limit for the BPF buffer size is 32KB, which appears too low
|for high speed networks (even at 100Mbit/s this corresponds to 1/300th
|of a second). The default buffer size is 4KB, but libpcap and ipfilter
|both override this (using the BIOCSBLEN ioctl) and allocate 32KB.
|
|The following patch adds an sysctl for bpf_maxbufsize, similar to the
|one for bpf_bufsize that you added back in December 1995. I choose to
|make the default for this limit 512KB (the value suggested by NFR).

Submitted by:	se
Reviewed by:	phk
2000-01-15 19:46:12 +00:00
Yoshinobu Inoue
66810dd0c3 Clear ro->ro_rt just after RTFREE().
Pleases let me make sure that no one touch the invalid ro_rt pointer,
  after splx(s) and before next ro_rt initialization.
  Though usually this seems to be already called at splnet,
  I still sometime experience kernel crash at rtfree() in my
  INET6 enabled environment where IPv6 connection is frequently used.
  (Off-course, it might be just due to another bug.)
2000-01-15 07:27:12 +00:00
Yoshinobu Inoue
b540203735 cosmetic change: sort function prototypes
Specified by: bde
2000-01-15 05:06:14 +00:00
Yoshinobu Inoue
c3a5e52033 -K&R fix for some prototype declaration
-fix some comments for #endif to match them with their #ifndef

Submitted by: bde
2000-01-15 04:57:12 +00:00
Bill Paul
a0067d7b89 Attempt to fix a problem with receiving packets on USB ethernet interfaces.
Packets are received inside USB bulk transfer callbacks, which run at
splusb() (actually splbio()). The packet input queues are meant to be
manipulated at splimp(). However the locking apparently breaks down under
certain circumstances and the input queues can get trampled.

There's a similar problem with if_ppp, which is driven by hardware/tty
interrupts from the serial driver, but which must also manipulate the
packet input queues at splimp(). The fix there is to use a netisr, and
that's the fix I used here. (I can hear you groaning back there. Hush up.)

The usb_ethersubr module maintains a single queue of its own. When a
packet is received in the USB callback routine, it's placed on this
queue with usb_ether_input(). This routine also schedules a soft net
interrupt with schednetisr(). The ISR routine then runs later, at
splnet, outside of the USB callback/interrupt context, and passes the
packet to ether_input(), hopefully in a safe manner.

The reason this is implemented as a separate module is that there are
a limited number of NETISRs that we can use, and snarfing one up for
each driver that needs it is wasteful (there will be three once I get
the CATC driver done). It also reduces code duplication to a certain
small extent. Unfortunately, it also needs to be linked in with the
usb.ko module in order for the USB ethernet drivers to share it.

Also removed some uneeded includes from if_aue.c and if_kue.c

Fix suggested by: peter
Not rejected as a hairbrained idea by: n_hibma
2000-01-10 23:12:54 +00:00
Yoshinobu Inoue
d664bbb749 Remove BROADCAST flag from faith interface,
-it not seems to be necessary
 -to avoid dhcp messages or something like that sent to faith interface

The problem reported by: Jim Bloom <bloom@acm.org>
2000-01-09 04:35:39 +00:00
Yoshinobu Inoue
0d0f9d1ed6 Prevent kernel panic at ifconfig up after Note PC resume.
Submitted by: imp, kuriyama
Reviewed by: imp
1999-12-30 18:29:55 +00:00
Peter Wemm
664a31e496 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 04:46:21 +00:00
Ruslan Ermilov
920eb79f55 Make cloning mask sockaddr (genmask) possible.
PR:		kern/3061
Reviewed by:	wollman
1999-12-28 08:38:01 +00:00
Yoshinobu Inoue
6a800098cc IPSEC support in the kernel.
pr_input() routines prototype is also changed to support IPSEC and IPV6
chained protocol headers.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-22 19:13:38 +00:00
Brian Feldman
d25f3712b7 M_PREPEND-related cleanups (unregisterifying struct mbuf *s). 1999-12-19 01:55:37 +00:00
Brian Feldman
ee1dd7c481 Fix a broken macro usage. It had no semicolon.
Noticed by:	eivind
1999-12-18 23:26:26 +00:00
Warner Losh
5500d3bedf Two more fixes to if_detach. These are generic to all interfaces and
do not pollute the interface further.

o Run if_detach at splnet().
o Creatively swipe the relevant parts of the netatm atm_nif_detach
  which will delete the relevant references to the interface going
  away.
1999-12-17 06:46:07 +00:00
Boris Popov
4f93599fba Bring up an if_ef driver which allows support for four ethernet
frame types. Currently it supports only IPX protocol and doesn't
affect existing functionality when not loaded.

Reviewed by:	Ollivier Robert <roberto@keltia.freenix.fr>
1999-12-13 16:24:22 +00:00
Boris Popov
8b7805e44e Allow ifunit() routine to understand names like ed0f2. Also
fix a bug caused by using bcmp() instead of strcmp().

Reviewed by:	Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
1999-12-13 15:57:11 +00:00
Jordan K. Hubbard
c0230c1b3d The current code incorrectly assumes that all vlans
are configured, and/or associated with a parent device.  If you
receive a frame for a VLAN that's not in the list, you walk off
the end of the list.  Boom.

Submitted by:	C. Stephen Gunn <csg@waterspout.com>
PR:		15291
1999-12-13 01:57:00 +00:00
Jordan K. Hubbard
ae290324a4 sys/net/if_vlan.c fails to maintain the IFF_RUNNING flag on the
vlan interfaces it manages.  This prevents the interface from
actually sending or receiving data.

Submitted by:	C. Stephen Gunn <csg@waterspout.com>
PR:		15290
1999-12-13 01:38:14 +00:00
Warner Losh
aa6be122fd Add some gross ad-hock hacks to increase stability of if_detach:
o be more careful about clearing addresses (this isn't a kludge)
o For AF_INET interfaces, call SIOCDIFFADDR to remove last(?) bit
  of cruft.

Special cases for AF_INET shouldn't be here, but I didn't see a good
generic way of doing this.  If I missed something, please let me know.

This gross hack makes pccard ejection stable for ethernet cards.

Submitted by: Atushi Onoe-san
1999-12-10 16:31:25 +00:00
John Polstra
68f956b85e Fix a route table leak in rtalloc() and rtalloc_ign(). It is
possible for ro->ro_rt to be non-NULL even though the RTF_UP flag
is cleared.  (Example: a routing daemon or the "route" command
deletes a cloned route in active use by a TCP connection.)  In that
case, the code was clobbering a reference to the routing table
entry without decrementing the entry's reference count.

The splnet() call probably isn't needed, but I haven't been able
to prove that yet.  It isn't significant from a performance standpoint
since it is executed very rarely.

Reviewed by:	wollman and others in the freebsd-current mailing list
1999-12-09 17:09:37 +00:00
Yoshinobu Inoue
ae5bcbff16 rtcalloc() is removed because it turned out not to be necessary for FreeBSD.
(It was added as a part of KAME patch)

Specified by: jdp@polstra.com
1999-12-09 08:56:50 +00:00
Yoshinobu Inoue
cfa1ca9dfa udp IPv6 support, IPv6/IPv4 tunneling support in kernel,
packet divert at kernel for IPv6/IPv4 translater daemon

This includes queue related patch submitted by jburkhol@home.com.

Submitted by: queue related patch from jburkhol@home.com
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-07 17:39:16 +00:00
Julian Elischer
1f8ffa4bca Make the stub routines have the same prototypes as the real bpf
routines.
1999-12-03 09:59:02 +00:00
Archie Cobbs
dcb129d597 Add 'const' to the bpf_filter() and bpf_validate() prototypes.
Remove a stale comment from bpf_validate().
1999-12-02 19:36:05 +00:00
Archie Cobbs
f8307e1233 Add two new generic control messages, NGM_ASCII2BINARY and
NGM_BINARY2ASCII, which convert control messages to ASCII and back.
This allows control messages to be sent and received in ASCII form
using ngctl(8), which makes ngctl a lot more useful.

This also allows all the type-specific debugging code in libnetgraph
to go away -- instead, we just ask the node itself to do the ASCII
translation for us.

Currently, all generic control messages are supported, as well as
messages associated with the following node types: async, cisco,
ksocket, and ppp.

See /usr/share/examples/netgraph/ngctl for an example of using this.

Also give ngctl(8) the ability to print out incoming data and
control messages at any time.  Eventually nghook(8) may be subsumed.

Several other misc. bug fixes.

Reviewed by:	julian
1999-11-30 02:45:32 +00:00
Julian Elischer
62811dad5a Expand the field width for subtypes. We had already overflowed it
by 2 with people just adding numbers on the end of the ethernet subtypes.
We now have an additional 14 subtypes available in ethernet.
Use one of them immediatly for homePNA.

Reviewed by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
1999-11-24 02:40:12 +00:00
Brian Somers
a86ab8174f Only emit the ``wrong ifa'' message if the matching interface
is neither IFF_LOOPBACK or IFF_POINTOPOINT.  It's quite common
(and probably more correct) to route local IP numbers via lo0
and it makes configuration easier to assign the hostname address
to local POINTOPOINT links too.

This message usually remains hidden because the loopback interface
gets the highest interface number at boot time, but when the
ethernet interface is added later, the message can get pretty
annoying.

Also, fix a typo.

Not objected to by: freebsd-net
1999-11-23 22:30:01 +00:00
Yoshinobu Inoue
82cd038d51 KAME netinet6 basic part(no IPsec,no V6 Multicast Forwarding, no UDP/TCP
for IPv6 yet)

With this patch, you can assigne IPv6 addr automatically, and can reply to
IPv6 ping.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-11-22 02:45:11 +00:00
Archie Cobbs
da8c951da4 Add some more comments to the sl_compress_tcp() function. 1999-11-15 20:17:04 +00:00
Julian Elischer
ecf33d87b2 YUCK!
m_prepend doesn't fix m_pkthdr.len, use M_PREPEND instead, which does..
(Netgraph only)
1999-11-15 03:49:35 +00:00
Julian Elischer
2b75f79579 Fix screwup on synthesising incoming ethernet header in Netgraph mode.
Submitted by: brian@freebsd.org
1999-11-14 10:16:40 +00:00
Poul-Henning Kamp
422fd76f84 Set the queue length. 1999-11-12 19:30:08 +00:00
Julian Elischer
e03b02a346 Oops forgot to put the source MAC address on outgoing packets! 1999-11-11 22:23:58 +00:00
Yoshinobu Inoue
76429de41a KAME related header files additions and merges.
(only those which don't affect c source files so much)

Reviewed by: cvs-committers
Obtained from: KAME project
1999-11-05 14:41:39 +00:00