Commit Graph

2050 Commits

Author SHA1 Message Date
cegger 9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
christos c8164f5d15 RTAX_GENMASK and RTAX_AUTHOR could cause kernel memory corruption because
info struct members could be pointing to free'd memory. Fix from dyoung.
XXX: Pullup to 5.0
2008-12-12 22:34:58 +00:00
cube 9f95a5d658 Fix handling of ppp compressor modules, from Andrew Doran's input.
- ref count each compressor
 - allow {un,}registration of several modules at once
 - une RUN_ONCE to make sure the mutex is initialised, because
   unfortunately built-in (and bootloader-loaded) modules init functions
   are run before pseudo-devices attach (reported by Nick Hudson).
2008-11-29 23:15:20 +00:00
pooka c6e7028d1c Make dom_maxrtkey of inet/inet6domain the size of the ip_encap pack
structures.  This is far from optimal, but gets rid of iffy
#ifdef INET in radix.c.  The radix bonsai still needs lots of love
before loading domains dynamically is possible...
2008-11-25 18:28:05 +00:00
cube c12e613f44 Rework the way PPP compmressors are handled and allow them to be
automatically loaded when needed.
2008-11-25 02:40:36 +00:00
dyoung a38f380ef4 Update comment for last. 2008-11-20 21:55:15 +00:00
dyoung 67852fcbc2 In the new ifioctl order, tun_ioctl() can call itself through
ifioctl_common().  Since the first tun_ioctl() call already holds
the simplelock, the second tun_ioctl() call will wait forever to
acquire it: deadlock.

