Commit Graph

1593 Commits

Author SHA1 Message Date
yamt 8dc7b19627 add a comment on if_agrprivate. 2006-06-25 07:50:00 +00:00
drochner 9d26b198b5 remove dependency on "agr" to make "struct ifnet" independant of the
kernel configuration, avoids kernel/userland mismatches, ok by christos
2006-06-23 19:02:51 +00:00
uwe 59d7f20391 Do not instal net/if_pppvar.h, net/if_slvar.h and net/if_stripvar.h.
The former two are no longer necessary as slstats is no more
and pppstats now uses an ioctl instead of rummaging through kmem.
The latter has nothign interesting for the userland, but uses
struct bintime that I'm about to hide under #ifdef _KERNEL.

A bunch of remaining <net/if_*.h> headers is pretty useless to the
userland too, but ... someone else's yag to shave...
2006-06-18 21:02:16 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
ragge cb7f51a59d Add IFM_10G_SR and IFM_10G_CX4, to keep in sync with FreeBSD.
Kindly requested by Gleb Smirnoff at FreeBSD.
2006-06-03 12:43:28 +00:00
elad 4ea6eb36cb add sysctl for routing stats 2006-05-27 23:08:11 +00:00
christos c52ff7f9d5 Fixes from David Boggs; in his words:
/sys/net/if_spppvar.h says:

	"Lower layer drivers that are always ready to communicate
	(like hardware HDLC) can shortcut pp_up from pp_tls,
	and pp_down from pp_tlf."

	When I follow those instructions, I get a kernel stack
	overflow as soon as I open the HDLC device.

	Here is the loop:
	 sppp_ioctl calls sppp_lcp_open
	 sppp_lcp_open calls sppp_open_event
	 sppp_open_event calls sppp_lcp_tls
	 sppp_lcp_tls calls pp_tls
	 pp_tls is the SHORTCUT to sppp_lcp_up
	 sppp_lcp_up calls spp_lcp_open
	 ...and around we go until the stack overflows.

	The fix is to reverse the order of the action (tls)
	and the state change (from INITIAL to STARTING) in
	sppp_open_event.

	There is a similar loop during closing:
	 sppp_ioctl calls sppp_lcp_close
	 sppp_lcp_close calls sppp_close_event
	 spp_close_event calls sppp_lcp_tlf
	 sppp_lcp_tlf calls pp_tlf
	 pp_tlf is the SHORTCUT to sppp_lcp_down
	 sppp_lcp_down calls sppp_lcp_close
	 ...and around we go until the stack overflows.

	The fix is to reverse the order of the action (tlf)
	and the state change (from STARTING to INITIAL) in
	sppp_close_event.

	Separately, while I was discovering this, I noticed
	that pp_tlf was being called unconditionally rather
	than first checking to see if it is NULL.  pp_tlf
	is a callout from sppp to the hdlc device driver.
	Elsewhere in sppp, this is always checked for NULL
	before calling it, and the comments in if_spppvar.h
	imply that filling it in is optional.

	From spppvar.h:
	"These functions need to be filled in by the lower layer
	(hardware) drivers if they request notification from the
	PPP layer whether the link is actually required."
	This clearly says that pp_tlf and pp_tls are optional
	and so sppp must check before calling them.
2006-05-21 05:09:13 +00:00
liamjfoy 4876c304b1 Integrate Common Address Redundancy Procotol (CARP) from OpenBSD
'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@
2006-05-18 09:05:49 +00:00
yamt fd1132d079 include sys/kauth.h for kauth_authorize_generic. 2006-05-15 09:07:59 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
christos 103d2f520c XXX: GCC uninitialized. 2006-05-14 05:30:31 +00:00
christos d04095abaa Comment out packed attributes that gcc 4 does not like. 2006-05-14 02:45:45 +00:00
mrg 126f7e1139 since ar_tha() can return NULL, don't pass it directly to functions
that expect real addresses.  explicitly KASSERT() that it is not
NULL in the kernel and just avoid using it userland.

