Commit Graph

245 Commits

Author SHA1 Message Date
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej
7cc07e11dc TRUE -> true, FALSE -> false 2007-02-22 06:16:03 +00:00
hubertf
d823788fde Make TSEL() return char* instead of void*
Doing this as remote hands for dyoung@.
This gets ifconfig compiled again.
2007-02-18 00:56:53 +00:00
dyoung
5493f188c7 KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous
parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.
2007-02-17 22:34:07 +00:00
dyoung
2c0b8d1468 KNF: compare pointers with NULL. Remove extraneous parentheses
from return statements.

bcopy -> memcpy
bzero -> memset
bcmp -> memcmp
2007-02-17 05:01:47 +00:00
dyoung
730acb6a6a Cosmetic: don't open-code TAILQ_FOREACH. 2007-02-17 04:59:50 +00:00
dyoung
7b077b0223 Cosmetic: whitespace nits. Shorten a staircase. Remove unnecessary
parentheses and casts.  Compare pointers with NULL instead of 0.
bzero -> memset.
2007-01-29 06:55:41 +00:00
hubertf
142c2a33ba Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
2007-01-24 13:08:11 +00:00
cbiere
b64481fed4 * Fixed use of fgetc() in getch().
* Check for non-ASCII characters in getch() because the rest of the code
   doesn't expect such.
 * Removed use of -traditional and constructs which relied on this.
 * Use raise(SIGFPE) in dump() instead of attempting a division-by-zero.
 * Fixed compiler warnings regarding missing prototypes or unused
   parameters.
2007-01-18 12:43:38 +00:00
cube
bff757a269 Remove netiso/if_cons.c. It depends on x25 stuff that was removed a while
ago.

Obsolete option "TPCONS".
2007-01-11 00:00:41 +00:00
elad
b2eb9a5389 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 19:07:03 +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
is
74a405e314 Avoid overlapping struct assignment for FDDI. Should fix netiso like in the
Ethernet case.
2006-12-10 12:34:42 +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
dyoung
857f0ccbed KNF. 2006-12-06 00:50:34 +00:00
dyoung
d7a8741d84 KNF. 2006-12-06 00:39:56 +00:00
is
f70b506cfb use m_adj instead of explicit pointer manipulation 2006-12-05 16:36:14 +00:00
is
a1f6d5cc3f explain magic constant 2006-12-05 16:33:56 +00:00
is
4fe0853ea1 Typo in comment. 2006-12-04 15:14:45 +00:00
dyoung
a291eaf06c KNF. 2006-12-04 02:53:17 +00:00
dyoung
c8485f3e10 Remove superfluous parentheses. 2006-12-03 21:56:30 +00:00
is
07e04d08c3 Remove an overlapping struct copy from ether_input, which caused address
corruption for incoming netiso packets with recent (at least NetBSD-3 and
later) compilers. This is done in a way that the copy is avoided totally.
Code path tested with tcp+udp/ipv4+ipv6, arp and ISO cltp/clnp.
Visually ok'd by Christos@.
2006-12-01 18:43:40 +00:00
is
9f6b10c456 Check parameters to avoid potential panic root user.
Patch checked by chopps@.
2006-11-24 12:47:43 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
elad
47dc01744a Kill some KAUTH_GENERIC_ISSUSER. 2006-10-25 23:40:57 +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
dogcow
f2d329dca0 remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP. 2006-09-07 02:40:31 +00:00
christos
2c3642e00f use c99 initializers 2006-09-03 06:53:08 +00:00
christos
47be5467d6 Fix initializers 2006-08-30 19:20:48 +00:00
christos
45c427c7fb fix initializers 2006-08-30 15:32:23 +00:00
christos
976bcd112b add missing initializers 2006-08-30 01:08:43 +00:00
christos
5ea9cdc590 fix incomplete initializers 2006-08-29 23:40:14 +00:00
matt
2c65982795 Make sure any inclusion of <netccitt/*.h> is protected by opt_ccitt.h and
CCITT.
2006-08-25 19:46:04 +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
ad
f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +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
elad
874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
mrg
82b8b3f44f #include <sys/protosw.h> for isosw[] extern. 2006-05-11 01:14:55 +00:00
christos
5cd6dae082 Coverity CID 1157: Move deref after check. 2006-04-15 00:03:56 +00:00
christos
9202171a37 Coverity CID 1158: Add a KASSERT to appease coverity. 2006-04-15 00:01:50 +00:00
christos
4364818c59 Coverity CID 1159: Prevent NULL deref. 2006-04-14 23:56:20 +00:00
christos
2b7ed695ce Coverity CID 860: Prevent NULL deref. 2006-04-14 23:53:53 +00:00
christos
5994b27932 compile with no options INET 2005-12-28 09:18:46 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
elad
0db637f40e Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
2005-12-11 00:01:36 +00:00
dsl
d12c019f70 For some peverse reason the ISO code has to have the same template for
it's iso_pcbconnect() as the IP stack.
2005-11-16 20:44:19 +00:00
christos
3ebd13b60c - use memcpy instead of bcopy.
- constify.
2005-05-31 01:37:06 +00:00
christos
ee1e2f8883 deal with const cast-aways. 2005-05-30 22:14:52 +00:00
christos
d276a994d2 - sprinkle const
- remove unnecessary casts
- change some b*() to mem*()
2005-05-29 21:27:45 +00:00