Commit Graph

1180 Commits

Author SHA1 Message Date
dyoung 8d267ee73a 0 -> NULL 2007-02-17 20:38:05 +00:00
dyoung 05b0abac15 Don't open-code LIST_FOREACH(). 2007-02-17 06:11:25 +00:00
seanb d51aaad793 Typo in comment. 2007-02-15 16:28:37 +00:00
degroote e2211411a4 Commit my SoC work
Add ipv6 support for fast_ipsec
Note that currently, packet with extensions headers are not correctly
supported
Change the ipcomp logic
2007-02-10 09:43:05 +00:00
dyoung 741e438b04 Cosmetic: bzero -> memset. Change a bcopy() to a struct assignment. 2007-01-29 06:20:43 +00:00
dyoung 7218cc6856 Cosmetic: bzero -> memset, remove gratuitous cast, compare pointer
with NULL instead of 0.
2007-01-29 06:13:58 +00:00
dyoung 347073533b In In ip6_setmoptions(), don't leave a route cache (struct route_in6)
on the stack if we exit with EADDRNOTAVAIL.

(I already fixed this bug once tonight.  Clearly, ip6_setmoptions
was cut-and-pasted from ip_setmoptions.)
2007-01-29 06:12:48 +00:00
dyoung 40d75dce06 Cosmetic: move an splsoftnet() call out of the variable declarations,
get rid of a gratuitous cast, change (struct socket *)0 to NULL.
2007-01-29 06:05:10 +00:00
dyoung f2a11fe343 bzero -> memset 2007-01-29 06:02:26 +00:00
dyoung 2539c85ea4 bzero -> memset 2007-01-26 19:20:15 +00:00
dyoung d77571df22 bzero -> memset 2007-01-26 19:02:02 +00:00
dyoung befcb437f9 Change a couple of bzeros to memsets. 2007-01-26 19:01:26 +00:00
dyoung 2148d49b3a Cosmetic: indent using ASCII horizontal tab, insert space following
comma, wrap line.
2007-01-15 21:49:56 +00:00
degroote ed7ae80021 Fix an infinite loop ( and local dos ) in the case where the ip6_hdr and
the icmp6_hdr are not in the same mbuf.
Fix pr/34994 and probably pr/35333
Ok @rpaulo
2007-01-15 19:11:48 +00:00
elad b2eb9a5389 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 19:07:03 +00:00
alc c7b3cb6e97 CID-3317: check for 'm != NULL' before using it (rework the code path to
explicitly return `EINVAL'. Before, it was done but later in
ip6_setpktopt() when checking for 'len < ...')
CID-3316: check for 'm != NULL' before using it

ok christos@
2006-12-27 18:49:40 +00:00
mlelstv e2d192dd4b do not compare ipv6 ipsec tunnel addresses against uninitialized data.
Fixes PR kern/34734
2006-12-20 15:39:23 +00:00
joerg eb04733c4e Introduce new helper functions to abstract the route caching.
rtcache_init and rtcache_init_noclone lookup ro_dst and store
the result in ro_rt, taking care of the reference counting and
calling the domain specific route cache.
rtcache_free checks if a route was cashed and frees the reference.
rtcache_copy copies ro_dst of the given struct route, checking that
enough space is available and incrementing the reference count of the
cached rtentry if necessary.
rtcache_check validates that the cached route is still up. If it isn't,
it tries to look it up again. Afterwards ro_rt is either a valid again
or NULL.
rtcache_copy is used internally.

Adjust to callers of rtalloc/rtflush in the tree to check the sanity of
ro_dst first (if necessary). If it doesn't fit the expectations, free
the cache, otherwise check if the cached route is still valid. After
that combination, a single check for ro_rt == NULL is enough to decide
whether a new lookup needs to be done with a different ro_dst.
Make the route checking in gre stricter by repeating the loop check
after revalidation.
Remove some unused RADIX_MPATH code in in6_src.c. The logic is slightly
changed here to first validate the route and check RTF_GATEWAY
afterwards. This is sementically equivalent though.
etherip doesn't need sc_route_expire similiar to the gif changes from
dyoung@ earlier.

Based on the earlier patch from dyoung@, reviewed and discussed with
him.
2006-12-15 21:18:52 +00:00
dyoung c308b1c661 Here are various changes designed to protect against bad IPv4
routing caused by stale route caches (struct route).  Route caches
are sprinkled throughout PCBs, the IP fast-forwarding table, and
IP tunnel interfaces (gre, gif, stf).

Stale IPv6 and ISO route caches will be treated by separate patches.

Thank you to Christoph Badura for suggesting the general approach
to invalidating route caches that I take here.

Here are the details:

Add hooks to struct domain for tracking and for invalidating each
domain's route caches: dom_rtcache, dom_rtflush, and dom_rtflushall.

Introduce helper subroutines, rtflush(ro) for invalidating a route
cache, rtflushall(family) for invalidating all route caches in a
routing domain, and rtcache(ro) for notifying the domain of a new
cached route.

Chain together all IPv4 route caches where ro_rt != NULL.  Provide
in_rtcache() for adding a route to the chain.  Provide in_rtflush()
and in_rtflushall() for invalidating IPv4 route caches.  In
in_rtflush(), set ro_rt to NULL, and remove the route from the
chain.  In in_rtflushall(), walk the chain and remove every route
cache.

In rtrequest1(), call rtflushall() to invalidate route caches when
a route is added.

In gif(4), discard the workaround for stale caches that involves
expiring them every so often.

Replace the pattern 'RTFREE(ro->ro_rt); ro->ro_rt = NULL;' with a
call to rtflush(ro).

Update ipflow_fastforward() and all other users of route caches so
that they expect a cached route, ro->ro_rt, to turn to NULL.

Take care when moving a 'struct route' to rtflush() the source and
to rtcache() the destination.

In domain initializers, use .dom_xxx tags.

KNF here and there.
2006-12-09 05:33:04 +00:00
joerg 22f3b113a0 Remove now superflous {. 2006-12-08 17:20:05 +00:00
joerg c882b2cbc1 When a dynamic route is deleted in in_losing and in6_losing, rtrequest
is called, but the current reference via the PCB is not removed. This
is effectively a leaked reference. Call rtfree unconditional.
2006-12-08 16:06:22 +00:00
jdc 6d7a98c7bc Explicitly include <sys/device.h>, which we need for `struct device'.
This allows us to compile on !i386.  (On i386, <machine/cpu.h> pulled
in <sys/device.h> for us, thus hiding the compilation problem.)

OK by rpaulo@.
2006-12-06 21:42:38 +00:00
dyoung 8068916447 Synchronize access to the ifaddr list by in6_update_ifa() and
in6_control() with splnet()/splx().  I was being a bit paranoid
here.  Following a cursory analysis of the code, this still looked
necessary.  We don't spend a lot of time in these calls, so it
should not be too harmful to suspend network interrupts.

In in6_unlink_ifa(), call in6_delmulti() just once on each multicast
address (in6_multi).  Previously, in6_unlink_ifa() called in6_delmulti()
on each in6_multi until in6_delmulti() removed the in6_multi from
the list and freed its memory.  That's not justified: the multicast
list holds *one* reference.  All other references belong to other
entities.  We must wait to free the memory until the other entities
release their references, to protect against dereferencing a freed
in6_multi.

XXX I need to revisit in6_delmulti(), in6_unlink_ifa(), and friends,
XXX to pry apart the conditions where an in6_multi is removed from
XXX its list and where it is freed.  Following my change, above,
XXX we still risk dereferencing a freed in6_multi.

Prevent in6_update_ifa() and in6_addremloop() from creating dangling
pointers to interfaces in the routing table.  Previously, my NetBSD
tunnel concentrator, which adds and deletes a lot of P2P interfaces
with the same local address, crashed in 8 hours or less when it
dereferenced a dangling pointer to a deleted ifnet.  Now, its uptime
is greater than 3 days.
2006-12-02 20:40:58 +00:00
dyoung 3b46d8b708 Use the queue(3) macros instead of open-coding them. Shorten
staircases.  Remove unnecessary casts.  Where appropriate, s/8/NBBY/.
De-__P().  KNF.

No functional changes intended.
2006-12-02 18:59:17 +00:00
dyoung 2f9c32c833 Fix a spelling error.
Annotate a memory leak.

When copying one multicast address list to another, IFAREF before IFAFREE
to protect against using an ifaddr after (accidentally) freeing it.

LIST_REMOVE() a multicast address from its old list before
LIST_INSERT_HEAD() on its new list.

Do not count on in6_delmulti() removing its multicast-record argument
from the multicast address list that the record belongs to, because
clearly that is not what it (always) does.
2006-11-29 03:05:12 +00:00
yamt 401e606d0d move tso-by-software code to their own files. no functional changes. 2006-11-25 18:41:36 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
yamt 809ec70bcf implement ipv6 TSO.
partly from Matthias Scheler.  tested by him.
2006-11-23 19:41:58 +00:00
rpaulo 5423539f94 New EtherIP driver based on tap(4) and gif(4) by Hans Rosenfeld.
Notable changes:
	* Fixes PR 34268.
	* Separates the code from gif(4) (which is more cleaner).
	* Allows the usage of STP (Spanning Tree Protocol).
	* Removed EtherIP implementation from gif(4)/tap(4).

Some input from Christos.
2006-11-23 04:07:07 +00:00
dyoung 810f665a21 Use LIST_/TAILQ_ macros, esp. LIST_FOREACH() and TAILQ_FOREACH().
Use the usual idiom for iterating over a list where we might
_REMOVE() entries,

        for (x = TAILQ_FIRST(...); x != NULL; x = nx) {
                nx = TAILQ_NEXT(x, ...);
                ...
        }
2006-11-20 04:34:16 +00:00
dyoung 3df10e0d11 Cosmetic: use LIST_ macros. Shorten some staircases.
Defensive programming: set an in6_multi's ifaddr reference to NULL
after releasing it, to protect against reuse.
2006-11-20 04:26:22 +00:00
dyoung df200b9f49 Use TAILQ_FOREACH(). 2006-11-20 04:17:57 +00:00
dyoung 8ce3cb1edc Use the TAILQ_/LIST_ macros instead of open-coding them. 2006-11-20 04:16:27 +00:00
dyoung c02f6943e0 Cosmetic: join two lines. 2006-11-20 04:13:28 +00:00
dyoung 61e2e920d9 Remove __P(). Use LIST_ macros instead of accessing lh_first
directly.
2006-11-18 16:23:15 +00:00
dyoung 6a611f0c78 Cosmetic: use TAILQ_FOREACH(). Remove superfluous parentheses from
return statements.
2006-11-18 16:17:55 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
dyoung a25eaede91 Add a source-address selection policy mechanism to the kernel.
Also, add ioctls SIOCGIFADDRPREF/SIOCSIFADDRPREF to get/set preference
numbers for addresses.  Make ifconfig(8) set/display preference
numbers.

To activate source-address selection policies in your kernel, add
'options IPSELSRC' to your kernel configuration.

Miscellaneous changes in support of source-address selection:

        1 Factor out some common code, producing rt_replace_ifa().

        2 Abbreviate a for-loop with TAILQ_FOREACH().

        3 Add the predicates on IPv4 addresses IN_LINKLOCAL() and
          IN_PRIVATE(), that are true for link-local unicast
          (169.254/16) and RFC1918 private addresses, respectively.
          Add the predicate IN_ANY_LOCAL() that is true for link-local
          unicast and multicast.

        4 Add IPv4-specific interface attach/detach routines,
          in_domifattach and in_domifdetach, which build #ifdef
          IPSELSRC.

See in_getifa(9) for a more thorough description of source-address
selection policy.
2006-11-13 05:13:38 +00:00
cbiere 5e6609fb28 Commented out IPv6 socket options which are no longer supported. 2006-10-31 00:29:30 +00:00
mrg 4804ddb2d7 what was <crypto/sha2/sha2.h> and <crypto/ripemd160/rmd160.h> is now
<sys/sha2.h> and <sys/rmd160.h>.
2006-10-27 22:50:28 +00:00
christos 31a62606ea Merge kernel and userland rmd160 and sha2 implementation.
XXX: We still install rmd160.h and sha2.h in /usr/include/crypto, unlike
the other hash functions which get installed in /usr/include for compatibility.
2006-10-27 21:20:48 +00:00
christos 95809f6403 use portable bitfields. 2006-10-17 14:52:21 +00:00
dyoung a42ff4b405 Make SIOCALIFADDR work for adding IPv6 addresses: initialize the
lifetime of the addresses to infinity (ND6_INFINITE_LIFETIME).

Nobody squealed when I proposed this on tech-net.
2006-10-15 07:00:44 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
dogcow 55ddfc9aae change the MOWNER_INIT define to take two args; fix extant struct mowner
decls to use it. Makes options MBUFTRACE compile again and not whinge about
missing structure declarations. (Also makes initialization consistent.)
2006-10-10 21:49:14 +00:00
tls 8cc016b4bc Protect calls to pool_put/pool_get that may occur in interrupt context
with spl used to protect other allocations and frees, or datastructure
element insertion and removal, in adjacent code.

It is almost unquestionably the case that some of the spl()/splx() calls
added here are superfluous, but it really seems wrong to see:

	s=splfoo();
	/* frob data structure */
	splx(s);
	pool_put(x);

and if we think we need to protect the first operation, then it is hard
to see why we should not think we need to protect the next.  "Better
safe than sorry".

It is also almost unquestionably the case that I missed some pool
gets/puts from interrupt context with my strategy for finding these
calls; use of PR_NOWAIT is a strong hint that a pool may be used from
interrupt context but many callers in the kernel pass a "can wait/can't
wait" flag down such that my searches might not have found them.  One
notable area that needs to be looked at is pf.

See also:

http://mail-index.netbsd.org/tech-kern/2006/07/19/0003.html
http://mail-index.netbsd.org/tech-kern/2006/07/19/0009.html
2006-10-05 17:35:19 +00:00
is ed48e2c326 Fix typo in comment 2006-09-26 11:55:41 +00:00
dyoung 71522fb484 Simplify and repair icmp6_input() to stop the kernel from panicking
in m_copydata() when an ICMP6_ECHO_REQUEST is received, as reported
by Tatoku Ogaito on current-users@.
2006-09-05 16:11:26 +00:00
christos d13620d51a comment out impossible comparison. 2006-09-03 05:16:59 +00:00
christos 7ca3c62d31 - fix initializers
- add const
- remove dead code
2006-09-02 07:22:44 +00:00
dyoung 19ce2e4680 Vastly simplify the code that copies an ICMP6 packet to two data
paths: ICMP6 reply path, and socket path.
2006-09-01 02:44:46 +00:00
dyoung cb88bdd489 Re-use macro IN6_IS_SCOPE_EMBEDDABLE(). 2006-09-01 02:25:29 +00:00
dyoung f583dae6cb Restore historical kernel behavior: let an application bind(2) an
IPv6 interface address (e.g., sin6_addr fe80::200:24ff:fec3:4bac
sin6_scope_id 1), set a multicast interface with
setsockopt(,IPPROTO_IPV6,IPV6_MULTICAST_IF,), and sendto(2) multicast
destinations with "wildcard" scope ID, 0, without error EHOSTUNREACH.

Prior to this patch, sendto(2) would exit with EHOSTUNREACH, even
though the scope ID was unambiguously specified both by bind(2)
and setsockopt(2).  This was a bug because it broke old applications.

Thanks JINMEI Tatuya for the patch!
2006-09-01 01:59:56 +00:00
christos e07cc888fc remove empty code. 2006-08-30 19:15:05 +00:00
christos e8c80b0ceb remove impossible comparisons. 2006-08-30 17:15:22 +00:00
christos ff89ad5027 fix initializers 2006-08-30 17:13:45 +00:00
christos 966c4b104a Fix initializers. 2006-08-30 17:11:53 +00:00
christos ca0d162d55 add missing initializers 2006-08-30 17:05:30 +00:00
christos 86fad06b76 declare the type of code. 2006-08-30 15:25:08 +00:00
christos d65306455b comment out comparison always false 2006-08-30 01:23:35 +00:00
christos ef6c9d757e fix incomplete initializer 2006-08-30 01:17:09 +00:00
christos 588c80f975 remove extra members 2006-08-28 02:51:12 +00:00
christos 8f1ca4d223 gc unused member. 2006-08-27 23:55:16 +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
matt 1b21337267 Don't include <netccitt/x25.> and don't bother checking for SIOCSIFCONF_X25. 2006-08-25 18:29:17 +00:00
christos 35ca6c8b5b Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
2006-08-17 17:11:27 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
tron 9563ec16dc Add diagnostic checks for hardware-assisted checksum related flags in
the mbuf which supposed to get sent out:
- Complain in ip_output() if any of the IPv6 related flags are set.
- Complain in ip6_output() if any of the IPv4 related flags are set.
- Complain in both functions if the flags indicate that both a TCP and
  UCP checksum should be calculated by the hardware.
2006-07-12 13:11:27 +00:00
tron 8fe4e4040d Clear mbuf checksum flags before passing it to ip6_output(). We might
recycle a mbuf which contained a hardware provided checksum. This
fixes "traceroute6" to a machine which is using a wm(4) interface
that has UDP or TCP checksum offload enabled.
2006-07-11 22:13:56 +00:00
rpaulo 4e0b046439 Add a missing piece from RFC 3542. KAME-NetBSD-current branch
revision 1.1.1.2.2.5:
	do not call pfctlinput2(PRC_MSGSIZE) on fragmentation to avoid
	notification storm

From Keiichi SHIMA:
  "In the current NetBSD code, the PRC_MSGSIZE message will be generated
   for every fragmented packets when a node is trying to send a big
   packet. That was the intermediate behavior while RFC3542 was under
   discussion."

By (obviously) the KAME project.
2006-07-08 19:58:40 +00:00
liamjfoy 56054d1bbb Fix a minor printf found while reading the code 2006-06-29 16:56:31 +00:00
drochner 7d0c55ee34 fix the dad_count logic: if we send a packet successfully, reset the counter
for sent tries -- otherwise it gets confused if dad_count is set to >15
by the sysctl, and addresses get stuck in "tentative" state forever
2006-06-28 16:43:43 +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
dogcow 5e988d30ba include <netccitt/x25.h> for the SIOCSIFCONF_X25 case in in6_control. 2006-06-03 06:56:43 +00:00
christos 26deb5021a Fix typo. 2006-06-03 01:43:47 +00:00
christos 7353ed65a9 add 2 more ioctls that use struct ifaddr *, and remove debugging printfs
I accidentally committed.
2006-06-03 01:32:52 +00:00
christos 404d15411e This is ugly, but it is the simplest fix to avoid calling in the default
case:

    <driver>_ioctl(ifp, SIOCSIFADDR, struct ifreq *)

where it should be calling:

    <driver>_ioctl(ifp, SIOCSIFADDR, struct ifaddr *)

and "Bad Things Happen (TM)"

Returning an error is good enough because none of the drivers handle INET6.

The problem here is that handling SIOCSIFADDR is a kludge. The ioctl gets
passed a struct ifreq * from userland, but then in the control routines
SIOCSIFADDR is handled "specially", and we call:

	ifp->if_ioctl(ifp, SIOCSIFADDR, struct ifaddr *)

directly with the ifaddr we computed for that interface. It would be nice
if we called the ioctl routine if the original struct ifreq, and computed
the ifaddr, or passed it directly. This way all the ioctls would be treated
the same way, and we would not have the problem of pointer overloading.
2006-06-03 01:04:29 +00:00
bouyer ad55d247de Make the mbuf writable before calling in6_clearscope(). Based on patch sent
by David Young on tech-kern.
2006-05-25 21:32:47 +00:00
rpaulo ff3f0e34cc In ip6_savecontrol(), ignore IPv4 packets.
From JINMEI Tatuya (KAME). Should fix PR 33269.
2006-05-23 14:20:56 +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
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
rpaulo 42a3b0025e Use C99 uintXX_t types so that applications don't need to include
sys/types.h directly (as in the past).
2006-05-07 23:41:17 +00:00
rpaulo c27ebb0e79 while (1) -> for (;;) 2006-05-07 16:02:40 +00:00
rpaulo de8db47547 Add support for RFC 3542 Adv. Socket API for IPv6 (which obsoletes 2292).
* RFC 3542 isn't binary compatible with RFC 2292.
* RFC 2292 support is on by default but can be disabled.
* update ping6, telnet and traceroute6 to the new API.

From the KAME project (www.kame.net).
Reviewed by core.
2006-05-05 00:03:21 +00:00
christos 55f3f4d6c8 Coverity CID 607: Remove bogus test. 2006-04-15 00:30:48 +00:00
christos 1eb02d66d2 Coverity CID 608: #ifdef out dead code. 2006-04-15 00:28:16 +00:00
christos f1a8105e4c Coverity CID 740: Change constant comparisons to MCLBYTES to KASSERT and remove
extraneous tests.
2006-04-15 00:24:12 +00:00
christos 0cc667d207 Coverity CID 856: m cannot be NULL here. Remove bogus test. 2006-04-15 00:13:23 +00:00
christos 826c34719e Coverity CID 857: Prevent NULL deref. 2006-04-15 00:09:29 +00:00
dyoung 505b26e976 Add predicate IN6_IS_SCOPE_EMBEDDABLE(__a), which is true if and
only if the address __a is the type in which the IPv6 stack embeds
scope information.
2006-03-29 21:29:59 +00:00
rpaulo 1acb7de56f From KAME via SUZUKI Shinsuke:
fixed a memory leak when net.inet6.icmp6.nd6_maxqueuelen is
	greater than 1.
2006-03-24 19:24:38 +00:00
rpaulo 4532d44c4d RFC 4191 changed the meaning of the "Reserved" Router Preference
value. Previously the router should treat the recieved router
advertisement as having a 0 router lifetime. The RFC now says that the
router should treat the "Reserved" field the same way as if it was the
medium (default) preference.

From the KAME project via SUZUKI Shinsuke.
2006-03-20 12:13:05 +00:00
rpaulo 7122043ef9 0 > len ==> len < 0 2006-03-17 23:29:20 +00:00
rpaulo 86cd5b8af4 0 > len ==> len < 0 2006-03-17 23:26:06 +00:00
rpaulo 941ce91614 Rename local variables called delay that shadow the delay() decl.
Pointed out by Robert Swindells.
2006-03-06 20:33:52 +00:00
rpaulo 8c2379fd97 NDP-related improvements:
RFC4191
	- supports host-side router-preference

	RFC3542
	- if DAD fails on a interface, disables IPv6 operation on the
          interface
	- don't advertise MLD report before DAD finishes

	Others
	- fixes integer overflow for valid and preferred lifetimes
	- improves timer granularity for MLD, using callout-timer.
	- reflects rtadvd's IPv6 host variable information into kernel
	  (router only)
	- adds a sysctl option to enable/disable pMTUd for multicast
          packets
	- performs NUD on PPP/GRE interface by default
	- Redirect works regardless of ip6_accept_rtadv
	- removes RFC1885-related code

From the KAME project via SUZUKI Shinsuke.
Reviewed by core.
2006-03-05 23:47:08 +00:00
rpaulo 0131d25777 bzero -> memset 2006-03-05 01:28:51 +00:00
rpaulo eb35daf5b2 Fix typos in comments.
From: the KAME project via SUZUKI Shinsuke.
2006-03-03 14:07:06 +00:00
dyoung 8bc5b41214 In nd6_llinfo_timer, don't duplicate part of nd6_llinfo_settimer's
logic, and then call nd6_llinfo_settimer.   Instead, call
nd6_llinfo_settimer immediately.

This should cause no functional change.  I've been running this
patch for months.
2006-03-02 05:11:31 +00:00
wiz 5d1e8b2745 Fix some typos. 2006-02-25 02:28:55 +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
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
rpaulo 1152ca51d5 From FreeBSD:
In ipcomp6_input(), check 'md' not 'm' after a call to m_pulldown(): 'm'
    may be a stale pointer at this point, and we're interested in whether or
    not m_pulldown() failed.

    Noticed by:     Coverity Prevent analysis tool
2006-02-14 21:43:02 +00:00
rpaulo 96aa0d0f54 Fix copy&paste problem found by James Juran
<James.Juran@baesystems.com> in freebsd-net mailing list.
bzero'ing the wrong var with a wrong sizeof is clearly not ok..
2006-02-08 13:35:48 +00:00
rpaulo 0c00fd29c5 PR 32653: mrt@notwork.org: remove 'sum += w[0]' left in previous revision. 2006-01-27 20:08:11 +00:00
rpaulo 035f84616e <netinet6/in6_pcb.h> is not needed. 2006-01-26 20:29:33 +00:00
rpaulo 7df4d41aef de-__P() 2006-01-26 18:59:18 +00:00
yamt 9178119484 ip6_input: don't embed scope id before running packet filters. 2006-01-23 23:01:40 +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
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos 7c77bfb8e4 Forward declarations for structs. 2005-12-20 19:32:58 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
elad 9702e98730 Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
2005-12-10 23:31:41 +00:00
dsl c24781af04 Pass the current process structure to in_pcbconnect() so that it can
pass it to in_pcbbind() so that can allocate a low numbered port
if setsockopt() has been used to set IP_PORTRANGE to IP_PORTRANGE_LOW.
While there, fail in_pcbconnect() if the in_pcbbind() fails - rather
than sending the request out from a port of zero.
This has been largely broken since the socket option was added in 1998.
2005-11-15 18:39:46 +00:00
bouyer e148e671d8 mif6table is used by netstat, so don't declare it static. Fix netstat -g
on Xen, whose ELF loader doesn't load local symbols in the symbol table.
2005-10-21 18:00:45 +00:00
bouyer b3b0d23068 In icmp6_redirect_output(), sip6 is initialised to point to the data area of
m0. But m0 may be freed later, so trying to use sip6 at the end of this
function is wrong. My guess is that we want to reference the data area
of m (the mbuf about to be send) instead at this point.
Fix a panic on Xen (where a data area of a mbuf may be unmapped when the
mbuf is freed), and probably potential data/pool corruption in other cases.
2005-10-19 20:42:54 +00:00
rpaulo 8f596fb842 If we recieve a PIM register message when IPv6 PIM-SM routing is
enabled avoid a crash when forwarding the packet to outgoing interfaces.

Taken from FreeBSD which obtained it from KAME.
2005-10-17 15:56:43 +00:00
christos a9a78a7c79 change bcopy to memmove since this was supposed to be an ovbcopy (from kre) 2005-09-23 21:21:58 +00:00
christos 03d7777e5c PR/25658: Steve Woodford: Default value of net.inet.ipsec.dfbit breaks PMTU
over IPsec tunnels.
I have changed the default to 2 [copy]. I've verified that this works with
all my IPSEC setups, and this change has also been discussed in tech-net.
2005-09-09 15:38:05 +00:00
rpaulo 3bb81503bf Implement net.inet6.raw6.stats sysctl.
Reviewed by Elad Efrat.
2005-08-28 21:04:09 +00:00
rpaulo 5872b8775c Implement net.inet6.pim6.stats sysctl.
Reviewed by Elad Efrat.
2005-08-28 21:03:18 +00:00
rpaulo 3995141ceb Implement net.inet6.ip6.stats sysctl.
Reviewed by Elad Efrat.
2005-08-28 21:01:53 +00:00
rpaulo 151760f5d2 Implement net.inet6.udp6.stats.
Reviewed by Elad Efrat.
2005-08-28 21:01:02 +00:00
tron d66d9a8e3b Remove write-only variable "derived" in esp_cbc_encrypt(). 2005-08-18 07:54:09 +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
yamt 0be9633956 re-implement ipv6 tx loopback checksum omission. 2005-08-10 13:08:11 +00:00
yamt f02551ec2d move {tcp,udp}_do_loopback_cksum back to tcp/udp
so that they can be referenced by ipv6.
2005-08-10 13:06:49 +00:00
yamt 40a140d919 ipv6 tx checksum offloading. reviewed by Jason Thorpe. 2005-08-10 12:58:37 +00:00
manu ae124933ca introduce ipsec_policy_t to help user programs with the change of
ipsec_set_policy, ipsec_get_policylen and ipsec_dump_policy prototypes
(using void * instead of caddr_t)
2005-08-07 08:34:32 +00:00
christos 49b19c5f09 PR/30821: SUZUKI, Shinsuike: IPsec-AH is always calculated using the same
key in AES-XCBC-MAC
2005-07-28 14:19:56 +00:00
tron d5da0b0c38 Remove unnecessary bzero() calls before calling the algorithm specific
init function.
2005-07-21 16:59:20 +00:00
gdt b0239c745e Add PR_PURGEIF flag for protocols to indicate that the protocol might
store a struct ifnet *, and define it for udp/tcp/rawip for INET and
INET6.  When deleting a struct ifnet, invoke PRU_PURGEIF on all
protocols marked with PR_PURGEIF.  Closes PR kern/29580 (mine).
2005-07-19 12:58:24 +00:00
tron 58b513c9f5 Defopt IPSEC_NAT_T. 2005-07-07 16:00:56 +00:00
christos 7642adc771 match the declarations in libipsec.h 2005-06-26 21:14:37 +00:00
mlelstv d23f1d6e16 expire cached route. Fixes PR 22792. 2005-06-26 10:39:21 +00:00
tron c86b2622dd Change the first argument of the encapsulation check function from
"const struct mbuf *" to "struct mbuf *". Without this change the
actual implementation cannot even use m_copydata() on the mbuf chain
which is broken.
2005-06-02 15:21:35 +00:00
tron 41dcb3a310 Remove type casts and lint directives which are now longer necessary
because the first argument of m_copydata() is "const struct mbuf *" now.
2005-06-02 10:54:58 +00:00
christos 2ab31527e2 - avoid shadowed variables
- sprinkle const.
2005-05-29 21:43:51 +00:00
christos 6dbf0e5b0a avoid silly static variables that even caused nesting issues, not to mention
reentrancy concerns.
2005-05-29 21:43:09 +00:00
seanb 40b52d3132 - Arithmetic error when calculating ticks to nd6_llinfo_settimer().
- Reviewed by christos.
2005-05-27 22:26:25 +00:00
manu 7c6ffb8ab4 Use NAT-T ports for AH and IPcomp too. 2005-05-20 01:25:17 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
christos 7d0b65d656 PR/30154: YAMAMOTO Takashi: tcp_close locking botch
One more so_uid -> so_uidinfo change.
2005-05-07 17:44:11 +00:00
yamt 34c3fec469 move decl of inetsw to its own header to avoid array of incomplete type.
found by gcc4.  reported by Adam Ciarcinski.
2005-04-29 10:39:09 +00:00
manu 455d55f55b Enhance IPSEC_NAT_T so that it can work with multiple machines behind the
same NAT.
2005-04-23 14:05:28 +00:00
yamt df9d0a0359 disable loopback checksum omission for udp6.
i forgot to commit this with:
http://mail-index.NetBSD.org/source-changes/2005/04/18/0023.html
2005-04-22 11:56:33 +00:00
itojun f1fe53f0ac AES counter mode uses 8byte IV, not 16 bytes.
msa@burp.tkv.asdf.org, Juha.Leppilahti@iki.fi
2005-04-22 02:43:39 +00:00
tron 6589458a53 Make sure that prefixes get purged. This fixes PR kern/21189,
PR kern/25968 and PR kern/27873.
2005-04-03 11:02:27 +00:00
atatat 5b8a6c916d Revert the change that made kern.file2 and net.*.*.pcblist into nodes
instead of structs.  It had other deleterious side-effects that are
rather nasty.  Another solution must be found.
2005-03-11 06:16:15 +00:00
atatat ca63da437a Change types of kern.file2 and net.*.*.pcblist to NODE 2005-03-10 05:43:25 +00:00
itojun b64c75b041 correct mistake reported by VANHULLEBUS Yvan 2005-03-09 14:17:13 +00:00
atatat 7c62c74d09 Add the following nodes to the sysctl tree:
net.local.stream.pcblist
	net.local.dgram.pcblist
	net.inet.tcp.pcblist
	net.inet.udp.pcblist
	net.inet.raw.pcblist
	net.inet6.tcp6.pcblist
	net.inet6.udp6.pcblist
	net.inet6.raw6.pcblist

which allow retrieval of the pcbs in use for those protocols.  The
struct involved is 32/64 bit clean and incorporates parts of struct
inpcb, struct unpcb, a bit of struct tcpcb, and two socket addresses.
2005-03-09 05:07:19 +00:00
itojun 015b260743 make ip6_getpmtu back to static 2005-02-28 09:27:07 +00:00
perry f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +00:00
manu 5c217c1a67 Add support for IPsec Network Address Translator traversal (NAT-T), as
described by RFC 3947 and 3948.
2005-02-12 12:31:07 +00:00
itojun 692c601c25 backout 1.54. heurestic code should never be used. if you experience DAD
failure, suspect your driver, not ND code.
2005-02-10 02:57:17 +00:00
drochner e1e8770b32 Give DAD a chance to succeed even if the network is "slightly broken"
(in my case it as a switch set to "monitor" mode):
If we see an NS request for the address we are just probing for, for
three times the number of DAD packets we are supposed to send (the
"ip6.dad_count" sysctl variable), assume that these are our own packets
and let DAD succeed.
The code for this was mostly there, commented out. Just needed some fixes.
The "three times" is heuristic of course.
Being here, reset the "dad_ns_tcount" variable on a successful send;
otherwise we get strange interdependencies with user-settable variables
(ever tried to set ip6.dad_count to something >15?).
2005-02-02 20:56:27 +00:00
drochner dc86361844 remove the unused in6_ifindex2scopeid()
if at all, it works with site-local addresses whose fate is uncertain
to say the least
2005-02-01 15:29:23 +00:00
drochner 5d0cfbc9bd sin6_scope_id maps to interface indices for link local addresses only!
(unlikely to be used with other scopes for now, but we should be
correct anyway)
2005-02-01 14:56:17 +00:00
matt d341be30f4 Change initialzie of domains to use link sets. Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.
2005-01-23 18:41:56 +00:00
itojun 57fd095fdf shouldn't check code field on "packet too big" icmp6 message. 2005-01-17 10:16:07 +00:00
drochner e5653b8213 remove a redundant check for ifindex2ifnet[idx] != 0 2004-12-21 11:40:12 +00:00
drochner f44d9a5791 fix ifindex argument checks for IPV6_JOIN_GROUP,
IPV6_LEAVE_GROUP and IPV6_MULTICAST_IF -
0 is always legal
2004-12-21 11:37:47 +00:00
thorpej 7994b6f95e Don't perform checksums on loopback interfaces. They can be reenabled with
the net.inet.*.do_loopback_cksum sysctl.

Approved by: groo
2004-12-15 04:25:19 +00:00
peter 396b87b8c2 Convert lo(4) to a clonable device.
This also removes the loif array and changes all code to use the new
lo0ifp pointer which points to the lo0 ifnet structure.

Approved by christos.
2004-12-04 16:10:25 +00:00
christos 694d5b6a91 We don't need to include bpfilter.h 2004-11-28 02:37:38 +00:00
itojun 5bcaef8e92 wrong paren. Patrick Latifi 2004-11-17 03:20:53 +00:00
itojun bc559f51c6 remove extra code mistakenly committed 2004-10-27 23:16:56 +00:00
itojun 70fc307de9 missing break; Emmanuel Dreyfus 2004-10-27 22:26:50 +00:00
itojun 5e3841214f no need to call defrouter_select() here any more; jinmei 2004-10-26 07:03:29 +00:00
itojun 830e5a5fbf more cleanup on onlink assumption; jinmei 2004-10-26 06:54:53 +00:00
itojun b5f3688c67 remove onlink assumption behavior (consider destination on-link if default
router list is empty) based on recent IETF ipv6 discussion (RFC2461 5.2).

fix "ndp -I delete".
2004-10-26 06:08:00 +00:00
itojun 75259d166c ip6_flow_seq is no longer available. 2004-10-18 01:43:43 +00:00
yamt 056303b850 rip6_output: redo raw_ip6.c 1.67-1.67, using m_copyback_cow. 2004-09-06 10:05:14 +00:00
manu 6e3c639957 IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
2004-09-04 23:29:44 +00:00
yamt 39dd3d0c5d run PFIL_IFADDR hooks on SIOCAIFADDR_IN6 and SIOCDIFADDR_IN6 as well.
from Peter Postma, PR/26368.
ok'ed by itojun.
2004-07-26 13:44:35 +00:00
yamt e08729e055 rip6_output: redo the previous (raw_ip6.c 1.66)
with less assumptions about alignment.
2004-07-23 09:53:10 +00:00
yamt 540e6d4640 rip6_output: make sure that the mbuf is writable
before write a checksum into it.
otherwise "ping6 -s50000" causes a panic.

ok'ed by itojun.
2004-07-22 05:26:46 +00:00
itojun 3f35f96f9a prevent mbuf leak on IPsec tunnel mode. from iij seil team 2004-07-16 01:12:02 +00:00
itojun 8da378abea - update ro_pmtu on IPsec tunnel encapsulation. ro != ro_pmtu is used as the
sign for the existence of routing header.
- fragment to 1280 on IPv6-over-IPv6 encapsulation, as ICMPv6 too big may not
  give you enough information to update pmtu cache.

from iij seil team, via kame.
2004-07-14 03:06:08 +00:00
minoura c3ed038115 Remove broken code for now: getsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY,...).
It returned EINVAL, now returns ENOPROTOOPT.
Ok'd by itojun.
2004-07-06 04:30:27 +00:00
drochner 05da173d52 abstain from typecasting the LHS of an assignment;
gcc-3.4.x doesn't like it
2004-06-24 16:49:51 +00:00
itojun b791f5f740 error could be left uninitialized when we jump into "senderr" 2004-06-24 15:01:51 +00:00
itojun 0f18c4c945 multicast data management fix - previous fix was incorrect. jinmei@kame 2004-06-16 03:17:26 +00:00
itojun ec7ac551be insufficient paren in macro def. Patrick Latifi 2004-06-16 02:36:37 +00:00
itojun 2e60f85658 use macro and make it a bit more readable. 2004-06-14 08:07:29 +00:00
itojun 4d7b9596f6 check before joining multicast group. otherwise multiple in6_multi structure
will be kept.  reported by patrick latifi
2004-06-14 07:54:45 +00:00
itojun 501233726d implement IPV6_USE_MIN_MTU sockopt. needed by bind9 + EDNS0 + big receive buffer. 2004-06-11 04:10:10 +00:00
itojun 56e182b708 there's no use to check privs on curproc in the input path. jinmei@kame 2004-06-01 03:13:22 +00:00
atatat 4de3747b89 Sysctl descriptions under net subtree (net.key not done) 2004-05-25 04:33:59 +00:00
itojun 32e4b55076 do not loop on nd6_output() when transmission fails. from kame 2004-05-19 17:45:05 +00:00
jonathan f7abb16323 Fix per-PCB IPsec policy cache for FAST_IPSEC:
The sys/netipsec policy-cache (added by Jason Thorpe as a rewrite of
the KAME per-PCB policy cache) assumes that policy-cacheable PCBs
always has a non-NULL inph_sp in the common PCB header.  So we must
do all the per-PCB policy cache calls when either (KAME) IPSEC, or
FAST_IPSEC is defined.  ``Make it so''.

