Commit Graph

2031 Commits

Author SHA1 Message Date
dsl 7a42c833db Rename fo_drain() to fo_abort(), 'drain' is used to mean 'wait for output
do drain' in many places, whereas fo_drain() was called in order to force
blocking read()/write() etc calls to return to userspace so that a close()
call from a different thread can complete.
In the sockets code comment out the broken code in the inner function,
it was being called from compat code.
2009-12-09 21:32:58 +00:00
dyoung a439206784 KNF. 2009-12-09 00:44:26 +00:00
plunky 7f5b5a7b01 fix a potential leak on tap device close, purging the send queue
did not actually release the dequeued mbufs.

pointed out by Paul Forgey on tech-net
2009-11-29 10:44:23 +00:00
mbalmer 7404b55630 Fix function name that was changed by mistake in the previous whitespace
commit.
2009-11-28 09:20:37 +00:00
isaki d591783aff white space -> tab. 2009-11-28 02:58:21 +00:00
rmind dbd9b86792 Remove some unecessary includes sys/user.h header. 2009-11-23 02:13:44 +00:00
christos dd8534acfe ar_tha() can return NULL; treat this as an error. 2009-11-20 02:14:56 +00:00
joerg a5fad62a18 Simplify ifreq_setaddr:
- Drop the INET6 block. The commands are never given to this function
  and truncating the sockaddr is arguably not the desired result anyway.
- Clear the address before copying. This fixes SIOCGIFNETMASK and possible
  other ioctls for users that don't check sa_len. This includes
  COMPAT_43 and Linux emulation.

OK dyoung@
2009-11-13 23:11:08 +00:00
christos 314b0d9f8c PR/42285: PR/41559: Daniel Hagerty: if_stf doesn't count output bytes 2009-11-08 18:44:45 +00:00
dyoung fa8b0147c6 s/u_quad_t/uint64_t/. 2009-11-03 00:30:31 +00:00
dyoung bb960ead7a s/u_quad_t/uint64_t/ 2009-11-03 00:30:11 +00:00
cegger 5b494d7c82 buildfix: only declare sysctl_net_ifq_setup() if INET or INET6 is defined 2009-10-26 16:41:35 +00:00
dyoung 7b7a580067 Replace u_quad_t with uint64_t. u_quad_t is just a typedef for
uint64_t, so no ABI/API breakage will result from this change.
2009-10-05 21:25:05 +00:00
christos 14c3063365 add the error from ifpromisc to the panic. 2009-10-05 17:58:15 +00:00
elad 2bf6c7c405 We only care about KAUTH_NETWORK_ROUTE. 2009-10-03 02:22:22 +00:00
elad cee5cd7dd4 Move default network interface policy back to the subsystem. 2009-10-03 01:46:39 +00:00
elad 9f0d81cf10 Move routing socket security policy back to the subsystem. 2009-10-02 23:16:21 +00:00
skrll 2c50cb71cb Initialise index_gen_mtx before use. 2009-09-19 11:02:07 +00:00
pooka 11281f01a0 Replace a large number of link set based sysctl node creations with
calls from subsystem constructors.  Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
2009-09-16 15:23:04 +00:00
jakllsch 1d3dca01b3 When working with address preferences, sockaddr_externalize() both
addresses before comparing them.

This allows IPv6 link-local addresses (which have an embedded scope id)
to have a preference set on them.

ok dyoung
2009-09-15 23:24:34 +00:00
drochner d70cb77245 fix undefined result of stat(), found by clang static analyzer 2009-09-15 19:38:15 +00:00
degroote 2d48ac808c Import pfsync support from OpenBSD 4.2
Pfsync interface exposes change in the pf(4) over a pseudo-interface, and can
be used to synchronise different pf.

This work was part of my 2009 GSoC

No objection on tech-net@
2009-09-14 10:36:48 +00:00
tsutsui c412ca027b Make this compile with options RTSOCK_DEBUG.
Noticed by PR kern/41842, but fixed differently.
2009-09-12 18:09:25 +00:00
dyoung c5d5f7697a Make ifconfig(8) set and display preference numbers for IPv6
addresses.  Make the kernel support SIOC[SG]IFADDRPREF for IPv6
interface addresses.

In in6ifa_ifpforlinklocal(), consult preference numbers before
making an otherwise arbitrary choice of in6_ifaddr.  Otherwise,
preference numbers are *not* consulted by the kernel, but that will
be rather easy for somebody with a little bit of free time to fix.

Please note that setting the preference number for a link-local
IPv6 address does not work right, yet, but that ought to be fixed
soon.

In support of the changes above,

1 Add a method to struct domain for "externalizing" a sockaddr, and
  provide an implementation for IPv6.  Expect more work in this area: it
  may be more proper to say that the IPv6 implementation "internalizes"
  a sockaddr.  Add sockaddr_externalize().

2 Add a subroutine, sofamily(), that returns a struct socket's address
  family or AF_UNSPEC.

3 Make a lot of IPv4-specific code generic, and move it from
  sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and
  ifconfig(8).
2009-09-11 22:06:29 +00:00
tls fd671f648a Add a direction argument to socket upcalls, so they can tell why they've
been called when, for example, they're waiting for space to write.  From
Ritesh Agrawal at Coyote Point.
2009-09-02 14:56:57 +00:00
dyoung 7a9941f8e8 Use sysctl(9) to expose to userland each interface transmission
queue's maximum length, current length, and number of drops.  E.g.,

