Commit Graph

2096 Commits

Author SHA1 Message Date
christos 98db046cb6 make this compile. 2012-08-20 16:01:37 +00:00
bouyer 53f2b26141 Support checksum offloading in carp(4) if the underlying device suports it,
as proposed on tech-net@ on 2 Aug 2012.
2012-08-20 14:14:32 +00:00
spz 9d545ae650 <grmbl>whitespace</grmbl> 2012-07-19 21:08:42 +00:00
spz 8fda128ab3 this commit contains two sets of unrelated changes:
"while I was here" I checked other KAME implementations for their icmp6.h
version, and thus:
  - added a define for MLDV2_LISTENER_REPORT from FreeBSD
  - added defines for the missing ICMP6_DST_UNREACH codes

then on to what I actually wanted to do:
  - adds strings for the types and codes (encapsulated by ICMP6_STRINGS)
    for the use of npfctl and other tools that might want to parse
    human-friendly names instead of the corresponding number for ipv6-icmp
    types and codes.
    The strings are ordered such that their index is (as far as is practical)
    the number belonging to the name, which is why there are
    icmp6_type_err (use directly) and icmp6_type_info (add 128)
2012-07-19 20:57:43 +00:00
christos 84f52095ad rename rfc6056 -> portalgo, requested by yamt 2012-06-25 15:28:38 +00:00
christos bda667f3a1 remove unintended commit (this was to avoid a bug in the hme driver which
I have not been able to reproduce)
2012-06-22 15:09:36 +00:00
christos 40114b997c PR/46602: Move the rfc6056 port randomization to the IP layer. 2012-06-22 14:54:34 +00:00
yamt 365b42c39d for the default "bsd" algorithm, restore the pre rfc6056 changes behaviour.
fix anonportmin/max.

probably other algorithms need similar fixes.
2012-06-21 10:35:28 +00:00
yamt 3ded02d5cb constify, comments.
no functional changes.
2012-06-21 10:31:45 +00:00
yamt 50b5f975ae whitespace and cosmetics. no functional changes. 2012-06-21 10:30:47 +00:00
gdt 7f453cf715 Simply use the ifa_addr pointer, rather than taking its address.
Resolves failure to match addresses in SIOC[GD]LIFADDR calls.
Diagnosis and fix is due to Mark Keaton of BBN.
2012-06-08 15:01:51 +00:00
dsl e21a34c25e Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
  the item itself.
In the places where the caller specifies a function and a structure
  address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
  sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
  AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
  fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
2012-06-02 21:36:41 +00:00
martin fe585d0294 Explicitly include <sys/kmem.h> 2012-05-01 15:09:36 +00:00
rmind f1d428af19 - Replace some malloc(9) uses with kmem(9).
- G/C M_IPMOPTS, M_IPMADDR and M_BWMETER.
2012-04-30 22:51:27 +00:00
yamt 3b2f9a6361 comment 2012-04-13 15:38:04 +00:00
yamt 6c548e4b68 add a big comment
(copy and paste from cvs log rev.1.1)
2012-04-13 15:37:12 +00:00
yamt 88246c7ae3 comment 2012-04-13 15:35:57 +00:00
bouyer 968c24dd6d Do not sleep in callout context, this will hang the clock soft interrupt.
Should fix PR kern/46217.
2012-03-27 17:48:17 +00:00
christos 5e20bebba6 move back to 5.1.1 in the new place 2012-03-23 21:30:18 +00:00
drochner 364a06bb29 remove KAME IPSEC, replaced by FAST_IPSEC 2012-03-22 20:34:37 +00:00
christos b654a04427 PR/46077: M. Nunberg: Stat should not fial on connecting socket. 2012-03-17 02:48:51 +00:00
gson 0ee056ffda Fix random kernel memory corruption by algo_doublehash(). And by
"random" I don't mean just "arbitary" as in using an uninitialized
pointer, but random as in corrupting the contents of memory addresses
chosen using a crypto-strength random number generator.

I believe this is the likely cause of multiple reports of random
crashes over the last six months, including kern/45677 and kern/46096.
2012-03-15 13:25:46 +00:00
riz f8a1d7977c Back out the recent import of IPFilter 5.1.1 for the upcoming branch,
which will now have IPFilter 4.1.34.  IPFilter 5.1.1 will be restored
post-branch.