We can now support non-IPsec'ed IPv6 traffic, when both
``options FAST_IPSEC'' and ``options INET6'' are configured.
2004-04-26 01:53:59 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
itojun cb0651e44a correct parameter to in6_cksum. keiichi@kame 2004-04-22 17:58:59 +00:00
matt e50668c7fa Constify protosw arrays. This can reduce the kernel .data section by
over 4K (if all the network protocols) are loaded.
2004-04-22 01:01:40 +00:00
itojun 5da9234d88 remove duplicated #include. PR 25234 2004-04-20 17:12:03 +00:00
atatat 83b193a052 Make these compile without INET. tcp_input probably needs a lot more
work...
2004-03-29 04:59:02 +00:00
christos d6939c86f1 no need for splsoftnet, because the caller does it already. 2004-03-28 08:28:50 +00:00
christos 03766c2d10 PR/23335: Christos Zoulas: Removing interfaces trashes free memory when
ipv6 is used because multicast group memberships contain dangling references
to the multicast group deleted.
2004-03-28 08:28:06 +00:00
itojun e050c8a03d do not touch m->m_pkthdr.rcvif after m becomes invalid. Patrick Latifi 2004-03-26 03:35:02 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
martti c3f78782b9 Make ip6_getpmtu() globally visible. This is needed by IPFilter 4.x. 2004-03-23 18:21:38 +00:00
itojun 3811eef49d typo 2004-03-23 05:31:54 +00:00
itojun 721292cf12 constify AH algorithm function table. suggested by robert watson 2004-03-10 03:45:04 +00:00
thorpej 2803ff0955 Use the new IPSEC_PCB_SKIP_IPSEC() to bypass a socket policy lookup
when possible.  This shaves several cycles from the output path for
non-IPsec connections, even if the policy is cached in the PCB.
2004-03-02 02:28:28 +00:00
thorpej db4fcd885b Augment the PCB cache with a "hint" that can be used to short-circuit
IPsec processing in other places.  The hint has 3 values: MAYBE, YES,
and NO.  Hints are initialized to MAYBE, and MAYBE is always used for
unconnected sockets (since the spidx may change for every packet
that is output).  For connected sockets, NONE and BYPASS policies cause
the hint to be set to NO, and all other policies to YES.

