Commit Graph

480 Commits

Author SHA1 Message Date
Julian Elischer
9d3f194df3 Allow a protocol to specify that it does NOT want to be looped back
even if it looks like it should (backwards compatibility with
old broken code) should get rid of some annoying messags.
1998-06-13 02:27:10 +00:00
Julian Elischer
6b1214b0fc Remove 3 occurances of __FUNCTION__ 1998-06-12 20:03:26 +00:00
Julian Elischer
ed7509ace4 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
Julian Elischer
01f0fef31b Don't let ifunit() modify the string passed as an argument.
it may be in the text segment and write protected.
1998-06-08 20:33:29 +00:00
Doug Rabson
ecbb00a262 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
Bruce Evans
871e837825 Added a used include (in ifdefed code). 1998-06-07 12:02:59 +00:00
Bruce Evans
35b88f573a Fixed pedantic syntax errors caused by a trailing semicolon in a macro
definition.
1998-06-07 11:52:17 +00:00
David Greenman
2b5c300924 Backed out last fix and fixed my typo:
ipflow(fastforward -> ipflow_fastforward
1998-05-21 00:33:16 +00:00
Peter Dufault
6d5a01beb3 Add missing close paren 1998-05-20 14:08:43 +00:00
David Greenman
1f91d8c563 Added fast IP forwarding code by Matt Thomas <matt@3am-software.com> via
NetBSD, ported to FreeBSD by Pierre Beyssac <pb@fasterix.freenix.org> and
minorly tweaked by me.
This is a standard part of FreeBSD, but must be enabled with:
"sysctl -w net.inet.ip.fastforwarding=1" ...and of course forwarding must
also be enabled. This should probably be modified to use the zone
allocator for speed and space efficiency. The current algorithm also
appears to lose if the number of active paths exceeds IPFLOW_MAX (256),
in which case it wastes lots of time trying to figure out which cache
entry to drop.
1998-05-19 14:04:36 +00:00
Poul-Henning Kamp
c21410e119 s/nanoruntime/nanouptime/g
s/microruntime/microuptime/g

Reviewed by:	bde
1998-05-17 11:53:46 +00:00
Garrett Wollman
eb92a34766 Fix an obvious parameter-order bogon. (Don't know what happened to
the warning message before.)
1998-05-15 20:02:47 +00:00
Bruce Evans
77849078bf Oops, the previous commit should have changed i386' to __i386__',
not `__i386'.
1998-05-01 16:40:21 +00:00
Poul-Henning Kamp
ce42f1fb17 Loopback network interface driver (net/if_loop.c) has no SIOCSIFFLAGS
ioctl handler.

PR:		6466
Reviewed by:	phk
Submitted by:	Ruslan Ermilov <ru@ucb.crimea.ua>
1998-04-30 19:37:00 +00:00
Brian Somers
5417a1a44a Support more than 256 tun devices:
$ ls -l /dev/tun25[4-7]
crw-------  1 fax  dialer   52, 254 Apr 27 02:27 /dev/tun254
crw-------  1 fax  dialer   52, 255 Apr 27 02:27 /dev/tun255
crw-------  1 fax  dialer   52, 0x00010000 Apr 27 02:31 /dev/tun256
crw-------  1 fax  dialer   52, 0x00010001 Apr 27 02:31 /dev/tun257
1998-04-27 01:44:22 +00:00
Dag-Erling Smørgrav
dc73342347 Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108. 1998-04-17 22:37:19 +00:00
Bruce Evans
c1087c1324 Support compiling with `gcc -ansi'. 1998-04-15 17:47:40 +00:00
Poul-Henning Kamp
98b9590ef3 Use getmicrotime() for if_lastchange, 10msec is plenty precision. 1998-04-06 11:43:12 +00:00
Poul-Henning Kamp
33b0bb6af7 Use random() for seq numbers and read_random for CHAP challenge. 1998-04-06 11:40:17 +00:00
Poul-Henning Kamp
2eeb0e2ea0 Make read_random() take a (void *) argument instead of (char *) 1998-04-06 09:30:42 +00:00
Poul-Henning Kamp
00af9731c9 Time changes mark 2:
* Figure out UTC relative to boottime.  Four new functions provide
      time relative to boottime.

    * move "runtime" into struct proc.  This helps fix the calcru()
      problem in SMP.

    * kill mono_time.

    * add timespec{add|sub|cmp} macros to time.h.  (XXX: These may change!)

    * nanosleep, select & poll takes long sleeps one day at a time

Reviewed by:    bde
Tested by:      ache and others
1998-04-04 13:26:20 +00:00
Poul-Henning Kamp
227ee8a188 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
Bruce Evans
08637435f2 Moved some #includes from <sys/param.h> nearer to where they are actually
used.
1998-03-28 10:33:27 +00:00
Peter Wemm
8209dfe2f4 Quieten a debug message.. This happens under "normal" operation by 4 bytes
on a frequent enough rate to be annoying.  There is a real bug somewhere,
but it looks harmless enough.
1998-03-25 14:28:28 +00:00
Bruce Evans
bd7ac1b26b Added a forward struct declaration so that this file is less
self-insufficient.
1998-03-23 13:58:02 +00:00
Peter Wemm
880dcadfce ppp-2.3.x ships with a bad compression number for deflate. It uses number
24 (which is magnalink!) rather than the correct 26.

Initial attempt at a compatability kludge that will negotiate for either
but will prefer to use the correct deflate compression type.
1998-03-22 06:51:57 +00:00
Peter Wemm
52403fe6de Update kernel parts of ppp to ppp-2.3.3. Not much has changed except
that the deflate components use zlib 1.0.4 instead of zlib 0.95.
1998-03-21 20:56:16 +00:00
Peter Wemm
09410d0f8b On most other systems "out there", <net/if.h> does not require the caller
to #include <sys/time.h> first.  I've lost count of the number of times
I've had to patch this in porting code.  The problem is the
"struct timeval ifi_lastchange" in the mib stats.  (most other systems don't
have this, until 4.4bsd anyway).
1998-03-21 13:36:20 +00:00
Garrett Wollman
2cc2df490e Add preliminary support for IEEE 802.1Q VLAN tagging. It doesn't actually
work reliably yet (I've had panics), but it does seem to occasionally
be able to transmit and receive syntactically-correct packets.
Also fixes one of if_ethersubr.c's legion style bugs, and removes
the hostcache code from standard kernels---the code that depends on it
is not going to happen any time soon, I'm afraid.
1998-03-18 01:40:12 +00:00
Bruce Evans
ddf6208225 Fixed syntax error in previous commit. 1998-03-01 06:01:33 +00:00
Poul-Henning Kamp
c544ff8a5e Make it possible to indicate that we don't care about the remote
sides IP address, as long as it isn't 0.0.0.0
1998-02-28 21:01:09 +00:00
Bruce Evans
e31abede1f Don't depend on "implicit int" or bloat the data section in the
declaration of xxx_devsw_installed.
1998-02-20 13:46:58 +00:00
Bruce Evans
39e4376ba7 Removed unused #includes. 1998-02-20 13:11:54 +00:00
Poul-Henning Kamp
a4daaa09f2 Implement the spirit but not the letter of Terrys hot-char patch.
The differences Terrys patch and this patch are:
 * Remove a lot of un-needed comments.
 * Don't put l_hotchar at the front of stuct linesw, there is no need to.
 * Use the #defines for the hotchar in the SLIP and PPP line disciplines
1998-02-13 12:46:28 +00:00
Eivind Eklund
303b270b0a Staticize. 1998-02-09 06:11:36 +00:00
Eivind Eklund
0b08f5f737 Back out DIAGNOSTIC changes. 1998-02-06 12:14:30 +00:00
Eivind Eklund
47cfdb166d Turn DIAGNOSTIC into a new-style option. 1998-02-04 22:34:03 +00:00
Bruce Evans
e7a5897899 Added #include of <sys/queue.h> so that this file is more "self"-sufficent. 1998-02-03 22:19:35 +00:00
Steve Price
3398edcee9 Revert previous commit. Remove all ifp->if_* = 0 initializations,
since pkh made tunctl static in revision 1.17 these are already
guaranteed to be zero'd and tunattach will only be called once.

Pointed out by: Bruce Evans and Bill Fenner
1998-02-01 05:36:44 +00:00
Eivind Eklund
3f2076daf5 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 Eklund
e0d781f3a5 Make POWERFAIL_NMI, PPS_SYNC and NATM new style options.
This also fixes a couple of defunct options; submitted by bde.
1998-01-31 05:00:21 +00:00
Brian Somers
a512daba6c Correct $Id$ 1998-01-26 19:52:34 +00:00
Steve Price
e2f6977240 Initialize if_ibytes and if_obytes to zero.
PR:		1376
Submitted by:	risner@stdio.com
1998-01-25 17:54:57 +00:00
Eivind Eklund
7b778b5e61 Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.
This introduce an xxxFS_BOOT for each of the rootable filesystems.
(Presently not required, but encouraged to allow a smooth move of option *FS
to opt_dontuse.h later.)

LFS is temporarily disabled, and will be re-enabled tomorrow.
1998-01-24 02:54:56 +00:00
Garrett Wollman
906f09bca4 Add a macro to accurately calculate the length of a struct ifreq when
it contains an address.  This can replace all the myriad (wrong) ways
in which this task is performed in the current system.  As an added
bonus, since it's a macro, then third-party software vendors have an easy
way to tell whether it's there or not.  (This will become necessary
when sizeof(struct sockaddr) is increaased, and also when additional
fields are added to struct ifreq.)
1998-01-13 02:56:21 +00:00
Brian Somers
52ae741f38 Move softc stuff into if_tunvar.h
Suggested by: Peter Wemm <peter@netplex.com.au>
Hinted at by: Bruce Evans <bde@FreeBSD.org>


1998-01-11 17:52:33 +00:00
Brian Somers
1aeffee9fb Move softc stuff into if_tunvar.h
Suggested by: Peter Wemm <peter@netplex.com.au>
Hinted at by: Bruce Evans <bde@FreeBSD.org>
À³
1998-01-11 17:52:29 +00:00
Bruce Evans
7fa939e201 Fixed change prerequisites for <net/if_arp.h>:
- don't declare `struct arpcom' except in the kernel, so that there is no
  dependency on <net/if.h> except in the kernel.  This may break something
  else.
- spell ETHER_ADDR_LEN as 6 again, so that there is no dependency on
  <net/ethernet.h> even in the kernel.
1998-01-10 07:29:10 +00:00
Eivind Eklund
7262d3e430 NETATALK -> opt_atalk.h 1998-01-09 00:51:57 +00:00
Eivind Eklund
1d5e9e2255 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
Gary Jennejohn
d3341aa5db Reviewed by: Joerg Wunsch
In sppp_chap_input:
1) in the CHAP_CHALLENGE case don't output the peer's name if it is not
what we expected (DEBUG) since it will be printed out in the course
of events anyway.
2) in the CHAP_SUCCESS case test whether the peer is required to
authenticate himself [(sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO))],
otherwise the state machine may never switch into the network state.
I saw this case against 2 different ISPs; they never bothered to
authenticate themselves to me.