To fix this, wait to acquire the lock until tuninit().
2008-11-20 21:54:42 +00:00
martin e6d2ca8863 Pass SIOCAIFADDR to ifioctl_common, fixes PR kern/39900. 2008-11-13 22:22:24 +00:00
ad 0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
dyoung de87fe677d *** Summary ***
When a link-layer address changes (e.g., ifconfig ex0 link
02🇩🇪ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.
2008-11-07 00:20:01 +00:00
hans 844d9a4743 call pmf_device_deregister in detach functions. requested by jmcneill. 2008-11-03 00:52:07 +00:00
hans 32ffdb16fe Add NULL pmf handlers. OK by cube. 2008-11-02 14:46:55 +00:00
christos 522f18932f Fold long lines created by the previous commit. No functional change. 2008-10-28 11:41:23 +00:00
dyoung 5cf05f3b26 Stop the "Sleazy use of local variables throughout file", replace
'dst' with 'info.rti_info[RTAX_DST]', et cetera.
2008-10-28 02:03:06 +00:00
christos e7901a5f9a Fix handling of RTAX_GENMASK. Since this has been removed, userland programs
that set it, ended up causing the kernel to reference random garbage. Ignore
it for compatibility, but add a DIAGNOSTIC message so that userland programs
that set it can be fixed. The only one so far is pppd. Hi dyoung!
2008-10-25 17:34:00 +00:00
dyoung 398adeb7b9 Do not gratuitously cast to void *. 2008-10-24 21:46:09 +00:00
dyoung beeacc82f5 Fix the device_t/softc split: introduce etherip_softc.sc_dev and
initialize it.  Use sc_dev in etherip_clone_destroy() instead of
casting the softc to struct device *.

Remove gratuitous casts.  Use device_t and cfdata_t throughout.
2008-10-24 21:41:04 +00:00
dyoung d94f902d6b Do not gratuitously cast to void *. Remove excess parenthesization.
Do not "test truth" of pointers, but compare with NULL.

No functional change intended.
2008-10-24 21:38:18 +00:00
dyoung 71367efb93 Undo a change in my last commit that was not suppsoed to be committed. 2008-10-24 17:14:29 +00:00
dyoung cf969cfa5a Constify the rt_addrinfo argument to the ifa_rtrequest member
function of struct ifaddr.
2008-10-24 17:07:33 +00:00
scw edeb3e1fec Reduce the scope of PPPoE session IDs from globally unique to per-interface
unique. Some brands of ADSL modems pick a hard-coded session ID which
would otherwise make it impossible to use two of them in the same system
simultaneously.
2008-10-15 20:08:33 +00:00
pooka 2002727b2c Give maximum level of network softinterrupts a symbolic constant
(which happened to get bumbed from 32 to 33 (AF_MAX) now).
2008-10-14 17:15:20 +00:00
bouyer 88948cf5d2 Make SIOCSIFCAP work again on vlan interfaces: first check that the
capability is enabled on parent, then call ifioctl_common().
2008-10-11 17:19:41 +00:00
pooka 308b8af180 POOL_INIT -> pool_init 2008-10-04 00:09:34 +00:00
pooka 224186c110 Fix pointer size typo - affects only debug output.
Henning Petersen, PR lib/39689
2008-10-03 18:33:06 +00:00
mhitch 70a12d51ab Add support for SerDes controllers; from the OpenBSD driver. Tested on a
Dell Blade server by me, and an HP Blade server by Havard.
2008-09-09 20:12:18 +00:00
gmcgarry 0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
christos 44c100dd00 - more void * removal
- bcopy -> memcpy
- memmove -> memcpy
- explicitly initialize size to 0 on memory allocation failure.
2008-08-28 19:33:24 +00:00
dyoung 734473836e Do not cast to void * unnecessarily. 2008-08-28 18:43:58 +00:00
rmind 67d6ac0a69 tap_attach/tap_detach: selinit/seldestroy the selinfo structure.
Should fix PR/39237.
2008-08-26 11:06:59 +00:00
martin b0f7c9ec03 Backout previous/restore initial fix for PR kern/39280.
The later changes were only cosmetic, cause problems in IPv6-only-
connections (reported by Wolfgang Solfrank in private mail), as well
as reintroducing the original bug again.
2008-08-22 12:13:18 +00:00
joerg 216f1c75dc As the scratch memory is only ever copied to or from A and X, make it
unsigned as well.
2008-08-20 13:01:54 +00:00
martin 7c66311782 Simplify auth failure reconnect a bit and make it more similar to the
session establishment timeout handling.
2008-08-19 22:03:05 +00:00
simonb e50c5ea246 Fix a tyop in a comment and a few #define<tab> nits while here. 2008-08-19 10:41:10 +00:00
martin e9e3618d99 When upper layer asks us to re-establish a connection, don't do so
synchronously, but insert a (varying) delay. Before we have only been
decoupled from the peer via network latency - now we introduce some
explicit delay. This, at least, creates batter serialized debug output.

However, if we have to reconnect because of an authentication failure,
the peer may have just been unable to access it's radius server. (I have
a setup where this seems to happen every now and then, depending on time
of day.) Backoff reconnect in this cases seriously longer - this is better
than hitting the max-auth-failure limit within a few seconds.
2008-08-18 21:43:49 +00:00
martin 11933dbf25 Test and handle memory allocation failure for the access concentrator
cookie.
2008-08-18 20:43:50 +00:00
martin 3c5d438020 Apply patch from Yasuoka Masahiko in PR kern/39321: fix length check
when parsing pppoe discovery phase packets.
2008-08-08 14:31:00 +00:00
plunky fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
degroote 64411951db We have a dummy entry for IPV6CP even if the non-INET6 case.
So always reference IDX_IPV6CP
Fix build of if_spppsubr.c if INET6 is not defined.
2008-08-05 23:56:31 +00:00
christos fd2004ecfd keep the loop, but arrange IDX_COUNT to be correct. 2008-08-04 12:03:14 +00:00
martin 2cfed21969 PR kern/39280: Uninitialized callout stopped in if_spppsubr layer
in kernels without options INET6.
2008-08-04 10:17:33 +00:00
matt cc99e2f48f Remove the pcb from the rawcb list before sofree'ing it.
Don't reacquire softnet_lock until after we've freed the pcb.
2008-08-04 06:19:35 +00:00
dsl 34519fcf41 Move the body of VLAN_INPUT_TAG() into a static inline function.
(Maybe it shouldn't even be inline - but I'd have to work out where to put it).
VLAN_INPUT_TAG() now calls vlan_input_tag() and does '_errcase' when it fails.
In reality the callers should all be changed, _errcase is ALWAYS continue,
which used to 'continue' (ie break) the do .. while (0) loop - not the
intended action!
Found by ramming all the kernel sources through a modified lint and grepping
for a specific error.
While here enclose the body of VLAN_OUTPUT_TAG() in ().
2008-07-25 20:04:50 +00:00
christos 0119da7858 PR/39203: Paul Ripke: PPPoE issues with broken MTU/MRU implementations
Allow larger frames for systems that don't negotiate MTU/MRU properly.
2008-07-25 15:10:25 +00:00
dyoung 7e7bddae2b Fix this another way: add the missing case statement. 2008-07-23 06:34:31 +00:00
gmcgarry 1d92605168 Back out rev 1.163 which broke the logic for SIOCSIFFLAGS. PR#38976. 2008-07-23 05:41:47 +00:00
cegger 5a5486f956 make this compile again 2008-07-10 05:15:32 +00:00
joerg 02aa18819c - device/softc split
- remove redundant ;
2008-07-09 13:18:41 +00:00
ad a00bd89dab Replace references to getsock/getvnode. 2008-06-24 11:18:14 +00:00
gmcgarry ccd9038096 ioctl commands are unsigned long. 2008-06-24 10:32:14 +00:00
dyoung 06f20fb7d3 Cosmetic: use LIST_FOREACH(). Join lines. 2008-06-23 03:13:12 +00:00
dyoung c3da8a28e7 Cosmetic: use TAILQ_FOREACH(). Join lines. 2008-06-23 00:56:08 +00:00
yamt fff57c5525 merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@.  requested by core@
2008-06-18 09:06:25 +00:00
cube addeaf5d06 Fix previous: a well hidden assignment was lost. 2008-06-15 20:36:55 +00:00
christos 4f8bb168f6 that should read if_alloc. 2008-06-15 18:40:55 +00:00
christos bc168f2766 - add if_alloc (ours just mallocs), and if_initname and use them (from FreeBSD)
- kill memsets where M_ZERO can be used.
2008-06-15 16:37:21 +00:00
christos 34c1ed7571 remove unnecessary casts. 2008-06-15 16:35:35 +00:00
christos ab4f03ff74 - Add more definitions from FreeBSD
- Add ifmedia_removeall from FreeBSD
2008-06-15 16:33:58 +00:00
cegger fc8fd752ef device_private(device_lookup()) -> device_lookup_private()
ok cube@
2008-06-10 22:53:08 +00:00
dyoung 6190990146 Destroy condition variable sc_fp_condvar. 2008-06-02 23:07:13 +00:00
christos 5d9f99db06 Don't obliterate the whole message, preserve the data we have just written
and only zero out the rest.
2008-06-01 22:05:47 +00:00
christos 56fe2d1f4d PR/38791: J.T. Conklin: routing socket event header not cleared 2008-05-29 17:53:01 +00:00
dyoung 7b1d20d162 Delete local variable 'sockets', whose value is never used. Reported
by J.T. Conklin.
2008-05-29 17:26:56 +00:00
mrg c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
dyoung d4ff34dc53 In tap_clone_destroy(), don't treat a pointer to the tap(4) softc
like it is a device_t.

