Commit Graph

1961 Commits

Author SHA1 Message Date
oki 4c7318c4d2 Fixed a number of race conditions in the case of receiving ipv4 packet.
found by iij seil team.
2010-03-12 13:33:19 +00:00
pooka 54b3dc4108 tcp sockbuf autoscaling was initially added turned off because it
was experimental.  People (including myself) have been running with
it turned on for eons now, so flip the default to enabled.
2010-01-26 18:09:07 +00:00
pooka 6e52e33956 ipfilter depends on bpf_filter, not bpfilter (since the year 2000). 2010-01-24 14:25:57 +00:00
pooka b014350f7f Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2010-01-19 22:08:16 +00:00
elad 1d8d325447 Get the uid from the socket's credentials. 2009-12-30 06:59:32 +00:00
dyoung 802b1236af Remove superfluous cast of a pointer to void *.
Compare a pointer with NULL, not 0.

No functional change intended.
2009-12-09 00:45:25 +00:00
christos adf7e47145 PR/42243: Yasuoka Masahiko: Add "net.inet.icmp.bmcastecho" sysctl support,
to disable icmp replies to the broadcast address.
2009-12-07 18:47:24 +00:00
dyoung 04489f616a Initialize/compare pointers with NULL instead of 0. 2009-12-07 18:38:55 +00:00
christos dd8534acfe ar_tha() can return NULL; treat this as an error. 2009-11-20 02:14:56 +00:00
christos 6cd198d078 Handle RFC 5227 ARP probes properly, don't drop 0.0.0.0 source packets
silently. (Patrik Lahti <plahti at qnx dot com>)
2009-11-03 00:57:42 +00:00
christos dbfa0db489 add enough info to let rtadvd compile with route-info. 2009-10-31 22:32:17 +00:00
rmind 993cb03302 Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
2009-10-19 23:19:37 +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
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
pooka fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +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
darran ddd44491c6 Make tcp msl (max segment life) tunable via sysctl net.inet.tcp.msl.
Okayed by tls@.
2009-09-09 22:41:28 +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 ce7dbb45a0 Stop the admin from creating nodes under net.inet.ip.interfaces or
net.inet.ip.interfaces.<ifname>.
2009-08-30 02:03:58 +00:00
dyoung 6c7a849f95 Don't require the gateway address to have room for both an interface
name and address.  Room for an address will do.  This should fix
a regression in 'arp -s ...' on interfaces such as xennet0 with
unusually long names.

I will request a pull-up to netbsd-5.
2009-08-12 22:16:15 +00:00
minskim 39e3066b15 Enable IP_MINTTL option for SOCK_DGRAM sockets. 2009-07-19 23:17:33 +00:00
minskim 2708c3c1b9 Check the minimum ttl only when pcb is available. 2009-07-18 23:09:53 +00:00
minskim d0a9c36e4a Add the IP_MINTTL socket option.
The IP_MINTTL option may be used on SOCK_STREAM sockets to discard
packets with a TTL lower than the option value.  This can be used to
implement the Generalized TTL Security Mechanism (GTSM) according to
RFC 3682.

OK'ed by christos@.
2009-07-17 22:02:54 +00:00
minskim 5731aa1460 Delete trailing whitespace. 2009-07-17 18:09:25 +00:00
minskim ca28940e0e Add the IP_RECVTTL option support.
If the IP_RECVTTL option is enabled on a SOCK_DGRAM socket, the
recvmsg(2) call will return the TTL of the received datagram.  The
msg_control field in the msghdr structure points to a buffer that
contains a cmsghdr structure followed by the TTL value.

