Commit Graph

1563 Commits

Author SHA1 Message Date
cube 207af46910 Add a note about the use of CTL_CREATE in sysctl_createv, otherwise the
code can be confusing.
2006-09-01 16:28:53 +00:00
dyoung 9cc1c09a17 Rename gre_softc member sc_sp to sc_soparm to fix NetBSD/alpha
compiles, where some other system header #defines sc_sp.

In gre_ioctl, GREDSOCK case, do not try to delete sc_fp if it is
NULL.

Move GREDSOCK and GRESSOCK definitions to where the other GRE ioctls
are defined.

Remove #ifdef GRESSOCK, it's unnecessary now that the feature is
complete.
2006-09-01 01:34:05 +00:00
dyoung 47be766fd3 Add a mode to gre(4) that sends GRE tunnel packets in UDP datagrams.
Fix MOBILE encapsulation.  Add many debugging printfs (mainly
concerning UDP mode).  Clean up the gre(4) code a bit.  Add the
capability to setup UDP tunnels to ifconfig.  Update documentation.

In UDP mode, gre(4) puts a GRE header onto transmitted packets,
and hands them to a UDP socket for transmission.  That is, the
encapsulation looks like this: IP+UDP+GRE+encapsulated packet.

There are two ways to set up a UDP tunnel.  One way is to tell the
source and destination IP+port to gre(4), and let gre(4) create
the socket.  The other way to create a UDP tunnel is for userland
to "delegate" a UDP socket to the kernel.
2006-08-31 17:46:16 +00:00
christos 514b3fccd7 fix initializer 2006-08-30 17:00:15 +00:00
christos 378a57007e fix initializers. 2006-08-30 16:58:38 +00:00
christos 3ed5fa0441 Fix initializers. 2006-08-30 16:57:59 +00:00
christos a3b3beb093 fully initialize IF_CLONE_INITIALIZER 2006-08-30 16:41:08 +00:00
christos 6d637b500d add missing initializer 2006-08-28 00:09:28 +00:00
matt 6c8fa3224e One step closer to loadable domains. Store pointers to a domain's soft
interrupt queues so if_detach can remove packets to removed interfaces from
them.  This eliminates a lot of conditional ugly code in if.c
2006-08-25 19:33:50 +00:00
adrianp 3d8cbc06ba A problem has been identified in the in-kernel PPP code shared by ISDN PPP
interfaces ippp(4) and pppoe(4). Insufficient checking of options presented
by the peer may cause writing of copies of the malicious input beyond the
end of a buffer allocated for that purpose.

Issue found by pavel@
Fix from martin@

This is SA2006-019 (CVE-2006-4304)
2006-08-23 20:02:23 +00:00
pavel 8bf13164fe defflag PPPOE_SERVER and PPPOE_TERM_UNKNOWN_SESSIONS. 2006-08-05 17:20:54 +00:00
martin f1dc5b61db Fix typo in comment 2006-08-04 23:18:53 +00:00
christos 224c697f91 Patch from Dheeraj S, inspired by the following FreeBSD change:
Rather than calling mircotime() in catchpacket(), make catchpacket()
take a timeval indicating when the packet was captured. Move
microtime() to the calling functions and grab the timestamp as soon
as we know that we're going to call catchpacket at least once.

This means that we call microtime() once per matched packet, as
opposed to once per matched packet per bpf listener. It also means
that we return the same timestamp to all bpf listeners, rather than
slightly different ones.

It would be more accurate to call microtime() even earlier for all
packets, as you have to grab (1+#listener) locks before you can
determine if the packet will be logged. You could always grab a
timestamp before the locks, but microtime() can be costly, so this
didn't seem like a good idea.

(I guess most ethernet interfaces will have a bpf listener these
days because of dhclient. That means that we could be doing two bpf
locks on most packets going through the interface.)
2006-07-26 13:54:13 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
martin dee43775e6 Small simplification, pointed out by Christian Hattemer in private mail. 2006-07-13 23:43:13 +00:00
martin 81b2f47532 Do not automagically UP the interface when setting the address.
Together with previous ifconfig changes, this fixes PR 30694, at
least for pppoe (and other sppp based) interfaces.
2006-07-13 14:04:50 +00:00
tsutsui 79d3d94bff KNF. 2006-07-08 18:32:53 +00:00
yamt 7d19947ffd make a multiple inclusion protection macro match with the filename. 2006-07-08 05:57:41 +00:00
yamt 85d844ab45 agr_ioctl: wrap a long line after kauth merge. 2006-07-08 05:56:48 +00:00
tron d700257e96 Make this build with GCC 4.x. 2006-06-27 10:45:09 +00:00
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