Commit Graph

66 Commits

Author SHA1 Message Date
christos 333e176687 - sprinkle const
- remove unneeded casts
- use more mem*() instead of b*() funcs.
2005-05-29 21:22:52 +00:00
perry f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +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
christos a9703830cd Fix problem in previous commit; we need to create a new sockaddr. 2004-09-30 00:14:05 +00:00
christos efff5f0097 PR/22849: Sean Boudreau: rtrequest() w/ RTM_DELETE not honouring netmask
as it does w/ RTM_ADD.
2004-09-29 21:19:33 +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
matt 7cf8938ddd ANSI-fy and some additional de-__P and constification. 2004-04-21 21:03:43 +00:00
matt e3b919c754 Constify if.c radix.c and route.c (and fix related fallout). 2004-04-21 04:17:28 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
itojun 50a545a34b remove all entries in rt timer queue on ip_mtudisc change, instead of
destroying the queue.
2002-11-12 02:10:13 +00:00
itojun 96910acf99 add an argument to rt_timer_remove_all(), to specify if we need to call
timeout routine on removal.
2002-11-12 01:37:30 +00:00
thorpej 83b3b86fd6 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-26 01:42:28 +00:00
matt 2d83d27dfa Eliminate more commons. 2002-05-12 20:40:11 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
lukem 34d65a3414 add RCSIDs 2001-11-12 23:49:33 +00:00
matt b5e785f38d Switch to using queue access macros instead of refering to the member
fields explicitly.
2001-11-05 18:02:15 +00:00
itojun 3594efccf6 on RTM_DELETE, reduce refcnt on rt->rt_parent, to avoid leaks.
from IIJ seil team
2001-10-16 02:42:36 +00:00
itojun dc1d7df811 do not initialize rmx_mtu on RTM_ADD.
on gateway change, copy rmx_mtu from gateway only under the following condition:
- current MTU is not locked
- current MTU was discovered via PMTUD

XXX if gateway has MTU == 0, current MTU is set to 0 and we are going to
rediscover PMTU again.  is it good or bad?
2001-07-26 05:47:37 +00:00
itojun efe956a93f do not copy rmx_mtu on RTM_ADD/RESOLVE. the fragment was mistakenly
introduced on 1.25, from other *bsd via kame.  from thorpej
2001-07-25 07:13:44 +00:00
itojun 866fc79bb9 validate sa_len on equal() macro. without the change we may touch the content
of a2 beyond a2->sa_len mistakelnly.  sync with kame
2001-07-20 18:52:18 +00:00
thorpej cbf41a143a bzero -> memset 2001-07-18 16:43:09 +00:00
itojun e79a9123a3 use u_quad_t for rtstat.
not sure if it really matters, but short (32K) looks way too small given
recent fat pipes connecting *BSD boxes, and our great uptime :-).
2001-02-21 05:45:11 +00:00
itojun f38fdf081e change non-intuitive function name. s/rtflushit/rtflushclone1/ 2001-01-27 11:07:59 +00:00
itojun 02adaaf197 cleanup cloned route when parent route (RTF_CLONING) goes away.
adds rt_parent to link parent from child (like NRL did, ours do refcnt
rt_refcnt properly).

bsdi rt_walkbranch would speedup the processing, but since the code will not
be visited too frequently, the current code (with rt_walktree) should be okay.
2001-01-27 10:39:33 +00:00
itojun fee00b1a78 mark cloned routes with RTF_CLONED. present it with netstat -r by "c".
let static routes overwrite cloned routes, as cloned routes can come back again
if necessary.  behavior same as freebsd/bsdi, code partially from bsdi42.
(NRL rt->rt_parent was not added)
should fix PR 11916 and maybe some other PRs with ARP behavior.

recompilation of usr.sbin/route6d is suggested.
2001-01-27 04:49:31 +00:00
itojun df9784d749 pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2 (UCB copyrighted).
have sys/net/route.c:rtrequest1(), which takes rt_addrinfo * as the argument.
pass rt_addrinfo all the way down to rtrequest, and ifa->ifa_rtrequest.
3rd arg of ifa->ifa_rtrequest is now rt_addrinfo * instead of sockaddr *
(almost noone is using it anyways).

benefit: the follwoing command now works.  previously we need two route(8)
invocations, "add" then "change".
# route add -inet6 default ::1 -ifp gif0

remove unsafe typecast in rtrequest(), from rtentry * to sockaddr *.  it was
introduced by 4.3BSD-reno and never corrected.

