Commit Graph

1792 Commits

Author SHA1 Message Date
dyoung 6f3852fab4 Constify struct ifnet->if_sadl and every use throughout the tree.
Add if_set_sadl() that both sets the link-layer address length and
replaces the current link-layer address with a new one, and use it
throughout the tree.
2007-12-20 21:08:17 +00:00
dyoung 72fa642a86 Poison struct route->ro_rt uses in the kernel by changing the name
to _ro_rt.  Use rtcache_getrt() to access a route cache's struct
rtentry *.

Introduce struct ifnet->if_dl that always points at the interface
identifier/link-layer address.  Make code that treated the first
ifaddr on struct ifnet->if_addrlist as the interface address use
if_dl, instead.

Remove stale debugging code from net/route.c.  Move the rtflush()
code into rtcache_clear() and delete rtflush().  Delete rtalloc(),
because nothing uses it any more.

Make ND6_HINT an inline, lowercase subroutine, nd6_hint.

I've done my best to convert IP Filter, the ISO stack, and the
AppleTalk stack to rtcache_getrt().  They compile, but I have not
tested them.  I have given the changes to PF, GRE, IPv4 and IPv6
stacks a lot of exercise.
2007-12-20 19:53:29 +00:00
dyoung a31aaaf8bb Use LIST_FOREACH(). 2007-12-20 18:13:26 +00:00
dyoung c669c33b43 Move more code in gre_clone_destroy() under splnet() protection,
in order to protect against gre_input() on a destroyed gre.
2007-12-20 18:12:11 +00:00
lukem 456279df8f use __KERNEL_RCSID() 2007-12-11 12:29:11 +00:00
ad 5e0c5eae3c Unbork 2007-12-08 15:04:29 +00:00
elad 51fe5bc63c Replace usage of p_cred in kauth(9) call with kauth_cred_get().
okay yamt@.
2007-12-08 13:31:03 +00:00
dyoung 9fd5916940 Fix a serious regression: insert new ifaddrs at the end of if_addrlist,
not at the front, because the first ifaddr on the list has special
significance (grrr).
2007-12-06 02:23:42 +00:00
dyoung 7a3c43874a Add ifa_insert() and ifa_remove() that add/remove an ifaddr to/from
an interface and increase/decrease its reference count.
2007-12-06 00:23:09 +00:00
dyoung b8f324fabd Extract common code, creating a subroutine if_purgeaddrs(ifp,
family, purgeaddr) which applies function `purgeaddr' to each
address on `ifp' belonging to `family'.
2007-12-05 23:47:17 +00:00
dyoung 498e382747 Use IFADDR_FIRST(), IFADDR_NEXT(). 2007-12-05 22:56:02 +00:00
dyoung adde197943 Use IFADDR_EMPTY(). 2007-12-05 22:51:01 +00:00
dyoung 67637efccc Add IFNET_FIRST(), IFNET_NEXT(), IFADDR_FIRST(), IFADDR_NEXT(),
IFADDR_EMPTY().