In tap_clone_creator(), set cf_fstate to FSTATE_FOUND instead of
_NOTFOUND to avoid a panic in config_detach() on a DIAGNOSTIC
kernel.  XXX I'm not sure that that is the right fix.

These changes should put a stop to the crash described in kern/38759.
2008-05-28 06:28:12 +00:00
ad 5e4b324300 Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
2008-05-25 19:22:21 +00:00
dholland b152b21d9a fix typo 2008-05-25 01:59:55 +00:00
christos 45c4cacf02 Coverity CID 5013: Add diagnostic test for bad cmd parameter. 2008-05-24 18:51:41 +00:00
dyoung 89429568e1 Add ETHER_IS_LOCAL(). Tests for "local" ethernet addresses. 2008-05-22 01:15:33 +00:00
ad 6b51302cb8 Acquire kernel_lock in tap's fileops. 2008-05-21 13:56:15 +00:00
ad 323763b5d6 Acquire kernel_lock in the bpf fileops. 2008-05-21 13:48:52 +00:00
yamt 6ddc56271b agr_ioctl_filter: comment the intention. 2008-05-19 02:53:47 +00:00
dyoung ab6934acf9 Note both my contribution and NSF funding. 2008-05-15 04:03:53 +00:00
dyoung 9fa4982002 Get rid of gre_sosend()'s lwp argument. 2008-05-15 01:30:48 +00:00
dyoung e6c098fa6e rtinit() should pass RTM_ADD to ifa->ifa_rtrequest instead of cmd,
after all.
2008-05-13 20:49:33 +00:00
dyoung e78c6441d1 Cosmetic; reduce excessive parenthesization. 2008-05-13 20:40:33 +00:00
dyoung 9efe814c6c In rtinit(), when cmd == RTM_ADD, pass cmd instead of RTM_ADD to
ifa->ifa_rtrequest(), in preparation for handling rtinit(RTM_CHANGE)
in the RTM_ADD branch.
2008-05-13 20:21:09 +00:00
dyoung 4dbd129d42 Simplify the RT_DPRINTF() calls. 2008-05-13 20:18:11 +00:00
dyoung 2d716f631f Replace a call to rtrequest() with single dst, mask, gateway
arguments, with a call to rtrequest1() with the rt_addrinfo those
single arguments come from.  No functional change intended.
2008-05-13 20:16:30 +00:00
dyoung 2f604e903b Let us call ioctl(SIOC[ADG]LIFADDR) with a link-layer address on
an AF_LINK socket, only, to be consistent with SIOC[ADG]LIFADDR
behavior on AF_INET and AF_INET6 sockets.  Let us create AF_LINK
sockets for this purpose.  Note that most operations on AF_LINK
sockets are not implemented.
2008-05-13 18:09:22 +00:00
dyoung 6f1527c315 Delete unreachable SIOCSIFADDR/AF_LINK case. 2008-05-13 17:58:52 +00:00
dyoung 4dd5ca7947 Add kernel support for adding/removing link-layer addresses using
SIOCALIFADDR AND SIOCDLIFADDR, respectively.  Corresponding
ifconfig(8) changes are coming soon.
2008-05-11 23:48:07 +00:00
dyoung 9610e6f70b Bzero, Bcmp, and Bcopy are not used any more, so delete them. 2008-05-11 20:22:38 +00:00
dyoung b9b961f930 Use memset, memmove, and memcmp instead of Bzero, Bcopy, and Bcmp,
respectively.
2008-05-11 20:14:41 +00:00
dyoung c83464af65 Where applicable, s/0/NULL/, s/Bcmp/memcmp/. Remove a gratuitous
cast from a call to nd6_storelladdr().
2008-05-11 20:13:30 +00:00
dyoung 5198e29b4c Make gre(4) work in the New File Descriptor / Socket Locking Order.
Move the function+line printing into GRE_DPRINTF().