Also shuffle the PCB cache data structure, turning 3 arrays into a
single array of a struct.
2004-03-02 02:17:38 +00:00
itojun 581091043b knf 2004-03-01 22:32:35 +00:00
wiz f05e6f1a3a occured -> occurred. From Peter Postma. 2004-02-24 15:12:51 +00:00
itojun aaa4bd9a6c avoid out-of-bound memory access if len == 128.
from Ted Unangst via Colin Percival
2004-02-23 05:01:04 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
itojun d93f7028c1 we have IFT_BRIDGE already, no need for #ifdef 2004-02-11 20:51:24 +00:00
christos bcdf1b194a We don't have IFT_{PFLOG,PFSYNC} (yet). 2004-02-11 17:36:33 +00:00
itojun abd93ec67b minor KNF 2004-02-11 10:54:29 +00:00
itojun 5d3b18b4a4 KNF 2004-02-11 10:47:28 +00:00
itojun 57cbd26e09 missing bzero 2004-02-11 10:42:24 +00:00
itojun 6c8714a95e avoid ugly typecast 2004-02-11 10:37:33 +00:00
itojun e2d302c40d reduce useless variables 2004-02-10 20:57:20 +00:00
itojun c5cb8d59c0 remove unneeded #ifdef 2004-02-06 08:07:55 +00:00
tron d23ecc0dca Remove outdated prototype for ip6_getpmtu(). The function has a different
signature now and is statically declared in "ip6_output.c".
2004-02-04 10:31:27 +00:00
itojun 70e51fdcf0 strictly follow RFC2460 section 5 last paragraph
(sending rule when PMTU < 1280).  pointed out by guninski at guninski.com
2004-02-04 05:17:28 +00:00
darrenr 5915fd3874 make ip6_getpmtu() externally visible 2004-01-24 13:02:41 +00:00
itojun 092e41da38 do not lookup security policy if IPV6_FORWARDING.
avoids possible infinite ipsec encapsulation on
        ip6_input -> ip6_forward -(tunnel mode)-> ip6_output