In sppp_pap_input:
in the PAP_ACK case do the same as in 2) above for the same reason.
1998-01-01 21:27:18 +00:00
Eivind Eklund
4d4cefd4c9 Remove bogus #ifdef INET - SLIP doesn't compile without INET. 1997-12-20 16:44:51 +00:00
Bruce Evans
c5a1016bf4 Fixed gratuitous ANSIisms. 1997-12-20 00:07:11 +00:00
Andrey A. Chernov
f3a4092ca2 MALLOC->malloc
Suggested-by: bde
1997-12-19 19:39:01 +00:00
Andrey A. Chernov
17b6b6d61d SUNIT: use MALLOC/FREE and M_NOWAIT 1997-12-19 09:48:57 +00:00
Eivind Eklund
5591b823d1 Make COMPAT_43 and COMPAT_SUNOS new-style options. 1997-12-16 17:40:42 +00:00
Eivind Eklund
430df5f4b7 Throw options IPX, IPXIP and IPTUNNEL into opt_ipx.h.
The #ifdef IPXIP in netipx/ipx_if.h is OK (used from ipx_usrreq.c and
ifconfig.c only).

I also fixed a typo IPXTUNNEL -> IPTUNNEL (and #ifdef'ed out the code
inside, as it never could have compiled - doh.)
1997-12-15 20:31:25 +00:00
Bruce Evans
239b7b699e Use ENOIOCTL instead of -1 (= ERESTART) for tty ioctls that are
not handled at a particular level.  This fixes mainly restarting
of interrupted TIOCDRAINs and TIOCSETA{W,F}s.
1997-12-06 13:25:01 +00:00
Bruce Evans
a0f1e323d0 Unstaticized rn_delete() and rn_lookup(). They are used in dark corners
of netatalk (if NETATALKDEBUG is configured).