Retire gre_closef().  Retire gre_join().  Constify gre_reconf(),
and don't pass it an LWP any longer.

Make this work in the new file descriptor regime.  Add a kernel
thread per gre(4) instance whose purpose is to install the socket
into proc0's file descriptor table.  Add gre_fp_send() and
gre_fp_recv() for passing file_t pointers to proc0.

Fix locking:  don't solock() in the socket upcall, where it is
already held.  Do solock() before calling soconnect().

Simplify reconfiguration.

Update a comment that mentions finding a less specific route, since
we don't do that any more.
2008-05-09 20:14:07 +00:00
rumble 7e3d192596 Nix a tautological return introduced in 1.129. 2008-05-09 06:08:19 +00:00
ad 2bbb14eaa4 Back out previous. It broke the build. 2008-05-05 13:41:29 +00:00
ad b407147f14 Move zlib out of net/ and into kern/. It would probably be better to use
the reachover Makefiles and libz, but this is already here and it works.
2008-05-04 23:07:09 +00:00
ad 9f4cef7b1f Don't install sys/net/zlib.h. 2008-05-04 22:58:52 +00:00
martin 592397db3f Move to standard TNF 2 clause license 2008-05-04 12:59:38 +00:00
thorpej b129a80c20 Simplify the interface to netstat_sysctl() and allocate space for
the collated counters using kmem_alloc().

PR kern/38577
2008-05-04 07:22:14 +00:00
ad 971df547a1 kern/38502 ifconfig wi0 hangs
Don't acquire the socket lock for PRU_CONTROL.
2008-04-29 18:42:26 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
yamt ee319e086d netstat_sysctl: set sysctl_size correctly. (fix netstat -s garbage output) 2008-04-26 08:17:01 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
martin f9b83801e8 Make it compile if !COMPAT_OSOCK 2008-04-24 13:30:52 +00:00
ad 15e29e981b Merge the socket locking patch:
- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
2008-04-24 11:38:36 +00:00
thorpej 34908fe541 Add subroutines to support collating per-cpu-gathered network statistics. 2008-04-23 05:21:17 +00:00
scw 9d52faae48 Pull in a couple of fixes from FreeBSD, the first of which addresses a
failure of wpa_supplicant(8) to re-key promptly, as reported in
http://mail-index.netbsd.org/tech-net/2008/04/18/msg000459.html

- Make bpf's read timeout work more correctly with select/poll.

