Commit Graph

68 Commits

Author SHA1 Message Date
bmilekic
4c48d530e1 * Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.
This is because calls with M_WAIT (now M_TRYWAIT) may not wait
  forever when nothing is available for allocation, and may end up
  returning NULL. Hopefully we now communicate more of the right thing
  to developers and make it very clear that it's necessary to check whether
  calls with M_(TRY)WAIT also resulted in a failed allocation.
  M_TRYWAIT basically means "try harder, block if necessary, but don't
  necessarily wait forever." The time spent blocking is tunable with
  the kern.ipc.mbuf_wait sysctl.
  M_WAIT is now deprecated but still defined for the next little while.

* Fix a typo in a comment in mbuf.h

* Fix some code that was actually passing the mbuf subsystem's M_WAIT to
  malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the
  value of the M_WAIT flag, this could have became a big problem.
2000-12-21 21:44:31 +00:00
dwmalone
418e7e45d7 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
jlemon
af6d4768d5 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
phk
00ff95c136 Move suser() and suser_xxx() prototypes and a related #define from
<sys/proc.h> to <sys/systm.h>.

Correctly document the #includes needed in the manpage.

Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
2000-10-29 16:06:56 +00:00
archie
d6172f3d67 Just need to pass the address family to if_simloop(), not the whole sockaddr. 2000-05-24 21:16:56 +00:00
julian
488344806f Slight cleanup of aarp code
Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
PR: kern/17583

This PR is still open as Ther is still ongoing investigation.
2000-03-29 17:12:09 +00:00
peter
dd4b87e5a8 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
brian
44d675d635 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
peter
a5782dd663 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
phk
8dcac09a03 Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
phk
b097bd1d95 Suser() simplification:
1:
  s/suser/suser_xxx/

2:
  Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
  s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.
1999-04-27 11:18:52 +00:00
dillon
1e80df272f Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile
1999-01-27 22:42:27 +00:00
eivind
1e372c62bf De-staticize and add prototype for main debug function. I'll turn
this into a DDB command in the next staticization run.
1999-01-12 12:09:27 +00:00
archie
84bd80a4f9 The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.
1998-12-07 21:58:50 +00:00
eivind
be1b08dba9 Staticize. 1998-11-26 18:50:24 +00:00
bde
3589262c68 Fixed printf format errors. 1998-08-17 01:05:25 +00:00
julian
100aaa7f15 fix broken loopback code for ddp (again)
Submitted by: Stefan Bethke <stb@hanse.de>
1998-08-04 23:17:05 +00:00
alex
638b70118b Typo fix: teh --> (the|they) 1998-07-30 02:27:41 +00:00
julian
322fc7915b Fix braino in last commit.
Not even sure how I got this commit in as it didn't even compile.
1998-07-13 06:34:02 +00:00
julian
9250a1cea8 Slight optimisation. Don't do the same calculation twice. 1998-07-09 02:00:02 +00:00
julian
e6febbec0e Go through the loopback code with a broom..
Remove lots'o'hacks.
looutput is now static.

Other callers who want to use loopback to allow shortcutting
should call the special entrypoint for this, if_simloop(), which is
specifically designed for this purpose. Using looutput for this purpose
was problematic, particularly with bpf and trying to keep track
of whether one should be using the charateristics of the loopback interface
or the interface (e.g. if_ethersubr.c) that was requesting the loopback.
There was a whole class of errors due to this mis-use each of which had
hacks to cover them up.

Consists largly of hack removal :-)
1998-06-12 03:48:19 +00:00
dfr
92449ad5fa This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
julian
19ecca4528 spurious ntohs calls were stopping some packets from being recognised
for what they are..
Taken from the netatalk mailing list. from a NetBSD user.
1998-06-05 06:55:37 +00:00
steve
64cf0792f0 Remove stray debug message.
PR:		6722
1998-05-24 03:25:24 +00:00
des
31722e83fd Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108. 1998-04-17 22:37:19 +00:00
phk
8396c1d18d Eradicate the variable "time" from the kernel, using various measures.
"time" wasn't a atomic variable, so splfoo() protection were needed
around any access to it, unless you just wanted the seconds part.

Most uses of time.tv_sec now uses the new variable time_second instead.