Removed stray semicolons.
1997-11-24 13:50:24 +00:00
Bruce Evans
517c5ddbd3 Removed now-unused blocking mode flag. 1997-11-18 16:37:04 +00:00
Bruce Evans
9a43455f43 Removed unused #includes.
Fixed gratuitous ANSIisms.

Fixed nonblocking mode.  It was per-device instead of per-file.
1997-11-18 16:36:15 +00:00
Bruce Evans
fba9235d76 Removed unused #includes.
Fixed nonblocking mode.  It was per-device instead of per-file.  This
also fixes clobbering of bd_rtout by overloading it to hold a wrong
version of the blocking flag.  I hope nothing depends on the bugs.
1997-11-18 16:29:53 +00:00
Bruce Evans
42d263adde Don't test for conflicting combinations of PPP_FILTER/BPFILTER here.
Testing in if_ppp.c is good enough.

Added comments about bogus #includes and #defines.

Removed unused #includes.

Don't depend on gcc's misfeature of rewriting short args in old-style
function definitions to match wrong prototypes.  I just changed the
function definition to match the prototype, since this is easy to
verify automatically (it causes no changes in the object code), but
it breaks K&R1 support and doesn't fix the pessimal type.
1997-11-18 14:08:51 +00:00
Bruce Evans
6418d75452 Cleaned up PPP_FILTER/NBPFILTER ifdefs.
Use gettime() instead of microtime() to set if_lastchange for i/o's.
microtime() is probably too expensive.  However, setting if_lastchange
for i/o's may be wrong.
1997-11-18 13:52:41 +00:00
Bruce Evans
16355bd11c Use gettime() instead of assignment from time'. (time' is too
volatile to use outside of splclock().  microtime() is probably too
expensive to use for every i/o.  However, setting ifi_lastchange for
every i/o is just wrong according to the comment about ifi_lastchange
in <net/if.h>.  It is set then for atm, fddi and the latest version
of ppp.)
1997-11-18 13:37:56 +00:00
Poul-Henning Kamp
4a11ca4e29 Remove a bunch of variables which were unused both in GENERIC and LINT.
Found by:	-Wunused
1997-11-07 08:53:44 +00:00
David Greenman
95b6073cd5 Fixed bug in RTM_ADD where rmx_locks weren't being set on the new route,
preventing "route add default 1.2.3.4 -lock -mtu 1500" from working as
expected (which is, BTW, to disable Path MTU Discovery).
1997-10-31 08:53:13 +00:00
Julian Elischer
de1e682d58 didn't even know fddi had the atalk support.
fix it here too. (really needs more of the fixes from the ethernet)
1997-10-29 07:59:27 +00:00
Julian Elischer
1d0eab59d3 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
Bruce Evans
55b211e3af Removed unused #includes. 1997-10-28 15:59:26 +00:00
Peter Wemm
635de877cb Braino on my part.. a #define isn't a reference to a structure, so the
struct only needs to be defined if the macro is used.