(the kernel could be more defensive about this, but, until now it
would have just crashed anyway.)
2006-05-12 01:20:33 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
dyoung 2d794b9ed5 Remove needless "link state changed to DOWN/UP" message. 2006-05-01 18:17:42 +00:00
tron ed14057f29 Adapt maximum MTU permitted on pppoe(4) interfaces to the MTU of the
connected ethernet interface.
2006-04-27 20:04:26 +00:00
tron 7604b6a404 Don't allow to connect a non ethernet interface to a PPPoE interface. 2006-04-27 13:19:04 +00:00
simonb 22d1f42229 One __KERNEL_RCSID() should be enough for this file. 2006-04-22 04:58:49 +00:00
christos 667e91e30f Add an empty attach function. Reported by David Boggs 2006-04-20 17:03:35 +00:00
christos 74e3aa75eb Perry reports that buf can be NULL, so deal with it. 2006-04-19 15:13:34 +00:00
rpaulo 994567415c Fix another typo... I must be on drugs... 2006-04-18 19:30:49 +00:00
christos 17db7d5dd6 Don't use KASSERT, return an error instead to fix the build. 2006-04-15 04:45:01 +00:00
christos a302c8092d Coverity CID 2728: Add KASSERT before NULL deref. 2006-04-15 02:38:19 +00:00
christos d3b0d78d54 Coverity CID 1193: Add KASSERT before negative array deref. 2006-04-15 02:35:22 +00:00
christos e1b8701a82 Coverity CID 1147: Protect against NULL deref. 2006-04-15 02:27:25 +00:00
christos ef31177b25 Coverity CID 1146: Protect against NULL deref. 2006-04-15 02:26:17 +00:00
christos 2973de5c38 Coverity CID 1145: Protect against NULL deref. 2006-04-15 02:25:24 +00:00
christos bd7ea99daf Don't try to free a NULL mbuf. 2006-04-15 02:22:44 +00:00
christos 29a12667b7 Coverity CID 855: Add a KASSERT for null route from successful rtrequest. 2006-04-15 02:19:00 +00:00
christos 3a59edd545 Coverity CID 854: Add KASSERT before deref. 2006-04-15 02:14:44 +00:00
christos 36d8e665b9 Coverity CID 853: Prevent NULL deref. 2006-04-15 02:07:34 +00:00
christos c0b744d148 Coverity CID 756: Remove bogus NULL checks. 2006-04-15 02:03:36 +00:00
christos e7bb1b7128 Coverity CID 755: Protect against NULL deref. 2006-04-15 02:01:50 +00:00
christos 4bb7462638 PR/33231: Anraud Degroote: Miscellaneous cleanups in the route code:
- use of 0 instead of NULL
    - questionnable macros