Modeled after FreeBSD implementation.
2009-07-16 04:09:51 +00:00
martin 061a87b549 From Wolfgang Stukenbrock in PR kern/41659: add missing splx(). 2009-07-01 14:47:54 +00:00
christos 8d20d2e953 Follow exactly the recommendation of draft-ietf-tcpm-tcpsecure-11.txt:
Don't check gainst the last ack received, but the expected sequence number.
This makes RST handling independent of delayed ACK. From Joanne M Mikkelson.
2009-06-20 17:29:31 +00:00
rmind 57aadb4062 sysctl_inpcblist: fix a lock leak in error path (hi <matt>). 2009-06-07 16:20:29 +00:00
taca 53a127e0ac Make ip_carp.c compile, fixing usage of CARP_LOG(). 2009-06-07 06:11:18 +00:00
christos e43c20ce1f PR/38260: Brian Seklecki: Improve carp logging. 2009-05-27 21:32:31 +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 9d2101a249 POOL_INIT -> pool_init 2009-05-27 17:41:03 +00:00
elad b15203315e Implicit EPERM -> explicit EACCES.
Requested by ad@ and yamt@.
2009-05-12 22:22:46 +00:00
elad 3a4dad547d Fix previous, || -> &&.
Pointed out by cube@, thanks!
2009-05-12 22:01:20 +00:00
elad d2379b2f18 Fix inverted permissions check. 2009-05-12 21:48:42 +00:00
elad 12ec766ad8 Add check for IN_MULTICAST() that was taken only to in_pcbbind_port() --
it's necessary in in_pcbbind_addr() as well.

Pointed out by Mihai Chelaru on tech-net@, thanks!
2009-05-09 20:54:52 +00:00
elad 4188b89914 Remove some usage of "priv" and "privileged" variables and instead pass
around credentials. Also push down kauth(9) calls closer to where the
operation is done.

Mailing list reference:

	http://mail-index.netbsd.org/tech-net/2009/04/30/msg001270.html
2009-05-06 21:41:59 +00:00
elad 3c1f169a59 Commit changes to netinet6/in6_src.c, forgot in previous commit:
http://mail-index.netbsd.org/source-changes/2009/04/30/msg220547.html

Make in_pcbsetport() set the port number selected before passing "sin" to
kauth(9).
2009-04-30 20:26:09 +00:00
elad ddcbe0e1dd - Make in6_pcbbind_{addr,port}() static
- Properly authorize port binding in in_pcbsetport() and in6_pcbsetport()

- Pass struct sockaddr_in6 to in6_pcbsetport() instead of just the address,
  so that we have a more complete context

- Adjust udp6_output() to craft a sockaddr_in6 as it calls in6_pcbsetport()

- Fix an issue in in_pcbbind() where we used the "dom_sa_any" pointer and
  not a copy of it, pointed out by bouyer@, thanks!

Mailing list reference:

	http://mail-index.netbsd.org/tech-net/2009/04/29/msg001259.html
2009-04-30 18:18:34 +00:00
elad 7f1171f976 - Make kauth(9) call logic match the one in netinet6/in6_pcb.c
- Indent a comment
2009-04-23 17:02:26 +00:00
elad f2eb9b87ec Some changes to in_pcbbind():
- Extract guts to in_pcbbind_{addr,port}()

  - Put the port auto-assignment logic in in_pcbsetport(), which looks very
    similar to in6_pcbsetport()

  - Fix a bug where "sin" was passed to kauth(9) without being set to
    anything

No objections on tech-net@.
2009-04-23 16:42:56 +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 d0cccdd5f2 Pass the lwp argument to in6_pcbbind() for the INET6 PRU_LISTEN and
PRU_CONNECT cases of tcp_usrreq(). It seems they were forgotten a long
time ago.

Similar code in FreeBSD and OpenBSD passes the thread (credentials)/proc.
2009-04-17 01:48:22 +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
elad d91dbb36b0 Don't set sin->sin_port and sin6->sin6_port to 0 before calling
ifa_ifwithaddr(), as we no longer do a byte compare on the entire struct.

Reviewed by and okay from dyoung@.
2009-04-14 21:25:20 +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 164477c65a ansify function definitions 2009-03-15 22:16:09 +00:00
cegger dc56dbbd97 ansify function definitions 2009-03-15 21:23:31 +00:00