gettime() changed to getmicrotime(0.

Remove a couple of unneeded splfoo() protections, the new getmicrotime()
is atomic, (until Bruce sets a breakpoint in it).

A couple of places needed random data, so use read_random() instead
of mucking about with time which isn't random.

Add a new nfs_curusec() function.

Mark a couple of bogosities involving the now disappeard time variable.

Update ffs_update() to avoid the weird "== &time" checks, by fixing the
one remaining call that passwd &time as args.

Change profiling in ncr.c to use ticks instead of time.  Resolution is
the same.

Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call
hzto() which subtracts time" sequences.

Reviewed by:	bde
1998-03-30 09:56:58 +00:00
bde
d6ecf50e51 Removed unused #includes. 1998-02-25 13:08:07 +00:00
bde
0a6cc7edf3 Removed unused #includes. 1998-02-25 05:58:50 +00:00
eivind
86354cd8fc Staticize. 1998-02-09 06:11:36 +00:00
bde
8dbb898a8c Fixed pedantic syntax errors. 1998-02-03 21:56:42 +00:00
bde
f3dd4c35fa Forward declare some structs so that this file is more self-sufficient. 1998-02-03 21:52:02 +00:00
eivind
ce980d55cc Make the debug options new-style.
This also zaps a DPT option from lint; it wasn't referenced from
anywhere.
1998-01-31 07:23:16 +00:00
eivind
15cd3046e2 Make INET a proper option.
This will not make any of object files that LINT create change; there
might be differences with INET disabled, but hardly anything compiled
before without INET anyway.  Now the 'obvious' things will give a
proper error if compiled without inet - ipx_ip, ipfw, tcp_debug.  The
only thing that _should_ work (but can't be made to compile reasonably
easily) is sppp :-(

This commit move struct arpcom from <netinet/if_ether.h> to
<net/if_arp.h>.
1998-01-08 23:42:31 +00:00
julian
550a296efd Fix various problems with netatalk kernel support.
Some of these changes are a bit rough and will become
more polished later.  the changes to if_ethersubr should largely be moved
to within the appletalk code, but that will happen later.
A few of these were related to network-byteorder problems,
and more were related to loopback failures.
1997-10-29 00:30:52 +00:00
jlemon
ac0a8d66d0 Remove dereference of uninitialized (and unused) variable. This enables
netatalk to work again.
1997-10-06 15:56:16 +00:00
gibbs
30cd24efde Update for new callout interface. 1997-09-21 22:02:25 +00:00
peter
47e0f3fbb0 Update network code to use poll support. 1997-09-14 03:10:42 +00:00
bde
89f2ab7078 Removed unused #includes. 1997-09-07 08:30:24 +00:00
bde
5ffe1a4d48 Cleaned up a little. 1997-09-07 08:21:50 +00:00
bde
d5d016d4dd Moved misplaced extern declarations. 1997-09-07 07:58:09 +00:00
bde
35ecefd6a2 Staticicized. 1997-09-07 07:54:15 +00:00
bde
d305d05f35 Fixed another sloppy common-style declaration (staticized it). 1997-09-07 07:47:21 +00:00
bde
2d9d15ccd1 Removed unused variable. 1997-09-07 07:38:33 +00:00
bde
b0e9957a21 Fixed sloppy common-style declarations. 1997-09-07 07:33:30 +00:00
bde
2cf5cf3752 Added used #include - don't depend on <sys/mbuf.h> including
<sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).
1997-09-02 01:19:47 +00:00
julian
2c2a7360b2 Add a per-interface-address pointer to a function that can be supplied
by a protocol, to detirmine if an address matches the net this address
is part of.  This is needed by protocols for which netmasks
"just don't work", for example appletalk.

Also add the code in appletalk to make use of this new feature.
Thsi fixes one of the longest standing bugs in appletalk.
The inability to talk to machines to which the path is via a router
which is on a different net, but the same netrange, as your interface.
Protocols that do not supply this function (e.g. IP) should not be affected.
1997-08-28 01:17:12 +00:00
wollman
c07b59bf2b Fix all areas of the system (or at least all those in LINT) to avoid storing
socket addresses in mbufs.  (Socket buffers are the one exception.)  A number
of kernel APIs needed to get fixed in order to make this happen.  Also,
fix three protocol families which kept PCBs in mbufs to not malloc them
instead.  Delete some old compatibility cruft while we're at it, and add
some new routines in the in_cksum family.
1997-08-16 19:16:27 +00:00
bde
2b60d80b5b Removed unused #includes. 1997-08-02 14:33:27 +00:00
julian
d55a0b9fe8 Actually POINT to the appletalk usrreqs struct.
I guess no-one else tried to use this.. (yet)
1997-06-02 20:07:33 +00:00
julian
61ea76b200 First cut at patches to make appletalk compile again
after the dissapearance of the USRREQ() entrypoint.
1997-05-13 21:01:45 +00:00