Commit Graph

2009 Commits

Author SHA1 Message Date
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
christos
af069eb3c7 Centralize the ROUNDUP and ADVANCE macro in a header file, give them an
RT_ prefix and use them appropriately, instead of making copies. Make
pppd use the RT_ROUNDUP macro; fixes proxyarp setting on 64 bit hosts.

XXX: All this should be pulled up to 5.0
2009-04-02 21:02:06 +00:00
darran
49d3640ae0 Also inherit the parent's TCP segmentation offload capability.
Note the vlan interface does not see updates to the parents capabilities
so if, for example, TSO is on in both, then turned off in the parent it
will remain on in the vlan interface.
2009-04-01 22:56:59 +00:00
darran
36ea3668b9 Fixes PR kern/41069 and PR kern/41070.
Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION,  CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel.  The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
2009-03-25 01:26:12 +00:00
roy
4ff22349d3 When a route is deleted or it's ifa changed and it's the connected route
for the ifa we should ensure the IFA_ROUTE flag is removed from the ifa
and if applicable, added to the new ifa.
2009-03-24 16:36:52 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger
962766853c ansify function definitions 2009-03-16 05:59:21 +00:00
cegger
dc56dbbd97 ansify function definitions 2009-03-15 21:23:31 +00:00
cegger
d3189d3544 ansify function definitions 2009-03-15 20:30:05 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
plunky
bb3009f7a7 Deprecate the SIOCSIFPHYADDR ioctl and the sysctl node in favour
of the generic SIOCALIFADDR.

As suggested by cube.
2009-03-13 18:40:10 +00:00
roy
ab72df6eb5 Revert r1.119 as the implementation is broken. 2009-03-11 09:26:27 +00:00
mrg
ce98775552 like KERN_FILE2: *do* update "needed" when there is no count. we want
userland to know what sort of size to provide..

while here, slightly normalise the previous to init_sysctl.c.
2009-03-11 05:55:22 +00:00
plunky
32813437a3 repair the SIOCSIFPHYADDR ioctl handler to be compatible with previous
versions which used a "struct sockaddr"
2009-03-10 22:14:57 +00:00
yamt
3d7b4bf380 - rtredirect: use sockaddr_cmp directly.
- remove now unused equal.
2009-02-20 10:57:19 +00:00
yamt
a628bc1c00 remove inline from some functions which are not small or critical. 2009-02-20 10:54:57 +00:00
christos
c6c3da7776 PR/40690: Jordan Gordeev: pppoe(4) doesn't work when PPPoE relays are present
Add support for sending the session id tag back.
2009-02-19 15:17:50 +00:00
christos
fab9a9d4d2 mention when this will really break, not 2038 but 2145. 2009-02-14 20:48:46 +00:00
christos
942a145f69 PR/40603: Christoph Badura: unprivileged users can add and delete interface
link addresses. Fixed by centralizing the test as suggested. Will pull up
to 5.0 once submitter tests the fix.
2009-02-12 19:05:36 +00:00