- A fix for catchpacket() which delays calling bpf_wakeup() until
  the state has been updated.
2008-04-20 15:27:10 +00:00
thorpej 881a947288 Make ARP stats per-cpu. 2008-04-15 15:17:54 +00:00
thorpej 0dd41b37de Make ip6 and icmp6 stats per-cpu. 2008-04-15 03:57:04 +00:00
cegger 856327cd56 make this build with BRIDGE_IPF and PFIL_HOOKS options 2008-04-12 09:26:45 +00:00
thorpej 7ff8d08aae Make IP, TCP, UDP, and ICMP statistics per-CPU. The stats are collated
when the user requests them via sysctl.
2008-04-12 05:58:22 +00:00
dyoung 18f5f53751 Add some assertions that will catch any exception to
ro->ro_sa == NULL implies ro->_ro_rt == NULL.
2008-04-10 18:12:02 +00:00
thorpej 3f466bce48 Change IPv6 stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old ip6stat structure; old netstat
binaries will continue to work properly.
2008-04-08 23:37:43 +00:00
thorpej 88d65e9212 Change IP stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old ipstat structure; old netstat
binaries will continue to work properly.
2008-04-07 06:31:27 +00:00
cegger cc658c528f use aprint_*_dev and device_xname 2008-04-05 13:49:36 +00:00
dyoung cdb2193bda Improve error handling. gre(4) is still broken, but it does not
any longer cause a page fault trap.
2008-04-03 21:40:59 +00:00
dyoung b674c86ad6 Fix one of two bugs introduced by the descriptor handling changes
(rev 1.125): correct the check for fd_getsock() failure in
gre_socreate().

The second bug is more complicated to fix.  Since rev 1.125,
gre_reconf() is using the file descriptor table of the current
process instead of the process 0's (the kernel's).
2008-04-03 07:19:32 +00:00
dyoung 0228252053 Cosmetic: use curlwp everywhere that it is appropriate, instead of
using a temporary variable.  Remove superflous curly braces.  Move
an assignment that shuts up a "variable may be used uninitialized"
warning.
2008-04-03 07:12:16 +00:00
yamt c585603ac5 route_intr: fill a correct member of sockproto. (sp_family -> sp_protocol) 2008-03-29 13:00:43 +00:00
ad be04ac4896 Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.
2008-03-27 19:06:51 +00:00
ad 9591013005 Defer processing of routing messages to a soft interrupt. These can be
generated at IPL_VM and it's not safe to call directly into the socket
layer at that level. Reviewed by matt@.
2008-03-26 14:53:14 +00:00
christos f071da976a - put const back, no reason to modify the prototype.
1. Please don't cast function pointers to (void *), use the full function
   prototype cast; this is for archs where a function pointer is not a regular
   pointer.
2. Compare pointers to NULL not 0.
2008-03-26 02:21:52 +00:00
yamt 9a4b7dd279 merge yamt-lazymbuf branch. 2008-03-24 12:24:37 +00:00
yamt 9f194df082 agrport_monitor: map IFM_NONE to IFM_NONE|IFM_ETHER and add a comment. 2008-03-24 09:14:52 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
rtr 6797804c6b whitespace '\t' -> ' ' 2008-03-15 11:45:18 +00:00
matt 45e0220f34 Make sure M_PROMISC isn't already set, before we need to see if we are going
to see if we need to set M_PROMISC.
Assume the interface is not CARP'ed.
2008-03-15 05:07:34 +00:00
dyoung 84f6ead420 Make some cosmetic changes:
Use fewer 'error = ...; break;' statements and more 'return
        ...;'

        Make the SIOCSIFFLAGS case more clear by using a switch
        statement instead of an if-else if-else chain.

        Shorten a staircase, and remove two unnecessary curly
        braces.