2006-04-10 19:06:37 +00:00
rpaulo 58e5792e6a IFHEAD and PREPADDR are mutually exclusive. From FreeBSD. 2006-04-08 12:14:42 +00:00
rpaulo b5d1102290 Add another bit from FreeBSD that I forgot: in tun_output, don't try to send
an AF_INET packet if TUN_IFHEAD is not set.
From FreeBSD and spotted (again) by DEGROOTE Arnaud.
2006-04-04 15:43:23 +00:00
rpaulo ca98b087a8 Fix a if-clause botched in a previous revision now that we have TUN_IFHEAD.
Spotted by DEGROOTE Arnaud <degroote@enseirb.fr>.
2006-04-04 11:33:15 +00:00
rpaulo 11a20f0dec Change the number of TUN[GS]IFHEAD to avoid collision with if_pp.
Noticed by Simon Burge.
2006-04-04 11:23:59 +00:00
rpaulo 0dcbc9b794 Implement TUN_IFHEAD, the missing piece that was breaking old applications. 2006-04-03 23:29:39 +00:00
rpaulo 782e550804 Add missing break tunwrite() which was causing EAFNOSUPPORT to be
returned, thus making IPv6 support broken.
!@#$%^...
2006-03-29 19:29:00 +00:00
thorpej 2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
christos cbff0fb84a Add a new function called ether_snprintf() which takes an external buffer
and a length. The buffer should be 3 * addrlen.
Remove local tap_ether_sprintf(), and use ether_snprintf() instead.
2006-03-16 15:57:59 +00:00
christos cbf41b4afc Remove duplicate and slightly different declaration of ether_sprintf, which
really should be in if_ether.h like all the other ether_ functions.
2006-03-16 15:56:28 +00:00
lukem a1f606d3fd Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
2006-03-08 23:46:22 +00:00
msaitoh 1e5874b3c2 fix memory leak when resetting the source address and destination address. 2006-03-08 03:09:33 +00:00
rpaulo d5648da4c6 Some minor KNF. 2006-03-03 19:57:37 +00:00
rpaulo ece0242b47 Fix typo in comment. 2006-03-03 19:46:35 +00:00
christos 02b2f1b2b5 Provide ppp like statistics instead of grovelling through the kernel
symbols.
2006-03-02 17:20:07 +00:00
rpaulo a0814a3043 Add full support for IPv6 tunnels. From DEGROOTE Arnaud in PR 32944.
The PR submitter and the PR handler were unable to test this code
using Teredo userland clients such as Miredo. However, the PR handler
dumped and analyzed some of the packets produced by Miredo and they
seemed fine.
(On a side note: I was unable to setup Teredo in Windows XP and the
problem seemed similar to what I currently see in NetBSD: lack of
replies from the Teredo relay).
2006-02-28 00:38:35 +00:00
drochner be8cb1f8b9 add missing DLTs from the libpcap-0.9.4 distribution 2006-02-27 14:22:26 +00:00
drochner 4cf9c4d0dc fix bpf_validate():
a missing "break" caused any bpf filter containing
a division to be rejected
2006-02-27 11:42:58 +00:00
wiz 1ad8067cb3 Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
2006-02-25 00:58:34 +00:00
pooka 833be9a435 comment police: p_dupfd is now known as l_dupfd and lives in struct lwp 2006-02-24 12:54:48 +00:00
rpaulo 08d09ff6c5 In sysctl_iflist() don't assume TAILQ_FIRST() will never be NULL.
Prevents crash found by Uwe and fix confirmed working by Jeff Ito (all
on tech-net).
2006-02-21 22:01:17 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
bjh21 24b46da494 Make Econet code compile again. 2006-02-12 10:32:46 +00:00
wiz 9037345f22 Add a /* CONSTCOND */ for lint. 2006-02-07 20:10:48 +00:00
rpaulo be72809857 Add preliminary/not tested support for IPv6. 2006-02-05 16:44:55 +00:00
cube 97047d48dd Properly dispose of cfdata memory when unloading the tap(4) LKM. 2006-02-01 05:51:58 +00:00
martin 0975a4b449 Make sure error messages (received from the access concentrator) are
zero terminated.
2006-01-31 23:50:15 +00:00
rpaulo 219ca2b318 Replace the comment that came from if_loop.c many years ago by
something that matches reality.
2006-01-31 22:27:15 +00:00
christos f0551e03f4 PR/32676: Yves-Emmanuel JUTARD: faithprefix should only be defined with INET6 2006-01-31 17:15:20 +00:00
jdolecek 8ce024013a fix VLAN_ATTACHED() macro, it was always true due to condition bug
Fixes PR kern/32645 by Pavel Cahyna
2006-01-29 09:57:59 +00:00
rpaulo e4a54dec0a Reflect reality (ktrace-lwp). 2006-01-28 01:49:58 +00:00
rpaulo 78678b130a Better support of IPv6 scoped addresses.
- most of the kernel code will not care about the actual encoding of
  scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
  scoped addresses as a special case.
- scope boundary check will be stricter.  For example, the current
  *BSD code allows a packet with src=::1 and dst=(some global IPv6
  address) to be sent outside of the node, if the application do:
    s = socket(AF_INET6);
    bind(s, "::1");
    sendto(s, some_global_IPv6_addr);
  This is clearly wrong, since ::1 is only meaningful within a single
  node, but the current implementation of the *BSD kernel cannot
  reject this attempt.
- and, while there, don't try to remove the ff02::/32 interface route
  entry in in6_ifdetach() as it's already gone.

This also includes some level of support for the standard source
address selection algorithm defined in RFC3484, which will be
completed on in the future.

From the KAME project via JINMEI Tatuya.
Approved by core@.
2006-01-21 00:15:35 +00:00
christos 4dde6a6d1b Make sure that breq is also cleared (from Xin LI) 2006-01-17 13:23:02 +00:00
christos a94f0325fe zlib 1.2.3 changed the include protection variable names; adjust. 2006-01-14 20:17:12 +00:00
christos 81a0859118 prepare for userland compilation. 2006-01-14 18:58:05 +00:00
christos 1482d7ce1c Make sure we initialize all structs to 0; from Xin LI 2006-01-09 13:04:38 +00:00
perry 23917a5e48 #ifdef _KERNEL some function prototypes and an inline function
definition.