ok: core, releng.
2012-02-15 17:55:03 +00:00
drochner 2e20b1116a fix for IPSEC tunnel + NAT-T + esp_frag:
Output packets larger than "esp_frag" are fragmented first
and then reinjected into ip_output for encapsulation
and transfer. The problem was that each packet got a new
ip_id value assigned, so that fragments couldn't be matched
by the receiver. Offset information was overwritten too.
approved by releng
2012-02-15 16:11:23 +00:00
tls 7b0b7dedd9 Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.
2012-02-02 19:42:57 +00:00
matt 4b50cb788d Use proper ANSI prototypes for foo() -> foo(void)
Caught when compiling with -Wold-style-definition
2012-01-30 23:31:27 +00:00
darrenr ee0161be40 Patch to include ipf_rb.h missed from merge. 2012-01-30 21:10:30 +00:00
darrenr 68474ce176 New files required to build ipfilter into the kernel 2012-01-30 16:13:43 +00:00
liamjfoy 301d4b230a Remove ipf_start from ipf struct 2012-01-19 13:13:48 +00:00
drochner 11ce8fbd83 fix build in the (FAST_)IPSEC & TCP_SIGNATURE case 2012-01-11 14:39:08 +00:00
liamjfoy 23e0dddc1f minor typo fix 2012-01-09 22:26:44 +00:00
liamjfoy 24612de5fe check against NULL 2012-01-09 14:31:21 +00:00
christos 7c206e7387 make standalone 2012-01-07 20:20:22 +00:00
christos ba21b5b920 u_intN -> uintN
make standalone
2012-01-07 20:20:12 +00:00
liamjfoy e3d3462211 Remove dead variable 2012-01-02 22:17:11 +00:00
christos 42c420856f - fix offsetof usage, and redundant defines
- kill pointer casts to 0
2011-12-31 20:41:58 +00:00
christos 47b488844e missing comma 2011-12-24 20:18:54 +00:00
christos 47e057d110 add ICMP_STRINGS, a few more missing constants. 2011-12-24 20:08:39 +00:00
christos dfe558e7b1 put the histograms last and make them autosize (breaks compat with netstat). 2011-12-24 19:54:41 +00:00
christos 3f3e7f29e5 fix whitespace only 2011-12-24 19:54:13 +00:00
christos 6176e65815 add SKIP, fix PHOTURIS codes 2011-12-24 19:53:50 +00:00
jmc a8fd378f8a Include the ICMP_PHOTURIS error codes if we're going to define ICMP_PHOTURIS 2011-12-23 22:03:00 +00:00
christos 72ba32522f make ICMP_MAXTYPE 18 again to unbreak stats. 2011-12-23 19:08:50 +00:00
christos 209e832a68 add missing icmp types. 2011-12-23 15:31:16 +00:00
drochner 23e5beaef1 rename the IPSEC in-kernel CPP variable and config(8) option to
KAME_IPSEC, and make IPSEC define it so that existing kernel
config files work as before
Now the default can be easily be changed to FAST_IPSEC just by
setting the IPSEC alias to FAST_IPSEC.
2011-12-19 11:59:56 +00:00
tls 6e1dd068e9 Separate /dev/random pseudodevice implemenation from kernel entropy pool
implementation.  Rewrite pseudodevice code to use cprng_strong(9).

The new pseudodevice is cloning, so each caller gets bits from a stream
generated with its own key.  Users of /dev/urandom get their generators
keyed on a "best effort" basis -- the kernel will rekey generators
whenever the entropy pool hits the high water mark -- while users of
/dev/random get their generators rekeyed every time key-length bits
are output.

The underlying cprng_strong API can use AES-256 or AES-128, but we use
AES-128 because of concerns about related-key attacks on AES-256.  This
improves performance (and reduces entropy pool depletion) significantly
for users of /dev/urandom but does cause users of /dev/random to rekey
twice as often.

Also fixes various bugs (including some missing locking and a reseed-counter
overflow in the CTR_DRBG code) found while testing this.

For long reads, this generator is approximately 20 times as fast as the
old generator (dd with bs=64K yields 53MB/sec on 2Ghz Core2 instead of
2.5MB/sec) and also uses a separate mutex per instance so concurrency
is greatly improved.  For reads of typical key sizes for modern
cryptosystems (16-32 bytes) performance is about the same as the old
code: a little better for 32 bytes, a little worse for 16 bytes.
2011-12-17 20:05:38 +00:00
roy 46df35d87e When adding or scrubbing a prefix, always notify userland even if the
prefix does not have IFA_ROUTE.
Don't scrub the interface in SIOCAIFADDR if the new address does't
have IFA_ROUTE. If more functions are added to in_ifscrub then this logic
might need to be revisited.

Fixes PR/26450.
2011-12-12 00:06:39 +00:00
christos 450535e4c0 u_int -> uint 2011-12-11 23:56:10 +00:00
roy 4d6bb52603 Add RDNSS and DNSSL support, RFC6106.
Replace custom lists with TAILQ lists.
Clean up plently of signed vs unsigned warnings and set WARNS=4.

Adapted from FreeBSD.
2011-12-10 19:14:29 +00:00
tls 3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00