Pointed out by: bde
1997-10-18 09:02:39 +00:00
Peter Wemm
7a387305bb Convert PPP_FILTER to an option, like PPP_BSDCOMP and PPP_DEFLATE.
It requires bpf, I'll note this in LINT.
1997-10-18 01:20:28 +00:00
Peter Wemm
c871745648 Better fix for the bpf dependency that doesn't have such a large impact
on the code and pppd in userland.  PPP_FILTER is meant to be an option (or
negatable option).
1997-10-18 00:56:23 +00:00
Peter Wemm
d11c4262eb Back out the `PPP_FILTER => NBPFILTER' changes. 1997-10-18 00:49:59 +00:00
Peter Wemm
f2189317fa Back out the `PPP_FILTER => NBPFILTER' changes 1997-10-18 00:46:10 +00:00
Ollivier Robert
1f7ce4e6c9 A better fix for both kernel and LKM compilation. 1997-10-17 21:50:32 +00:00
Ollivier Robert
eacd95ff9e Change PPP_FILTER into NBPFILTER to fix kernel compilation.
It should probably be changed in ppp_tty.c for consistency but I'll let
Brian deal with this.

Forgotten by:	brian
1997-10-17 21:30:30 +00:00
Brian Somers
c647c98349 PPP_FILTER => NBPFILTER 1997-10-17 00:12:38 +00:00
Poul-Henning Kamp
a1c995b626 Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde
1997-10-12 20:26:33 +00:00
Joerg Wunsch
1f6b09ad8b Jumbo patch to implement PAP and CHAP for sppp(4). Partially based on
Serge's (Cronyx's) code in the vendor branch.  (FR support not yet
merged.)
1997-10-11 11:25:28 +00:00
Peter Wemm
b476a2db23 Try out PPP_FILTER 1997-10-10 11:57:43 +00:00
Andrey A. Chernov
44a8636f2a Preserve old SC_STATIC value after units exchange 1997-10-07 09:13:06 +00:00
Joerg Wunsch
d7189ec67c Ooops, this should have made it into the same commit, but didn't.
Introduce the SIOC[SG]IFGENERIC hooks that can be used to pass an
arbritrary ioctl subcommand into an interface driver.  Surprisingly
enough, there was no provision for this already present (except of the
option of abusing SIOC[SG]IFMEDIA for this).