% sysctl net.interfaces.bnx0
net.interfaces.bnx0.sndq.len = 0
net.interfaces.bnx0.sndq.maxlen = 509
net.interfaces.bnx0.sndq.drops = 0

Let userland adjust the maximum queue length.

While I'm here, add a 64-bit generation number, if_index_gen, to
ifnet; the pair [ifp->if_index, ifp->if_index_gen] can serve to
identify an ifnet for the lifetime of the system.  I will use this
in an upcoming change.

Ok matt@.
2009-08-13 00:23:31 +00:00
msaitoh 7dc1329052 Add 1000BASE-BX10. 2009-08-12 11:17:17 +00:00
plunky 076d7e3e4e Avoid a kernel assertion failure upstream by using FSTATE_NOTFOUND
rather than FSTATE_FOUND when setting the unit number directly.

config_attach_pseudo() will convert it to FSTATE_FOUND just after the
assertion.
2009-07-23 17:53:17 +00:00
yamt 8bd8f20d7b comment style. no functional change. 2009-06-09 22:21:54 +00:00
hannken ae5722dac0 No need to include bsd.subdir.mk as bsd.kinc.mk already includes it. 2009-05-30 09:04:35 +00:00
darran 7dadeaa0c7 Add vlan support and hardware offload capabilities to agr.
These changes allow vlans to be layered above agr, with the attach
and detach propogated to the member ports in the aggregation.
Note the agr interface must be up before the vlan is attached.

Adds SIOCINITIFADDR support to the wm driver for setting the AF_LINK
address, necessary for agr to be able to set the mac addresses of each
port to the agr address (i.e. so it can receive all intended traffic
at the hardware level).

Adds support for disabling the LACP protocol by setting LINK1 on the agr
interface (e.g. ifconfig agr0 link1).

In consultation with tls@.
2009-05-29 04:57:04 +00:00
pooka 0f2034ae5e Make it possible to register delayed radix tree head inits which
will be processed when the radix "subsystem" is initialized -- all
users must be attached before any inits to know the max keylength.
Use of link sets is no longer required, and only attached domains
need to be considered.
2009-05-27 17:46:49 +00:00
pooka 355dcf3a3b Install agr ioctl header and stop putting our hand under the sys skirt
in ifconfig.
2009-05-26 21:58:31 +00:00
cegger 9c2bd94081 fix crash in bridge_ioctl():
BRDGGFLT and BRDGSFILT bridge controls are only available with BRIDGE_IPF and PFIL_HOOKS defined.
In amd64 GENERIC and XEN kernel configs PFIL_HOOKS is defined but BRIDGE_IPF is not.

When a BRDGGFLT or BRDGSFILT command comes in, then ifd->ifd_cmd is not in range
of bridge_control_table_size. Then bc is not set and is dereferenced
later => BOOM.
2009-05-17 11:34:21 +00:00
elad 6f53f02a37 Move kauth(9) call before going into splnet().
Mailing list reference:

	http://mail-index.netbsd.org/tech-net/2009/05/08/msg001286.html
2009-05-12 23:03:24 +00:00
elad 17c0c1e672 Add and use a network scope action/request for tun(4), similar to ppp(4),
sl(4), and strip(4).
2009-05-08 11:09:43 +00:00
elad b853042065 Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html
2009-05-07 18:01:56 +00:00
elad 8f15ad8a37 Provide privilege checking code snippets for all significant NetBSD
versions: < 2 (suser, proc), 2 & 3 (suser, lwp), >= 4 (kauth, lwp).

No functional change as it's all inside a big comment.
2009-05-06 22:17:41 +00:00
dyoung b99ed0004a Let this build even if 'no options INET'. 2009-04-28 23:05:25 +00:00
dyoung a82ec647f5 Let this build with 'no options INET'.
(I don't know why I bothered, either.)
2009-04-28 21:26:51 +00:00
tsutsui 3684ba252b Use memcmp(9) and memcpy(9) directly rather than via
local BCMP() and BCOPY() macro.
2009-04-18 15:20:06 +00:00
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
elad 2d1c968399 Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive
alternatives.

Discussed on tech-kern:

	http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html

Input from ad@, christos@, dyoung@, tsutsui@.

Okay ad@.
2009-04-15 20:44:24 +00:00
christos 86ba58fd64 Fix locking as Andy explained. Also fill in uid and gid like sys_pipe did. 2009-04-11 23:05:26 +00:00
christos b859fbe7cb Fix PR/37878 and PR/37550: Provide stat(2) for all devices and don't use
fbadop_stat.
2009-04-11 15:47:33 +00:00
bouyer 0c046062f0 Fix another typo 2009-04-04 15:53:49 +00:00
bouyer 11abca258d Fix a comment, and make it build. 2009-04-04 15:47:28 +00:00
bouyer 7f8c56170f Fixes from Masao Uebayashi 2009-04-04 15:31:47 +00:00
ad c6367674d6 Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)
2009-04-04 10:12:51 +00:00
bouyer 1fd1b49685 Fix for if_start() and pfil_hook() being called from hardware interrupt
context (reported on various mailing-lists, and part of PR kern/41114,
causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used).
Defer bridge_forward() to a software interrupt; bridge_input() enqueues
mbufs to ifp->if_snd which is handled in bridge_forward().
2009-04-04 10:00:23 +00:00