case.  from kame
2004-01-19 05:14:58 +00:00
itojun cdaa27b23a when ipsec tunnel mode is applied, we are originating packet (instead of
forwarding).  go to ip6_output() path for fragmentation and other processing.
from kame
2004-01-16 05:12:08 +00:00
itojun 8dcc7f31aa typo.
http://sources.zabbadoz.net/freebsd/patchset/108-ipsec-spelling.diff
2004-01-13 23:02:00 +00:00
itojun 1101ef17d0 plug memory leak on failure.
http://sources.zabbadoz.net/freebsd/patchset/109-ipsec-memleak.diff
2004-01-13 23:01:08 +00:00
itojun 3ffdb9507a avoid deref-after-free.
http://sources.zabbadoz.net/freebsd/patchset/106-ipsec-pcb-discon.diff
2004-01-13 06:17:14 +00:00
wiz d46bc94200 Niels Provos kindly agreed to drop clauses 3 and 4 from the
license -- thanks.
Based on OpenBSD commit and hints by itojun.
2003-12-26 19:04:55 +00:00
lha 2b1cb68e2f Fix ICMPV6CTL_ND6_[DP]RLIST, they broke with new sysctl.
Makes ndp -r/ndp -p work again, patch from atatat
2003-12-17 18:49:38 +00:00
itojun d8ac1c6007 fix cases where pktinfo specifies outgoing interface of "0". 2003-12-10 22:35:35 +00:00
itojun aa8a6718f0 use if_indexlim (instead of if_index) and ifindex2ifnet[x] != NULL
to check if interface exists, as (1) if_index has different meaning
(2) ifindex2ifnet could become NULL when interface gets destroyed,
since when we have introduced dynamically-created interfaces.  from kame
2003-12-10 11:46:33 +00:00
itojun 561720b19b validate set/getsockopt arg more strictly. with previous code privileged
user can cause kernel crash.
2003-12-10 09:28:38 +00:00
itojun c81f32fe6c comment from niels provos;
- seed2 is necessary, but use it as "seed2 + x" not "seed2 ^ x".
- skipping number is not needed, so disable it for 16bit generator (makes
  the repetition period to 30000)