The idea is that an interface driver can establish ioctl subcommands
of its own that can't be meaningfully interpreted by the upper layer
interface ioctl function.  Something like this is required to
implement a clean solution of passing down things like CHAP secrets or
PPP options to the /sys/net/if_sppp* files.  (Yes, my CHAP is now
finally working with it, but i gotta update my kernel to the new
callout interface before being able to commit _that_.)

Reviewed by:    peter   [long ago, actually]
1997-10-07 07:40:35 +00:00
Julian Elischer
ed0af9bc44 Allow interfaces to be attached to bpf at times other than boot.
doing so without this patch leads to an infinite loop in the kernel.
1997-10-03 21:32:05 +00:00
John Dyson
0639feb218 Remove an unfortunate name clash with the zalloc/zfree routines. Since the
ppp_deflate code uses the names locally - it looses.
1997-09-21 22:31:20 +00:00
Justin T. Gibbs
6c951b4441 Update for new callout interface. 1997-09-21 22:02:25 +00:00
Bruce Evans
514ede0953 Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
Peter Wemm
f8f6cbba92 Update network code to use poll support. 1997-09-14 03:10:42 +00:00
Peter Wemm
e0e8ed506f Update select -> poll 1997-09-14 03:09:01 +00:00
Peter Wemm
243ac7d85a select -> poll
Obtained from: NetBSD (I think)
1997-09-14 03:03:05 +00:00
Joerg Wunsch
bc6d9b8094 Fix a typo that becomes apparent when compiling without COMPAT_443.
Submitted by:	Tony Kimball <Anthony.Kimball@East.Sun.COM>
1997-09-07 11:09:22 +00:00
Bruce Evans
a3199409b8 Some staticized variables were still declared to be extern. 1997-09-07 08:49:04 +00:00
Bruce Evans
bea0f0be7b Some staticized variables were still declared to be extern. 1997-09-07 05:27:26 +00:00
Bruce Evans
4d1d4912ae 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
Bruce Evans
e8af045620 Removed unused #includes. 1997-09-01 02:18:13 +00:00
Julian Elischer
7ed8f465e7 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
Julian Elischer
7e2a6151f5 add some comments while trying to understand why appletalk
gets some things wrong.
(part of my continuing "comment it as you understand it" effort :)
1997-08-22 22:47:27 +00:00
Peter Wemm
080ea4d851 Some fixes from Bruce:
- don't access time (a volatile) via struct copy.
  - merge botches
  - note risk of CCOUNT accessing *tp outside spltty().

Submitted by:  bde
1997-08-22 11:34:08 +00:00
Peter Wemm
3b053446d4 Remove some stray extra prototypes 1997-08-19 17:07:07 +00:00
Peter Wemm
13c497114e Use two NetBSD-style options (PPP_DEFLATE and PPP_BSDCOMP) to control
whether or not to compile the two ppp compression methods.
1997-08-19 17:05:26 +00:00