XXX It may be that this file needs more namespace cleaning (or the
files that include it, like if.h, might need it.)
2006-01-04 21:10:09 +00:00
yamt 95b350ea52 ppp_dequeue: fix a mbuf leak/packet loss introduced by rev.1.104. 2006-01-02 01:42:36 +00:00
christos fffd2322a9 make this compile with no INET option 2005-12-28 09:08:20 +00:00
christos cab48fd783 PR/5901: Felix A. Croes: PPP fast queue blocks traffic at normal priority.
Applied fix, similar to the one suggested in the PR. We use a counter to
limit the number of consecutive packets accepted from the fast queue. This
number can be set via ioctl, but this has not been implemented. Since there
are only 2 queues other proposed solutions such as ALTQ are overkill and
they have not been implemented in the past 7 years. Now LCP echos can be
used to detect that the line is up.
2005-12-28 08:13:24 +00:00
rpaulo 7eace3f40d Kill BPF_KERN_FILTER. Seems like it died with the new pppd import.
No replies from tech-kern@, but who introduced this option 8 years ago
(Christos) said it's ok to remove it.
2005-12-26 15:45:48 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
rpaulo 08ac963d6f Correct typo in comments. 2005-12-14 22:46:52 +00:00
rpaulo 43bb9c133c Fix previous commit: ABS, IND and MSH are valid codes. 2005-12-14 20:33:46 +00:00
christos 49743c0da1 argument type conflict. 2005-12-14 00:28:08 +00:00
rpaulo 7174b22dd3 In bpf_validate(), get rid of bpf_maxbufsize test as there are other
clients of bpf_filter(), like if_ppp, that are not limited by
bpf_maxbufsize. The same check is done at the run time, so there is no
problem created.

Noticed by Guy Harris in private email.
2005-12-13 23:53:49 +00:00
thorpej 63eac52bac ANSI function decls and application of static. 2005-12-11 23:05:24 +00:00
christos b41db3f2c3 Protect zlib.h with the same symbol as userland.
XXX: We should either not install this, or have only one copy.
2005-12-11 19:15:38 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
elad 976bf6cfdd Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
2005-12-10 23:21:38 +00:00
christos a8ffde9f61 make the ALTQ macros statement-line, by wrapping them in do {} while (0) 2005-12-06 02:56:25 +00:00
rpaulo 5eb6226d2b Oops, the previous revision had a wrong pre-processor #if clause. 2005-12-05 22:38:40 +00:00
rpaulo 7246666eed Make the bpf_maxbufsize a constant when bpfilter pseudo-device is not
present in the kernel config, thus fixing the build. Problem reported
by Havard Eidnes. Solution proposed by Christos, thanks.
2005-12-05 21:46:00 +00:00
rpaulo fe7fedbe4c PR 32198: bpf_validate() needs to do more checks, from Otto Moerbeek/OpenBSD
via Guy Harris.
Problems like out-of-bounds read/write in filter machine operations
were fixed.
2005-11-30 23:14:38 +00:00
rpaulo 5a418776bf More KNF. C99 uintXX_t types. 2005-11-30 22:40:59 +00:00
rpaulo 940d1d8665 Replace u_intXX_t by their C99 counterparts. 2005-11-30 16:47:58 +00:00
rpaulo 33ea9f9f29 Fix typo in comment found by Guy Harris (PR 32198). 2005-11-30 12:54:42 +00:00
rpaulo 6d95f3bed8 KNF. ANSYfy. de-P(). 2005-11-30 12:52:23 +00:00
thorpej 7d00e1aff3 Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
  that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
  ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
  registering those disciplines with the system.  The linesw
  structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
  be held.  ttyldisc_release() releases the reference.  Attempts to
  detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
  that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().
2005-11-27 05:35:52 +00:00
yamt 11aa556068 fix a typo in a comment. 2005-11-23 09:43:37 +00:00
yamt 9a01903be3 correct SADB_X_MIGRATE. pointed by Francis Dupont. 2005-10-29 15:05:13 +00:00
yamt 78e012015b add some #if 0'ed out SADB_X_* definitions found in kame tree
to avoid conflicting numbers.
2005-10-25 06:12:49 +00:00
christos 86497ecc9f It is now ``later''. Follow cgd's 1993 wish and move struct osockaddr
and struct omsghdr to a compat header.
2005-09-24 15:52:03 +00:00
rpaulo dc5a3ff210 Use ANSI function declarations everywhere and a consistent indentation on
them.
2005-09-05 18:32:24 +00:00
martin ebe6c135ee Fix bogus uninitialized variable warning ifdef PPPOE_SERVER.
Noticed by Marcin Jessa on current-users.
2005-08-31 00:00:26 +00:00
yamt 2e85eff671 - introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.
2005-08-18 00:30:58 +00:00