Call the IF{NET,ADDR}_FOREACH() macro arguments __ifp and __ifa
instead of ifp and ifa.
2007-12-05 18:07:21 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
ad 6874e511b7 lockmgr -> mutex 2007-12-05 07:58:29 +00:00
dyoung 73b0c685df Use IFADDR_FOREACH(). 2007-12-04 10:31:14 +00:00
ad 4b293a84e1 Interrupt handling changes, in discussion since February:
- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
2007-12-03 15:33:00 +00:00
ad 57ab3d5998 Grab tty_lock in more places. Noted and tested by degroote@. 2007-11-28 21:44:11 +00:00
dyoung 453e5e8a7d Cosmetic: join two lines. 2007-11-28 02:40:21 +00:00
dyoung 42e892e3d8 Pass the mbuf type (e.g., MT_SONAME, MT_SOOPTS) as the second
argument to getsockmbuf().
2007-11-24 07:49:03 +00:00
dyoung 8fd9837dcc Fix a bunch of locking bugs ("Mutex error: lockdebug_barrier: spin
lock held"): only hold a mutex briefly at the top and bottom of
gre_ioctl().  Use splnet() to synchronize reconfiguration with
network interrupts.
2007-11-24 07:43:32 +00:00
dyoung 50906e3486 Delete state GRE_S_DOCONF, I no longer use it. 2007-11-23 22:58:54 +00:00
ad 9bf7522dd1 Call ttwakeup() with tty_lock held. 2007-11-12 14:20:40 +00:00
ad 0f8b0df960 Call ttyflush() with tty_lock held. 2007-11-10 18:29:36 +00:00
ad d37935697b Merge tty changes from the vmlocking branch. 2007-11-07 15:56:11 +00:00
ad efe07d555b Use the softint_* API. 2007-11-07 00:19:54 +00:00
dyoung 08fdf3b0de Change a few malloc(9) + memset(3) pairs to malloc(..., ...|M_ZERO). 2007-11-01 20:37:48 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
dyoung 462deb7ea8 In ifreq_setaddr(), use the right buffer sizes for compat v.
non-compat commands.
2007-10-11 20:47:27 +00:00
dyoung c54777285d Delete dead code. 2007-10-10 22:14:38 +00:00
ad 46ed8f7d77 Use the softint API. 2007-10-08 16:18:02 +00:00
ad 451aacda90 Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
2007-10-08 15:12:05 +00:00
dyoung 1dc4f12dca Change some ints to bools. 2007-10-06 03:35:14 +00:00
dyoung 2c54ff5913 Good-bye, kernel thread, we don't need you any longer. 2007-10-06 03:30:25 +00:00
martin 38e2704180 Add missing include for definition of struct evcnt. 2007-10-05 08:05:37 +00:00
dyoung 32fddb3293 Cosmetic: KNF. Litter the code with fewer #if NBPFILTER > 0. 2007-10-05 05:15:58 +00:00
dyoung 944a024048 Remove a lot of dead code. Move gre_do_send() code into greintr(),
and move gre_do_recv() code into gre_receive().  Get rid of some
unused event counters.
2007-10-05 04:55:10 +00:00
dyoung 60149b1ce8 Work in progress: use a raw socket for GRE in IP encapsulation
instead of adding/subtracting our own IPv4 header.

There are many benefits:  gre(4) needn't grok the outer encapsulation
header any longer, so this simplifies the gre(4) code.  The IP
stack needn't grok GRE, so it is simplified, too.  gre(4) will
benefit from optimizations in the socket code.  Eventually, gre(4)
will gain an IPv6 encapsulation with very few new lines of code.

There is a small performance loss.  A 133 MHz, 486-class AMD Elan
sinks/sources a TCP stream over GRE with about 93% the throughput
of the old code.  TCP throughput on a 266 MHz, 586-class AMD Geode
is about 96% the throughput of the old code.  A 175-MHz ADM5120
(MIPS) only sinks a TCP stream over GRE at about 90% of the old
code; I am still investigating that.

I produced stripped-down versions of sosend() and soreceive() for
gre(4) to use.  They are guaranteed not to block, so they can be
called from a software interrupt and from a socket upcall,
respectively.

A kernel thread is no longer necessary for socket transmit/receive,
but I didn't get around to removing it, yet.

Thanks to Matt Thomas for suggesting the use of stripped-down socket
code and software interrupts, and to Andrew Doran for advice and
answers concerning software interrupts, threads, and performance.
2007-10-05 03:28:12 +00:00
scw 851609250e s/NPBFILTER/NBPFILTER/
Compile-tested only.
2007-09-29 18:44:51 +00:00
dyoung 43390716bc Constify sockaddr argument to ether_multiaddr(). Change struct
ifreq * arguments to ether_addmulti() and ether_delmulti() to const
struct sockaddr *, since ether_{add,del}multi() only ever read the
sockaddr ifreq member, ifr_addr.  Update uses in carp(4) and in
vlan(4).
2007-09-19 05:25:33 +00:00
dyoung 306b542543 Save some lines of code, use sockaddr_dup(), sockaddr_free(),
sockaddr_cmp().  No functional change intended.

Bug fix: pass M_WAITOK, not M_WAIT, to malloc(9).
2007-09-16 18:09:51 +00:00
dyoung 2d2c83df85 KNF: use tabs instead of spaces. 2007-09-16 02:23:29 +00:00
dyoung b0dad91e16 Use sockaddr_dup() and sockaddr_free(). 2007-09-16 02:19:44 +00:00
dyoung d34212ed04 Move the LIST_HEAD() definition below etherip_softc's definition.
Somehow having it above interfered with ctags(1) producing a tag
for etherip_softc.

Remove the sole member of the union etherip_softc.sc_scr; call it
sc_ro.  Delete the union.  Delete the #define for sc_ro.  The union
was a holdover from days before the route caches were unified.
2007-09-16 02:15:54 +00:00
gdt 2f4541505a Add a define for the ifru_space union member.
Copy the entire sockaddr to the buffer to be written to user space,
according to its length, not just the part that fits in struct
sockaddr.

This fixes the 'bad MAC address' problem in dhclient.
2007-09-13 18:54:57 +00:00
gdt aebe6f5793 Fix bug in SIOCGIFCONF where the wrong length was calculated for
sockaddrs bigger than struct sockaddr.  Tightly bind decrementing
available space and using it, avoiding incorrect accounting in an
error case.  Document invariants.  Document calling convention for
SIOCGIFCONF.  Simplify by removing code to handle sockaddrs that don't
fit in struct ifreq; with sockaddr_storage this can no longer occur.
Add several KASSERTs.

This commit resolves the problem with racoon failing to list
interfaces.

Proposed on tech-net@ with no objections.
2007-09-11 19:31:22 +00:00
cube c725329722 Remove 3rd clause and my name from all the licences which were only in my
name.
2007-09-10 10:35:51 +00:00
martin 90ef42f1bb Print the access concentrator name when a session is established.
This seems to be usefull to identify peers with known broken firmware
(e.g. that can only do IPv4 reliably).
2007-09-09 09:58:55 +00:00
dyoung 7cf94b5474 Rename gre_socreate1() -> gre_socreate(). 2007-09-08 04:34:02 +00:00
dyoung 88399b6877 We cannot sleep in a software interrupt, so do not sockaddr_dl_alloc(...,
M_WAITOK).  Instead, sockaddr_dl_init() a sockaddr_dl on the stack.
2007-09-02 19:42:21 +00:00