XXX is eon_rtrequest() change correct regarding to 3rd arg?
eon_rtrequest() and rtrequest() were incorrect since 4.3BSD-reno,
so i do not have correct answer in the source code.
someone with more clue about netiso-over-ip, please help.
2001-01-17 04:05:41 +00:00
itojun 93292b8aaa do not touch region after free 2000-12-11 07:52:48 +00:00
itojun 5eae50d991 update icmp6 too big validation. the change is necessary since pmtud is
mandatory for IPv6 (so we can't just validate by using connected pcb - we need
to allow traffic from unconnected pcb to do pmtud).
- if the traffic is validated by xx_ctlinput, allow up to "hiwat" pmtud
  route entries.
- if the traffic was not validated by xx_ctlinput, allow up to "lowat" pmtud
  route entries (there's upper limit, so bad guys cannot blow up our routing
  table).
sync with kame

XXX need to think again about default hiwat/lowat value.
XXX victim selection to help starvation case
2000-12-09 01:29:45 +00:00
augustss c1ebd1929a Kill some more register declarations. 2000-03-30 09:45:33 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
itojun d4eed1a6bf remove bogus comment 2000-03-22 16:51:03 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
itojun 8937ddef33 do not touch radix_node with RNF_ROOT on route_output(). this can
cause kernel panic (by non-root invocation of route(8)) on certain
routing table setup.
KAME PR: 217
2000-03-10 14:47:12 +00:00
thorpej 99f19b7139 Wrap a debugging printf in IFAREF_DEBUG. 2000-02-02 18:02:08 +00:00
thorpej d844a3ac41 First-draft if_detach() implementation, originally from Bill Studnemund,
although this version has been changed somewhat:
- reference counting on ifaddrs isn't as complete as Bill's original
  work was.  This is hard to get right, and we should attack one
  protocol at a time.
- This doesn't do reference counting or dynamic allocation of ifnets yet.
- This version introduces a new PRU -- PRU_PURGEADDR, which is used to
  purge an ifaddr from a protocol.  The old method Bill used didn't work
  on all protocols, and it only worked on some because it was Very Lucky.

This mostly works ... i.e. works for my USB Ethernet, except for a dangling
ifaddr reference left by the IPv6 code; have not yet tracked this down.
2000-02-01 22:52:04 +00:00
sommerfeld 7e72e96529 Fix PR7946 (neighbor discovery tries to block at interrupt level).
stack-allocate a sockaddr_storage for the temporary sockaddr rather
than putting it in an mbuf.

neighbor discovery wants to delete expired ifa's from a timeout
handler.  allowing rtinit(RTM_DELETE, ...) to run at interrupt level
allows this to work.
i think we can afford the extra ~128 bytes of stack depth ..
1999-10-09 18:55:30 +00:00
erh 622b465872 Delay clearing of RTF_UP until after deleting rt_gwroute. Otherwise, if rt_gwroute is the same as the original route it will get freed twice. It can end up the same because of unusual "route" commands (PR4561) or certain icmp redirects (PR4827). 1999-10-09 08:13:00 +00:00
matt d3448593e5 Cleanup a little kludge in mtu handling in route.c. Bring down FDDI
mtu to legal IP max but don't affect other protocols.
1999-08-21 03:46:35 +00:00
itojun 06c350054d remove reference to in6_systm.h (file itself will be removed afterwords) 1999-07-30 10:35:34 +00:00
itojun 118d2b1d4f IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.
1999-07-01 08:12:45 +00:00
thorpej f079e8d39c Simplify the rttimer code somewhat; use TAILQs instead of CIRCLEQs (we
didn't really need to traverse the queues backwards anyhow), and other
minor code simplification.
1998-12-27 18:27:48 +00:00
veego 50cc03465e Fix kern/6658 from Martin Husemann:
After booting a current kernel and receiving a few arp requests on the
network it panics (data modified on free list). The panic message is wrong,
as code inspection shows the memory pool for routing entries is intialized
twice, while the routing timer memory pool is never initialized.
1998-12-27 11:44:41 +00:00
thorpej 0a87ec1ac7 Use pools for rtentry and rttimer structures. 1998-12-22 02:27:06 +00:00
kml afd8d9361f Add call to splsoftnet() in rt_timer_timer to avoid possible race
condition in deleting timer queue (PMTU) entries.
1998-10-28 05:01:11 +00:00
thorpej 06b7eb9001 Explicitly dereference the route timer expiration function pointer. 1998-08-15 03:17:21 +00:00
jonathan 011f2bda08 defopt NS, NSIP. 1998-07-05 06:49:00 +00:00
kml 8cdafd0efb Add generic route timeout functionality; used by path MTU discovery code 1998-04-29 03:41:49 +00:00
christos 964633009c Sync with Lite2. 1997-04-02 21:17:28 +00:00