2008-03-12 18:22:24 +00:00
cube 44f2cef6db Split device_t/softc, and other related cosmetic changes. 2008-03-04 13:25:05 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
dyoung 8a7761f76c Cosmetic: shorten staircases. Join some lines. 2008-02-29 21:23:55 +00:00
matt eefce21cf2 Revert change of char to int8_t. 2008-02-20 17:18:11 +00:00
matt 2b028087f5 s/u_\(int[0-9]*_t\)/u\1/g
(change u_int*_t to uint*_t)
2008-02-20 17:05:52 +00:00
skrll 5bdccff36c CARP is Common *Address* Redundancy Protocol 2008-02-13 09:25:24 +00:00
dyoung df7679436b #include <sys/evcnt.h> for event counters. 2008-02-12 00:53:06 +00:00
dyoung b1480edbc5 Do not needlessly #include <sys/device.h>. 2008-02-11 22:32:48 +00:00
simonb 93469128b0 Don't look for <stdbool.h> if compiling _STANDALONE as well. 2008-02-11 04:47:21 +00:00
martin 035ac59527 Make it compile w/o INET6 2008-02-07 08:48:16 +00:00
xtraeme 4f2a32a138 Remove neticp (network info commpage) stuff that dyoung added
accidentally to make this build again.
2008-02-07 04:44:21 +00:00
dyoung 2ccede0a9c Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs.  This will ease extending the kernel and sharing of code
between drivers.

First steps:  Make the signature of ifioctl_common() match struct
ifinet->if_ioctl.  Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
2008-02-07 01:21:52 +00:00
dyoung d8e12ce795 Fix more fall-out from extracting ifioctl_common(): don't return
ENETRESET from ifioctl().
2008-01-23 16:51:19 +00:00
dyoung aa385448f5 Functional: return ENTRESET from ifioctl_common(), if SIOCSIFCAP
changed anything.

Cosmetic: shorten staircase.
2008-01-22 22:26:30 +00:00
dyoung 94e4ecb4ba Add missing break statement. 2008-01-22 22:09:59 +00:00
dyoung 81e0f3dc3d Take two steps toward adding and deleting link-layer addresses.
1 Extract subroutine if_dl_create() from if_alloc_sadl().
  if_dl_create() allocates a link-layer ifaddr.

2 Extract subroutine ifioctl_common() from ifioctl().  ifioctl_common()
  will be the basis for an ifnet "superclass" whose functions
  drivers may inherit.  Very simple drivers may set ifnet->if_ioctl
  = ifioctl_common.  More sophisticated drivers will set ifnet->if_ioctl
  = driver_ioctl.  driver_ioctl() will call ifioctl_common() to
  re-use the common code.
2008-01-22 16:25:15 +00:00
dyoung af289dd714 struct route is part of the kernel ABI (!!!), so move it back
outside of #ifdef _KERNEL.  #include stdbool.h if !_KERNEL.
2008-01-21 20:25:33 +00:00
dyoung 58eb3d1bbb Move struct route inside of #ifdef _KERNEL to protect userland from
it.
2008-01-21 20:04:37 +00:00
dyoung 14e6ca4ee4 In rtflushall(), do not clear a route cache by removing its rtentry
reference, but mark the cache 'invalid'.  Let the next user of the
route cache check to whether or not the cache is valid, and update
the rtentry reference if necessary.  In this way, avoid hairy
splnet()/splx() protection of route caches, which I never did trust.
2008-01-21 09:11:24 +00:00
dyoung ebc5b3612c Use C99 array initializers for bridge_control_table[]. 2008-01-19 23:17:47 +00:00
dyoung d338f6b0ba Add default handling of SIOCSIFMEDIA/SIOCGIFMEDIA. 2008-01-19 20:11:52 +00:00
dyoung 5624d2b7cd Use rtcache_validate() instead of rtcache_getrt(). Delete rtcache_getrt().
In rtcache_lookup2(), use the return values of rtcache_validate()
and _rtcache_init() instead of looking at _ro_rt.  Also, check the
return code of rtcache_setdst() for an error.
2008-01-14 05:00:18 +00:00
dyoung 1386ee4adf Good-bye, rtcache_check(). Call both rtcache_validate() and
rtcache_update(,1) instead of rtcache_check().
2008-01-12 02:58:58 +00:00
dyoung 5bf14fd932 _rtcache_init(): shorten this by getting out immediately if rtalloc1()
returns NULL.
rtcache_copy(): re-order operations a bit.  KASSERT() that we are
    not copying a route over itself.
2008-01-12 02:56:30 +00:00
dyoung a52afa8f89 Cosmetic: remove redundant 'not' from a comment, re-wrap lines. 2008-01-11 01:38:45 +00:00
dyoung ca874f52f7 Make many void rtcache_X() routines return struct rtentry *, so
that we can make many back-to-back rtcache_X();rtcache_getrt()
calls into one rtcache_X() call.
2008-01-10 08:03:22 +00:00
dyoung 72fea72bb2 Add a helper subroutine for ethernet drivers, ifmedia_change(). 2008-01-10 08:00:22 +00:00