Commit Graph

323 Commits

Author SHA1 Message Date
Peter Wemm
9481c477f0 Don't dereference sc->sc_setmtu if it's NULL (such as when it's not running)
as discussed on current. (bde pointed out the cause of the problem)

Reported by: dev@fgate.flevel.co.uk
1996-07-21 17:14:06 +00:00
Garrett Wollman
2c37256e5a Modify the kernel to use the new pr_usrreqs interface rather than the old
pr_usrreq mechanism which was poorly designed and error-prone.  This
commit renames pr_usrreq to pr_ousrreq so that old code which depended on it
would break in an obvious manner.  This commit also implements the new
interface for TCP, although the old function is left as an example
(#ifdef'ed out).  This commit ALSO fixes a longstanding bug in the
TCP timer processing (introduced by davidg on 1995/04/12) which caused
timer processing on a TCB to always stop after a single timer had
expired (because it misinterpreted the return value from tcp_usrreq()
to indicate that the TCB had been deleted).  Finally, some code
related to polling has been deleted from if.c because it is not
relevant t -current and doesn't look at all like my current code.
1996-07-11 16:32:50 +00:00
Bill Fenner
1db1fffa03 Disallow host routes that point to themselves. These routes serve no
purpose, other than to get in the way of the ARP table and cause
"can't allocate llinfo" errors.

This change may cause gated or routed to start complaining when adding
such routes.  If so, these programs will need to be fixed to not try
to add these routes.

Reviewed by:	wollman
1996-07-10 01:34:36 +00:00
Gary Palmer
545f9f440b Remove another extraneous setting of if_lastchange 1996-06-24 21:56:39 +00:00
Gary Palmer
0cf8755c9b Remove an un-necessary call to microtime() to set if_lastchange
as it is set in the call to if_down in the line above
1996-06-23 00:51:05 +00:00
Garrett Wollman
b8dc74a3a8 Set IFF_RUNNING on the loopback interface. 1996-06-19 16:24:10 +00:00
Julian Elischer
8e3bda0682 Submitted by: archie@whistle.com
gary went a little overboard on commenting out unused variables.
Variables needed for ISO, LLC and NETATALK
were only enabled for ISO &  LLC.. so NETATALK bombed.
1996-06-19 01:50:10 +00:00
Satoshi Asami
ad63a118b2 The Great PC98 Merge.
All new code is "#ifdef PC98"ed so this should make no difference to
PC/AT (and its clones) users.

Ok'd by:	core
Submitted by:	FreeBSD(98) development team
1996-06-14 11:02:28 +00:00
David Greenman
34bed8b0ee Keep ether_type in network order for BPF to be consistent with other
systems.

Submitted by:	Ted Lemon, Matt Thomas, and others. Retrofitted for
		-current by me.
1996-06-13 02:54:19 +00:00
Nate Williams
a136e00402 Only print out the new masks if bootverbose is set. 1996-06-12 20:07:09 +00:00
Gary Palmer
a614bfe060 Since the updates to ifnet.if_lastchange are so rare (relatively
speaking), go for the extra accuracy and call microtime() to get
the current time.

Pointed Out By:		bde
1996-06-12 19:24:03 +00:00
Gary Palmer
c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
Gary Palmer
97d15c1062 Add $Id$ 1996-06-10 23:17:45 +00:00
Gary Palmer
e39a0280cb Change the use if ifnet.if_lastchange to be more in line with
SNMP requirements. Update description of ifnet.if_lastchange in if.h
to indicate this.
1996-06-10 23:07:36 +00:00
Poul-Henning Kamp
5f8f505749 Also count bytes in if_tun. kern/1253
Reviewed by:	phk
Submitted by:	John Capo <jc@irbs.com>
1996-06-09 17:24:25 +00:00
Bruce Evans
0453d3cbb3 Changed some memcpy()'s back to bcopy()'s.
gcc only inlines memcpy()'s whose count is constant and didn't inline
these.  I want memcpy() in the kernel go away so that it's obvious that
it doesn't need to be optimized.  Now it is only used for one struct
copy in si.c.
1996-06-08 08:19:03 +00:00
David Greenman
a76f92a8f0 Fix bug in bpf_ifname() where the unit didn't get added correctly to the
name string. This function should be rewritten to deal with more than
10 units of a given type.

Pointed out by:	jmf@free-gate.com (Jean-Marc Frailong)
(I fixed it slightly differently)
1996-06-08 06:12:58 +00:00
Garrett Wollman
58639ed39a Don't allow trailing garbage after the unit number in ifunit(). 1996-06-05 17:12:41 +00:00
Gary Palmer
a330e1f1a5 Set ifnet.baudrate for ethernet / FDDI interfaces too. Makes
SNMP slightly more informative

Reviewed by: Garrett Wollman
1996-06-01 23:25:10 +00:00
Marc G. Fournier
51d976f16a added missing semicolon
Submitted by:	 Jeffrey Hsu <hsu@freefall.freebsd.org>
1996-05-26 22:05:36 +00:00
Poul-Henning Kamp
d0aa157d5b If tunnel is busy we return EBUSY, not ENXIO. 1996-05-26 17:04:48 +00:00
Julian Elischer
655929bfba Obtained from: netatalk distribution netatalk@itd.umich.edu
Kernel Appletalk protocol support
both CAP and netatalk can make use of this..
still needs some owrk but  it seemd the right tiime to commit it
so other can experiment.
1996-05-24 01:35:45 +00:00
Andrey A. Chernov
49968bb8cf When two units swapped, copy SC_STATIC flag too, not clear it 1996-05-13 14:18:18 +00:00
Andrey A. Chernov
d99bab06b5 Prevent mixing of static and dynamic unit allocation strategies 1996-05-13 14:09:34 +00:00
Gary Palmer
6ddbf1e299 Clean up various compiler warnings. Most (if not all) were benign
Reviewed by:	bde
1996-05-08 04:29:08 +00:00
Garrett Wollman
9f9b3dc4ae Add three new route flags to help determine what sort of address
the destination represents.  For IP:

- Iff it is a host route, RTF_LOCAL and RTF_BROADCAST indicate local
  (belongs to this host) and broadcast addresses, respectively.

- For all routes, RTF_MULTICAST is set if the destination is multicast.

The RTF_BROADCAST flag is used by ip_output() to eliminate a call to
in_broadcast() in a common case; this gives about 1% in our packet-generation
experiments.  All three flags might be used (although they aren't now)
to determine whether a packet can be forwarded; a given host route can
represent a forwardable address if:

	(rt->rt_flags & (RTF_HOST | RTF_LOCAL | RTF_BROADCAST | RTF_MULTICAST))
	== RTF_HOST

Obviously, one still has to do all the work if a host route is not present,
but this code allows one to cache the results of such a lookup if rtalloc1()
is called without masking RTF_PRCLONING.
1996-05-06 17:42:13 +00:00
David Greenman
2a8d579fc8 Regardless of whether or not the check for IPv4 is useful, we certainly
don't need to assign the "ip" pointer twice.
1996-04-25 02:34:37 +00:00
Poul-Henning Kamp
3fb9e5a20b Reject all IP versions but 4. 1996-04-24 15:44:34 +00:00
Bruce Evans
c5294719c3 Eliminated sloppy common-style declarations. Now there are no duplicated
common labels for LINT.  There are still some common declarations for the
!KERNEL case in tcp_debug.h and spx_debug.h.  trpt depends on the ones in
tcp_debug.h.
1996-04-13 12:45:57 +00:00
David Greenman
06fc5af99c When cslip gets an uncompressed packet, it attempts to save off the TCP/IP
header for use in decompressing subsequant packets. If cslip gets garbage
(such as what happens when there is a port speed mismatch or modem line
noise), it will occasionally mistake the packet as a valid uncompressed
packet. When it tries to save off the header, it doesn't bother to check
for the validity of the header length and will happily clobber not only
the cslip data structure, but parts of other kernel memory that happens
to follow it...causing, ahem, undesired behavior.
1996-04-11 06:46:24 +00:00
Bruce Evans
6ffde942bf Removed never-used #includes of <machine/cpu.h>. Many were apparently
copied from bad examples.
1996-04-07 17:39:28 +00:00
Bruce Evans
3157adc8af Removed now-unused #includes of <machine/cpu.h>. They were for bootverbose
being declared in the wrong place.
1996-04-07 17:32:42 +00:00
Bill Fenner
6ac3b69d76 Eliminate panic("rtfree") caused by double-freeing the route
when rt == rt->rt_gwroute .  rt == rt->gwroute shouldn't happen
in the first place, but that's another problem.

(try "route add -host <hostonmynet> <hostonmynet>; ping <hostonmynet>;
route delete <hostonmynet>")
1996-03-29 08:02:30 +00:00
Marc G. Fournier
ccbc58d3ca Using devfs_add_devswf() instead of devfs_add_devsw()
Reviewed by:	julian@freebsd.org
1996-03-28 14:33:59 +00:00
Bruce Evans
6c4591a089 Fixed ownerships of callout devices. 1996-03-27 20:03:32 +00:00
David Greenman
2ee45d7d28 Move or add #include <queue.h> in preparation for upcoming struct socket
changes.
1996-03-11 15:13:58 +00:00
Andrey A. Chernov
f7163ba751 Make user-level PPP on-demand with dynamic IP actually work.
Story so fr:
1) PPP on-demand with static IP works.
2) PPP on-demand with dynamic IP says "Host is down" on any IP request
The problem is that tun driver check its READY state by *first* ifconfig address.
i.e.:
set ifaddr <addr> <addr2>
works (static IP) and
set ifaddr 0 <addr2>
not works (dynamic IP) because first address is equal 0.
Since tun is always POINTOPOINT interface, dst address is more meaningfull.
I change checking to second (dst) address in READY test.
PPP on-demand finally works.
1996-03-08 11:07:07 +00:00
Peter Wemm
4bd4912865 Add more options into the conf/options and i386/conf/options.i386 files
and the #include hooks so that 'make depend' is more useful.  This
covers most of the options I regularly use (but not all) and some other
easy ones.
1996-03-02 18:24:13 +00:00
Poul-Henning Kamp
f0d807c7fe Make tundebug sysctl writable. 1996-02-09 09:23:56 +00:00
Garrett Wollman
a9ad85b0df If a slow input queue was defined by the driver, initialize it. 1996-02-08 21:34:56 +00:00
Garrett Wollman
9b44ff2214 Clean up Ethernet drivers:
- fill in and use ifp->if_softc
	- use if_bpf rather than private cookie variables
	- change bpf interface to take advantage of this
	- call ether_ifattach() directly from Ethernet drivers
	- delete kludge in if_attach() that did this indirectly
1996-02-06 18:51:28 +00:00
Garrett Wollman
5eb1d25adb Make me feel a little better by filling in reasonable values for rmx_sendpipe
and rmx_recvpipe.  This has no demonstrable effect on performance.
(ttcp reports about 44 Mbit/s for all the buffer sizes I tried between
16384 and 65536.)
1996-02-05 19:34:27 +00:00
Mike Pritchard
6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
Garrett Wollman
7c399a896a Delete the if_private[] array in struct ifnet; this turned out to be
of limited utility.  In their place, add bunch of pointers
which will eventually be needed by the polled-interrupt scheme we're working
here.  (It will probably be a while before the code is written and
committed here.)  At the same time, a `void *if_softc' field
was added to the beginning of the structure to make certain driver
writers happier.

The practical upshot of all this is that you need to
recompile utilities such as netstat which manipulate struct ifnet.
1996-01-26 22:09:54 +00:00
Poul-Henning Kamp
18b7be4064 The last part of the ether_sprint -> %6D change.
Sorry for the delay.
(%D is for hexdumping.)
1996-01-26 09:29:29 +00:00
Poul-Henning Kamp
1ce9bf88c3 Use new printf features rather than local kludges. 1996-01-24 21:12:23 +00:00
Garrett Wollman
fde327d6ab Fix memory leak in case of adding a host route on top of another one.
Pointed-out-by:  Bill Fenner <fenner@parc.xerox.com>
1996-01-24 20:27:19 +00:00
Garrett Wollman
602d513c5a in_proto.c: spell ``Internet'' right and put whitespace after commas.
others: start to populate the link-layer branch of the net mib, by
moving ARP to its proper place.  (ARP is not a protocol family, it's an
interface layer between a medium-access layer and a protocol family.)
sysctl(8) needs to be taught about the structure of this branch, unless
Poul-Henning implements dynamic MIB exploration soon.
1995-12-20 21:53:53 +00:00
Bruce Evans
b62d102cbb Uniformized pr_ctlinput protosw functions. The third arg is now `void
*' instead of caddr_t and it isn't optional (it never was).  Most of the
netipx (and netns) pr_ctlinput functions abuse the second arg instead of
using the third arg but fixing this is beyond the scope of this round
of changes.
1995-12-16 02:14:44 +00:00
Poul-Henning Kamp
f708ef1b9e Another mega commit to staticize things. 1995-12-14 09:55:16 +00:00
Peter Wemm
8c1f170b90 Make FIONREAD return the actual that a read() would return, not just the
amount of data in the first mbuf.

Obtained from: Bob Smart <smart@mel.dit.csiro.au> (for NetBSD & SunOS)
1995-12-11 13:24:58 +00:00
Bruce Evans
7bf60cac80 Restored used variable `name[32]' (used by DEVFS).
Removed an `#ifdef __FreeBSD__'.  Hundreds, if not thousands of other
FreeBSD-specific things aren't ifdefed.
1995-12-10 01:20:17 +00:00
Poul-Henning Kamp
3bda9f9bd5 Staticize, clean lint. 1995-12-09 20:47:15 +00:00
Poul-Henning Kamp
d2f265fab8 Julian forgot to make the *devsw structures static. 1995-12-08 23:23:00 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
Bruce Evans
0310c19f5d Replaced #includes of <sys/user.h> by less gross headers, usually
<sys/vm.h>.  Many device drivers need only the definition of vtophys()
from vm.

Added nearby #includes of <sys/conf.h> where appropriate.
1995-12-06 23:52:35 +00:00
David Greenman
4a5f1499b0 all:
Removed ifnet.if_init and ifnet.if_reset as they are generally unused.
Change the parameter passed to if_watchdog to be a ifnet * rather than
a unit number. All of this is an attempt to move toward not needing an
array of softc pointers (which is usually static in size) to point to
the driver softc.

if_ed.c:
Changed some of the argument passing to some functions to make a little
more sense.

if_ep.c, if_vx.c:
Killed completely bogus use of if_timer. It was being set in such a way
that the interface was being reset once per second (blech!).
1995-12-05 02:01:59 +00:00
Bruce Evans
88e2f526f5 Added a prototype.
Declared dsioctl() as static consistently.  Note that both if_disc.c
and subr_diskslice.c use the same prefix `ds' and there is a name
conflict for dsioctl().
1995-12-03 19:08:55 +00:00
Bruce Evans
1630f073cf Moved inline functions for insque() and remque() to <sys/queue.h>.
Protected them with `#ifdef KERNEL' so that <sys/queue.h> is valid C++.
Added the necessary #includes of <sys/queue.h>.

These functions are bogus and should be replaced by the queue macros.
1995-12-03 13:45:34 +00:00
Bruce Evans
ce7609a49c Completed function declarations and/or added prototypes. 1995-12-02 19:38:06 +00:00
Bruce Evans
af32e59f16 Fixed call to mrt_ioctl(). mrt_ioctl() for some reason has different
number of args when MROUTING is defined.
1995-12-02 19:28:24 +00:00
Bruce Evans
d841aaa740 Finished (?) cleaning up sysinit stuff. 1995-12-02 17:11:20 +00:00
Julian Elischer
7198bf4725 If you're going to mechanically replicate something in 50 files
it's best to not have a (compiles cleanly) typo in it! (sigh)
1995-11-29 14:41:20 +00:00
Julian Elischer
53ac6efbd8 OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c..
my next trick will be to define cdevsw[] and bdevsw[]
as empty arrays and remove all those DAMNED defines as well..

Each of these drivers has a SYSINIT linker set entry
that comes in very early.. and asks teh driver to add it's own
entry to the two devsw[] tables.

some slight reworking of the commits from yesterday (added the SYSINIT
stuff and some usually wrong but token DEVFS entries to all these
devices.

BTW does anyone know where the 'ata' entries in conf.c actually reside?
seems we don't actually have a 'ataopen() etc...

If you want to add a new device in conf.c
please  make sure I know
so I can keep it up to date too..

as before, this is all dependent on #if defined(JREMOD)
(and #ifdef DEVFS in parts)
1995-11-29 10:49:16 +00:00
Peter Wemm
968757cbee Implement some rudimentry IPX support... 1995-11-28 01:59:19 +00:00
Peter Wemm
8fb90141c8 If a lcp configure request is received in the lcp opened state and it
is acknowledged, it should go to the lcp ack sent state.

Don't reply on lcp echo requests when not in the lcp opened state.

If the interface is set to CISCO mode, it should still be marked
running when ifconfiged.

Fixed a few indentations that had gone wrong somewhere.

Submitted-by: John.Hay@csir.co.za
1995-11-21 01:23:13 +00:00
Poul-Henning Kamp
c9d160712f Fix #includes. 1995-11-20 12:29:05 +00:00
Bruce Evans
68e2ef24ca Fixed a comment. 1995-11-18 13:07:51 +00:00
Bruce Evans
27501cb677 Added bogus casts to avoid warnings.
Continued cleaning up sysinit stuff.
1995-11-18 13:01:19 +00:00
Poul-Henning Kamp
5204129576 All net.* sysctl converted now. 1995-11-16 19:00:27 +00:00
Peter Wemm
fae92a3f85 Enhance the likelyhood that IPX over ppp will actually work.. :-)
Note that pppd doesn't have an ipxcp.c module for negotiating and confuguring
IPX at startup, but after these mods, you can manually ifconfig IPX addresses
on the interface and it will probably work.. :-)
1995-11-13 22:09:39 +00:00
Bruce Evans
8b25681eb5 Replaced bogus macros for dummy devswitch entries by functions.
These functions went away:

	enosys (hasn't been used for some time)
	enxio
	enodev
	enoioctl (was used only once, actually for a vop)

if_tun.c:
Continued cleaning up...

conf.h:
Probably fixed the type of d_reset_t.  It is hard to tell the correct
type because there are no non-dummy device reset functions.

Removed last vestige of ambiguous sleep message strings.
1995-11-06 00:36:19 +00:00
Bruce Evans
286f8561e2 Replaced bogus macros for entry points to unconfigured line disciplines
by functions.

tty_conf.c:
Cleaned up formatting of tables.

Removed another ARGSUSED for consistency.

conf.h:
Introduced typedefs for line discipline functions.

Backed out most of previous revision (it is done elsewhere).
1995-11-05 20:25:59 +00:00
Bruce Evans
4fda91c705 Moved prototypes for devswitch functions from conf.c and driver sources
to <machine/conf.h>.  conf.h was mechanically generated by
`grep ^d_ conf.c >conf.h'.  This accounts for part of its ugliness.  The
prototypes should be moved back to the driver sources when the functions
are staticalized.
1995-11-04 13:25:33 +00:00
Peter Wemm
96673e6696 Fix the incomplete merge for the IPX code - the internals are different.
Note, the IPX in pppd support is not really there. I suspect that
it may work if you ifconfig it up manually.
1995-11-03 08:42:21 +00:00
Peter Wemm
f2d642f969 Re-Zap unused variables in their new location.. :-) 1995-11-01 00:58:43 +00:00
Peter Wemm
1aea408caf Remove the old pppcompress files (btw: these look net-2 derived)
commit merge for bsd_comp.c - I missed this with a *ppp* wildcard.
1995-10-31 20:51:24 +00:00
Peter Wemm
f2fdf012d4 Drat.. Missed this one, which #includes ppp-comp.h, not ppp_comp.h 1995-10-31 20:41:32 +00:00
Peter Wemm
45e829f5a5 Merge/update ppp-2.2 kernel parts onto mainline.
Note that the old if_ppp.c has been split in half into if_ppp.c and
ppp_tty.c
1995-10-31 20:24:14 +00:00
Peter Wemm
8511566984 Initial revision 1995-10-31 20:07:32 +00:00
Peter Wemm
71b9cf739a slcompress: split one of the functions into two parts, to allow use by both
if_sl and if_ppp (from ppp-2.2), eliminating the nearly identical
 pppcompress.[ch] code.  Add maximum VJ compression states argument to
 sl_compress_init().
if_sl: call sl_compress_init() with the extra argument.
1995-10-31 19:22:32 +00:00
Peter Wemm
06cc185852 Add a simplistic netisr register routine - I need this now for ppp-2.2. 1995-10-31 19:07:53 +00:00
Poul-Henning Kamp
a98ca4699e Second batch of cleanup changes.
This time mostly making a lot of things static and some unused
variables here and there.
1995-10-29 15:33:36 +00:00
Julian Elischer
cc6a66f20e Reviewed by: julian and jhay@mikom.csir.co.za
Submitted by:	Mike Mitchell, supervisor@alb.asctmd.com

This is a bulk mport of Mike's IPX/SPX protocol stacks and all the
related gunf that goes with it..
it is not guaranteed to work 100% correctly at this time
but as we had several people trying to work on it
I figured it would be better to get it checked in so
they could all get teh same thing to work on..

Mikes been using it for a year or so
but on 2.0

more changes and stuff will be merged in from other developers now that this is in.

Mike Mitchell, Network Engineer
AMTECH Systems Corporation, Technology and Manufacturing
8600 Jefferson Street, Albuquerque, New Mexico 87113 (505) 856-8000
supervisor@alb.asctmd.com
1995-10-26 20:31:59 +00:00
Garrett Wollman
3ba6426d14 Change signature of rt->rt_output() so that it is compatible with
ifp->if_output() functions.  This way, initial implementations of
rt_output functionality can just lazily use if_output until customized
versions are written.
1995-10-16 20:53:55 +00:00
Garrett Wollman
aca1a47cb4 When adding a route fails because there is already a route with the same
(mask,value) in the tree, don't immediately return EEXIST.  Instead, check
to see if the pre-existing route was generated by protcol-cloning.  If so,
then it is OK to simply blow away the old route and re-attempt the insertion.
If not, then fall back to the same error code as before.
1995-10-16 19:09:40 +00:00
Garrett Wollman
233b60cec4 Say goodbye to IFF_NOTRAILERS. Support for trailers was officially
dropped for 4.4, but for some reason this flag lived on.  (Until
today, that is.)
1995-10-13 19:48:06 +00:00
Garrett Wollman
ed07cc7f09 Protect against routing socket messages with way-too-big address families.
Submitted by:	Keith Sklower by way of Paul Traina
1995-10-13 16:01:59 +00:00
Bruce Evans
4ab32c3430 Fix types of sysctl functions. Add prototypes. Cosmetic. 1995-10-09 04:06:28 +00:00
Bruce Evans
9cdeffd562 Don't wait for output to drain in pppclose(). Discard output immediately
for the same reasons as in slclose().

Free the cblock in the canonical queue in pppclose().  This is a no-op in
the usual cases where the tty is being closed or the line discipline is
being switched back to the standard discipline, but it saves a cblock if
the line discipline is being switched to one that doesn't use the canonical
queue.

Add prototypes.  I use `extern' in prototypes for functions with bogus
linkage.  This should be fixed someday.

Continue cleaning up new init stuff yet again.
1995-10-05 00:33:27 +00:00
Jordan K. Hubbard
9e8433e6e0 This upgrades the driver for Cronyx-Sigma multiplexor boards
from version 1.2 to version 1.9.
Submitted by:	Serge Vakulenko, <vak@cronyx.ru>
1995-10-04 22:24:16 +00:00
Garrett Wollman
e9a30d0016 Add newline at end of log message and reduce log level to INFO from NOTICE. 1995-09-27 15:00:49 +00:00
Garrett Wollman
e508a00419 Add BPF and IP multicast capabilities to the tun' and lp' network
interfaces.

Submitted by:	Bill Fenner <fenner@parc.xerox.com>
1995-09-25 16:57:54 +00:00
Garrett Wollman
963e4c2a50 Fix BPf to generate a header mbuf for writes.
Fix loopback and discard interfaces to understand BPF writes.
(These two from Bill Fenner to fix PR 512.)

Move ifpromisc() from bpf.c to if.c as suggested by comment in BPF.
Send a notice to the log when promiscuous mode is enabled.
1995-09-22 17:57:48 +00:00
Garrett Wollman
2eeab93993 Only print `bpf: foo0 attached' if bootverbose. 1995-09-20 20:48:29 +00:00
Andrey A. Chernov
f7f7fe111b Clear SC_OUTWAIT after checking of free clists, not before 1995-09-17 23:38:29 +00:00
Bruce Evans
6b435e575c Call output process in slstart() whether or not there is any output. As
in pppstart(), the output process may be overloaded to handle hardware
flow control and hardware output completions.

Don't wait for output to drain in slclose().  Discard output immediately.
New output is not prevented while processes are waiting for output to
drain (this is a bug), so the wait was sometimes forever.  Infinite
waits are also possible when CCTS_OFLOW is enabled and CTS is down.
Infinite waits were also caused by the above bug in slstart().

Start changing new init stuff yet again: rename unused arg `dummy'.

Reviewed by:	davidg
1995-09-10 12:22:59 +00:00
David Greenman
4590fd3a2a Fixed init functions argument type - caddr_t -> void *. Fixed a couple of
compiler warnings.
1995-09-09 18:10:37 +00:00
Bruce Evans
6003967057 Fix benign type mismatches in devsw functions. 82 out of 299 devsw
functions were wrong.
1995-09-08 11:09:15 +00:00
Garrett Wollman
a5d3a8f99b Add a few hooks (in the form of an array of four void *'s) to allow
various bits of software to save some data in the ifnet structure without
having to constantly change the declaration thereof.
1995-08-31 15:21:31 +00:00
Bruce Evans
b6f5c0b824 Fix several sysinit functions that had the wrong type and unnecessarily
external linkage.

Remove useless comments saying that SYSINIT() does system initialization.
1995-08-30 00:33:22 +00:00
Julian Elischer
2b14f991e6 Reviewed by: julian with quick glances by bruce and others
Submitted by:	terry (terry lambert)
This is  a composite of 3 patch sets submitted by terry.
they are:
New low-level init code that supports loadbal modules better
some cleanups in the namei code to help terry in 16-bit character support
some changes to the mount-root code to make it a little more
modular..

NOTE: mounting root off cdrom or NFS MIGHT be broken as I haven't been able
to test those cases..

certainly mounting root of disk still works just fine..
mfs should work but is untested. (tomorrows task)

The low level init stuff includes a total rewrite of init_main.c
to make it possible for new modules to have an init phase by simply
adding an entry to a TEXT_SET (or is it DATA_SET) list. thus a new module can
be added to the kernel without editing any other files other than the
'files' file.
1995-08-28 09:19:25 +00:00
Bruce Evans
bf25be48a5 Make everything except the unsupported network sources compile cleanly
with -Wnested-externs.
1995-08-16 16:14:28 +00:00
Bruce Evans
0d0e55bbbd Obtained from: an ancient patch of mine via 1.1.5
Call output process whether or not there is any output.  The output
process may be overloaded to handle hardware flow control and
hardware output completions.
1995-07-31 21:54:46 +00:00
Bruce Evans
9fa18570a2 Obtained from: partly from ancient patches of mine via 1.1.5
Introduce TS_CONNECTED and TS_ZOMBIE states.  TS_CONNECTED is set
while a connection is established.  It is set while (TS_CARR_ON or
CLOCAL is set) and TS_ZOMBIE is clear.  TS_ZOMBIE is set for on to
off transitions of TS_CARR_ON that occur when CLOCAL is clear and
is cleared for off to on transitions of CLOCAL.  I/o can only occur
while TS_CONNECTED is set.  TS_ZOMBIE prevents further i/o.

Split the input-event sleep address TSA_CARR_ON(tp) into TSA_CARR_ON(tp)
and TSA_HUP_OR_INPUT(tp).  The former address is now used only for
off to on carrier transitions and equivalent CLOCAL transitions.
The latter is used for all input events, all carrier transitions
and certain CLOCAL transitions.  There are some harmless extra
wakeups for rare connection- related events.  Previously there were
too many extra wakeups for non-rare input events.

Drivers now call l_modem() instead of setting TS_CARR_ON directly
to handle even the initial off to on transition of carrier.  They
should always have done this.  l_modem() now handles TS_CONNECTED
and TS_ZOMBIE as well as TS_CARR_ON.

gnu/isdn/iitty.c:
Set TS_CONNECTED for first open ourself to go with bogusly setting
CLOCAL.

i386/isa/syscons.c, i386/isa/pcvt/pcvt_drv.c:
We fake carrier, so don't also fake CLOCAL.

kern/tty.c:
Testing TS_CONNECTED instead of TS_CARR_ON fixes TIOCCONS forgetting to
test CLOCAL.  TS_ISOPEN was tested instead, but that broke when we disabled
the clearing of TS_ISOPEN for certain transitions of CLOCAL.

Testing TS_CONNECTED fixes ttyselect() returning false success for output
to devices in state !TS_CARR_ON && !CLOCAL.

Optimize the other selwakeup() call (this is not related to the other
changes).

kern/tty_pty.c:
ptcopen() can be declared in traditional C now that dev_t isn't short.
1995-07-31 21:02:00 +00:00
Peter Wemm
f0448ae4a2 Fix panic("ifpromisc failed") when shutting down a bpf tap when the attached
interface is no longer IFF_UP.
The test for IFF_UP in ifpromisc is only useful while enabling IFF_PROMISC
and the higher levels of the bpf code do not allow for the possibility of
failure while shutting down.  This is a trivial change.
Also, fixes PR#522.
1995-07-31 10:35:36 +00:00
Bruce Evans
267513a942 Obtained from: partly from ancient patches by ache and me via 1.1.5
Remove nullmodem().

It may be useful to have a null modem routine, but nullmodem()
wasn't one.  nullmodem() was identical to ttymodem() except it
didn't implement MDMBUF (carrier) flow control, didn't do any
wakeups for off to on carrier transitions, and didn't flush the
i/o queues for on to off carrier transitions (flushing has the side
effect of waking up readers and writers) although it did generate
SIGHUPs.  The wakeups must normally be done even if nullmodem() is
null in case something is sleeping waiting for a carrier transition.
In any case, the wakeups should be harmless.  They may cause bogus
results for select(), but select() is already bogus for nonstandard
line disciplines.
1995-07-29 13:40:13 +00:00
Bruce Evans
28f8db1403 Eliminate sloppy common-style declarations. There should be none left for
the LINT configuation.
1995-07-29 11:44:31 +00:00
Bruce Evans
6644e30617 Obtained from: partly from ancient patches by ache and me via 1.1.5
Nuke `symbolic sleep message strings'.  Use unique literal messages so that
`ps l' shows unambiguously where processes are sleeping.
1995-07-21 20:57:15 +00:00
Bruce Evans
97e156674d Don't include <sys/tty.h> in drivers that aren't tty drivers or in general
files that don't depend on the internals of <sys/tty.h>
1995-07-16 10:13:08 +00:00
Garrett Wollman
8e718bb4af When adding a route, set rt_ifa and rt_ifp a little earlier so that
the protocol-specific add routine can examine it if desired.
1995-07-10 15:22:37 +00:00
Joerg Wunsch
6f64074e6b Move some struct definitions outside of struct's, so their scopes for
C++ will match the scopes for C.

Submitted by:	Warner Losh
1995-07-09 08:12:27 +00:00
Joerg Wunsch
78988ab839 PR #kern/600: PPP does not pay attention to IPTOS_LOWDELAY
Kernel PPP doesn't pay attention to IPTOS_LOWDELAY, but uses
        a table of port numbers, which isn't a generic method.  The following
        patch fixes this (the table is still used, but in addition
        PPP queues the packet in fastq if IPTOS_LOWDELAY is set.

Obtained from:	Tatu Ylonen <ylo@cs.hut.fi>
Submitted by:	Heikki Suonsivu <hsu@clinet.fi>
1995-07-08 16:34:55 +00:00
David Greenman
ef59de8517 Worked around a bug with if.c setting the interface up even when we don't
want it to.
1995-07-07 01:13:49 +00:00
David Greenman
93ff4e36e3 Modified joerg's last change to only set the interface "up" when setting
the address if the device is a SLIP device (i.e. "attached").
1995-07-06 11:55:18 +00:00
Joerg Wunsch
1394aff0cd Revision 1.21 of if_sl.c broke the traditional behaviour that
assigning an address to an interface automatically marks this
interface IFF_UP.  The fix corrects this (and closes PR sys/577).
This is consistent with the way ethernet interfaces are being handled.
1995-07-02 09:01:02 +00:00
David Greenman
523a02aa7a Don't skip point-to-point interfaces if the netmask==0 (the netmask
should be completely ignored for point-to-point interfaces).
For point-to-point interfaces, route based on the destination address,
not the local address.

Submitted by:	Peter Wemm
1995-06-28 05:31:03 +00:00
David Greenman
0a779360e5 Killed a couple lines of redundant code. 1995-06-21 10:13:23 +00:00
David Greenman
92678d4679 Protect the call to if_up() with an splnet(). 1995-06-21 09:11:22 +00:00
David Greenman
2cd67fdafd 1) Set interface up/down correctly as a function of open and close of the
SLIP device.
2) Don't directly frob the IFF_UP flag - use if_up/if_down as it was
   intended.
3) Return ENETDOWN if IFF_UP isn't set when outputing, drop the packet if
   if IFF_UP isn't set when inputing.
1995-06-21 08:48:19 +00:00
Paul Traina
00a838879b Give the BPF the ability to generate signals when a packet is available.
Reviewed by:	pst & wollman
Submitted by:	grossman@cygnus.com
1995-06-15 18:11:00 +00:00
David Greenman
3740e2ad04 Took out P2P_LOCALADDR_SHARE option and made it standard. 1995-06-15 00:19:56 +00:00
Rodney W. Grimes
d3628763db Merge RELENG_2_0_5 into HEAD 1995-06-11 19:33:05 +00:00
Rodney W. Grimes
9b2e535452 Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
David Greenman
b2af64fd03 Added a fix for a bug which caused the wrong interface to be selected
for broadcasts if point-to-point links shared the same IP address as
the ethernet. The fix must be enabled with P2P_LOCALADDR_SHARE option
in the kernel config file. This will someday likely be standard, but
there isn't sufficient time before release to determine if there are
any interoperability problems with routed and/or gated.

Reviewed by:	Garrett Wollman, and me
Submitted by:	Peter Wemm
1995-05-27 04:37:24 +00:00
David Greenman
c9a8415607 Fixed route reference count bug that squirmed in during the the
routing-socket code upgrade from Berkeley..

Submitted by:	Garrett Wollman via Peter Wemm via Cornell
1995-05-15 22:57:53 +00:00
Rodney W. Grimes
b2b795f07c Fix -Wformat warnings from LINT kernel. 1995-05-11 19:26:53 +00:00
Garrett Wollman
748e0b0acc Make networking domains drop-ins, through the magic of GNU ld. (Some day,
there may even be LKMs.)  Also, change the internal name of `unixdomain'
to `localdomain' since AF_LOCAL is now the preferred name of this family.
Declare netisr correctly and in the right place.
1995-05-11 00:13:26 +00:00
Garrett Wollman
78a8281095 Updated routing-socket code from Berkeley
Obtained from: Keith Bostic by way of Paul Traina
1995-05-10 16:48:52 +00:00
David Greenman
94a5d9b6a1 Replaced some bcopy()'s with memcpy()'s so that gcc while inline/optimize. 1995-05-09 13:35:48 +00:00
Bruce Evans
402c1682aa Fix misplaced idempotency #endif.
Fix tabs and spaces in the wrong places.
1995-04-29 15:24:00 +00:00
Paul Traina
2f688f82da Incorporate new radix code from UCB. This fixes the orphaned mask bugs.
This submission was done by hand-applying FreeBSD local modifications on
top of the UCB code, rather than trying to patch the UCB code in on top
of the FreeBSD code due to the extensive changes.

Reviewed by:	pst	(been handling 30k routes for 4+ months)
Obtained from:	Sklower/Woody/Honing/Traina (8.4 UCB release)
1995-04-28 23:01:37 +00:00
Andrey A. Chernov
d86851edf5 Implement SLIOCSUNIT (set slip unit number) 1995-04-28 18:47:29 +00:00
Paul Traina
f5fea3ddc9 Cleanup loopback interface support.
Reviewed by:	wollman
1995-04-26 18:10:58 +00:00
Garrett Wollman
cd02a0b741 Finally finish the cloning cleanup work by making sure that clones
go away whenever a clone's parent is changed, or a route is added in a
certain set of circumstances.

This also includes code to forbid setting a route's gateway to an
address which can only be reached through that route, thus (hopefully)
eliminating one class of cloning bottomless-recursion bugs.
1995-04-25 19:12:07 +00:00
Garrett Wollman
1f3d84e82a Tunnel driver is nmow capable of installing its own cdevsw[] entry,
with a little help from conf.c.  While e're at it, actually declare the
tunnel entry points to have the correct types.  This fixes PR #306.
1995-04-10 20:35:45 +00:00
Bruce Evans
5f679211e3 Fix slioctl(). It has to return -1 for ioctls that it doesn't know about
so that these ioctls can be handled by the calling layer(s).

Clean up the recently added code:
- include the appropriate header to declare an implicitly declared function.
- declare timeout functions correctly and remove numerous bogus casts that
  hid (but didn't fix) their incorrectness.
1995-04-02 00:11:48 +00:00
Andrey A. Chernov
8a9f513775 slopen() never sets t_line to SLIPDISC, but uses slip-specific queue allocation 1995-04-01 22:11:10 +00:00
David Greenman
b4fff2ae1a Patch from Greg Ansley:
In rare cases, when the filter specified accesses an multi-byte value that
is split across mbuf's, the value loaded is incorrect.  And if you are very
unlucky (like me) it will index off the end of the mbuf and into an
unallocated page and panic the system.

If you look at the code you will discover the the index *k* is added to
the pointer *cp* and the used AGAIN as a subscript.
1995-04-01 01:46:27 +00:00
Andrey A. Chernov
dfd88e5a00 Fix typing error sneaked somehow in prev. commit 1995-03-31 11:01:29 +00:00
Andrey A. Chernov
ca9301398c This sl enhancement helps to keep serial line (modem) connection alive.
It is common case when modem hangs with carier on but don't
receive anything from another side.
This thing commonly healed with hangup and redialing.
Enhancements below allows to determine when such action
is needed and inform attach program with SIGURG signal.
There two ioctls set: outfill and keepalive, used from both
sides of connection. Outfill repeatedly sends FRAME_END with
specified timeout (i.e. 40 seconds). It is needed to get input on
other side even if no user activity on slip line currently.
Keepalive checks FRAME_ENDs from other side, and if no one
got in specified timeout (i.e. 60 seconds, max modem retrain time),
send SIGURG to attach program.
I plan to add code to slattach to handle this thing too.

Reviewed by: wollman
1995-03-30 20:43:32 +00:00
Andrey A. Chernov
3de5725908 pppinput:
Fix serial errors handling
Add no carrier check
1995-03-29 20:34:17 +00:00
Garrett Wollman
a29ae2a103 Don't delete clones if they are PINNED. 1995-03-24 20:05:28 +00:00
Garrett Wollman
3545b0484c radix.c: correct exit condition in rn_walktree_from()
route.c: be a little more careful when running deleting children of dying
.        routes
1995-03-23 18:07:29 +00:00
Garrett Wollman
771edb14e9 Protocol-cloned routes should gain a reference to their parents to make
sure that rt->rt_parent values can never be re-used harmfully.
1995-03-21 19:50:34 +00:00
David Greenman
3682d2baf0 Made minor readability tweak. 1995-03-20 23:00:57 +00:00
Garrett Wollman
c2bed6a371 Better fix for the deletion of parents of cloned routes problem,
superseding the `nextchild' hack.  This also provides a way
forward to fix RTM_CHANGE and RTM_ADD as well.
1995-03-20 21:30:21 +00:00
Garrett Wollman
69244b69db Support for pseudo-device LKMs. Note that this is restricted to only
one pseudo per module (a restriction which will eventually be lifted) and
isthus not in its final form.
1995-03-20 19:20:44 +00:00
Garrett Wollman
e1838a91c1 Beginnings of support for loadable pseudo-devices. bsd.kmod.mk support
and Makefiles for the more interesting ones to come on Monday.
1995-03-17 22:02:18 +00:00
Bruce Evans
b5e8ce9f12 Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'.  Fix all the bugs found.  There were no serious
ones.
1995-03-16 18:17:34 +00:00