2003-12-10 05:22:18 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
keihan b8702f530b netbsd.org -> NetBSD.org
This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean".  Thanks for the patiance, and sorry for all the commits.
2003-12-04 13:57:30 +00:00
itojun 0864b4939d "seed2" was ruining non-repeating property, so remove it. discussed on tech-net 2003-11-25 18:13:55 +00:00
jonathan 995c532c33 Revert the (default) ip_id algorithm to the pre-randomid algorithm,
due to demonstrated low-period repeated IDs from the randomized IP_id
code.  Consensus is that the low-period repetition (much less than
2^15) is not suitable for general-purpose use.

Allocators of new IPv4 IDs should now call the function ip_newid().
Randomized IP_ids is now a config-time option, "options RANDOM_IP_ID".
ip_newid() can use ip_random-id()_IP_ID if and only if configured
with RANDOM_IP_ID. A sysctl knob should be  provided.

This API may be reworked in the near future to support linear ip_id
counters per (src,dst) IP-address pair.
2003-11-17 21:34:27 +00:00
itojun 3107b5dcc0 implement net.inet6.ifq 2003-11-12 15:25:19 +00:00
itojun ae3e6f6041 correct behavior when ipv6mr_interface is 0. Matthias Drochner 2003-11-06 06:10:51 +00:00
itojun 60dac07656 use hash table for in6_pcbbind(). similar to in_pcb 1.89 -> 1.90 2003-11-05 01:20:56 +00:00
briggs 07a0e27c44 Revert the change in default value of ipv6_v6only. Further discussion
on this topic is required.  It should be reintroduced and pursued in
the IETF.
2003-11-03 15:12:06 +00:00
simonb a2facef339 Remove some assigned-to but otherwise unused variables. 2003-10-30 01:43:08 +00:00
mycroft 2dde0746b6 Do a jump optimization that eliminates some uninitialized variable warnings. 2003-10-29 10:12:43 +00:00
briggs 5a770ba2d8 Toggle the default value of ip6_v6only. Also provide a sample sysctl to
retain the existing behavior.
2003-10-28 06:31:28 +00:00
christos 59f2aab1ed fix uninitialized variables 2003-10-25 08:26:14 +00:00
itojun ba71e93c60 backout previous (ENETREST special handlng) 2003-10-15 22:55:34 +00:00
itojun 90d92fe2d9 ignore ENETRESET on ADDMULTI 2003-10-15 22:16:35 +00:00
itojun 018cb094b4 ignore ENETRESET on ADDMULTI. 2003-10-15 22:15:25 +00:00
itojun a8d71f892f define struct prf_ra outside of in6_prflags, to be c++ friendly. sync w/kame 2003-10-15 01:28:28 +00:00
itojun 40e6b63c60 fix endian bug in fragment header scanning. 2003-10-14 05:33:04 +00:00