Commit Graph

50 Commits

Author SHA1 Message Date
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
jonathan b19c0fbb0a Make kernel SOMAXCONN patchable. Will add sysctl once we
decide on namespace.
2000-02-07 18:43:26 +00:00
thorpej 84380f9fbe In sosend(), if so_error is set, clear it before returning the error to
the process (i.e. pre-Reno behavior).  The 4.4BSD behavior (introduced
in Reno) caused transient errors to stick incorrectly.

This is from PR #7640 (Havard Eidnes), cross-checked w/ FreeBSD, where
Bill Fenner committed the same fix (as described in a comment in the
Vat sources, by Van Jacobsen).
1999-06-08 02:39:57 +00:00
sommerfeld 6c63af182f Delete test code. 1999-05-15 22:37:22 +00:00
sommerfeld c01c0d9453 Revise previous fix:
1) protect socket flags under splsoftnet()
	2) avoid leaking memory on an error
1999-05-15 22:36:34 +00:00
tv fc3f28c6bd Wow, that was much easier than I originally thought. Fix PR kern/7583:
serious race condition in sosend().  Upon closer inspection, the appropriate
flags are checked within splsoftnet() for soreceive(), so no change needed
there.  Also a little KNFing in sosend().
1999-05-15 16:42:48 +00:00
lukem 8a931fcdd8 Ensure that you can only bind a more specific address when it is done by the
same uid or by root.

This code is from FreeBSD. (Whilst it was originally obtained from OpenBSD,
FreeBSD fixed it to work with multicast. To quote the commit message:
    - Don't bother checking for conflicting sockets if we're binding to a
      multicast address.
    - Don't return an error if we're binding to INADDR_ANY, the conflicting
      socket is bound to INADDR_ANY, and the conflicting socket has
      SO_REUSEPORT set.
)
1999-03-23 10:45:37 +00:00
mycroft 808496666c Do remove sockets on so_q0, since select(2) and accept(2) do not (currently?)
return them.
1999-01-21 22:09:10 +00:00
mycroft 0fb75f560a Oops; previous was slightly broken. 1999-01-20 20:24:12 +00:00
mycroft 430ecf369d Do not remove sockets from the accept(2) queue on close. 1999-01-20 09:15:41 +00:00
thorpej 2ef3bcfbb8 In the sosend() loop, if the residual count is > 0 before calling PRU_SEND,
set SS_MORETOCOME as a hint to the lower layer that more data is coming
on the next iteration of the loop.  Clear the flag after the PRU_SEND
call.

Suggested by Justin Walker <justin@apple.com> on the freebsd-net
mailing list.
1998-12-16 00:26:10 +00:00
matt f0071e56cf Fix spl problem in socreate (which lead to the corruption of the
socket pool).
1998-09-25 23:32:27 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
thorpej a4c7bab10e Use the pool allocator for sockets. 1998-08-02 04:53:11 +00:00
perry 730baa7431 fix sizeofs so they comply with the KNF style guide. yes, it is pedantic. 1998-07-31 22:50:48 +00:00
thorpej 8aee7782f5 defopt COMPAT_SUNOS 1998-06-25 23:40:33 +00:00
kleink 82eb51ee05 In soshutdown(), decouple the evaluation of the `how' argument from FREAD
and FWRITE; use SHUT_{RD,WR,RDWR} instead.
Also, return EINVAL if `how' is invalid.
1998-04-27 13:31:45 +00:00
matt 754c43dcfc Hook for 0-copy (or other optimized) sends and receives 1998-04-25 17:35:18 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
thorpej cbf3cc6bb8 Make insertion and removal of sockets from the partial and incoming
connections queues O(C) rather than O(N).
1998-01-07 23:47:08 +00:00
thorpej 2e85747e9e From 4.4BSD-Lite2 (noted by Frank van der Linden):
so_linger is used as an argument to tsleep(), so was stuffed with
clockticks for the TCP linger time.  However, so_linger is set directly from
l_linger if the linger time is specified, and l_linger is seconds (although
this is not currently documented anywhere).  Fix this to set the TCP
linger time in seconds, and multiply so_linger by hz when tsleep() is
called to actually perform the linger.
1998-01-05 09:12:29 +00:00
mycroft f31ed493f7 Fix a mbuf leak in sosend() when we have a negative residual count. 1997-08-27 07:10:01 +00:00
thorpej cd730bdd50 In sosetopt():
- Disallow < 1 values for SO_SNDBUF, SO_RCVBUF, SO_SNDLOWAT, and
  SO_RCVLOWAT; return EINVAL if the user attempts to set <= 0.
  Inspired by PR #3770, from Havard Eidnes <he@vader.runit.sintef.no>.
- For SO_SNDLOWAT and SO_RCVLOWAT, don't let the low-water mark get
  set above the high-water mark.  Behavior is now consistent with
  BSD/OS: If such an attempt is made, silently truncate to the high-water
  value.
1997-06-24 20:04:45 +00:00
kleink 372bfc7c08 Calculate returned timeval correctly when using SO_SNDTIMEO/SO_RCVTIME;
from Koji Imada <koji@math.human.nagoya-u.ac.jp> in PR/3682.
1997-06-11 10:04:09 +00:00
thorpej 62dcdcfb89 Implement SO_TIMESTAMP socket option: receive a timeval timestamp
as a control message with a datagram.
1997-01-11 05:15:01 +00:00
explorer a9ef8aef84 This fixes a nasty little bug where traceroute (and other raw-ip sending
programs which attach their own header) can crash the machine.  The problem
in this case was:
	a variable "space" was set to the total data to copy,
	len was used to remember how much to copy in this chunk (mbuf),
	in one case, len = min(MCLBYTES - max_hdr, resid) but
		size -= MCLBYTES;
	 instead of
		size -= len;

Note that userland programs can still crash the machine by providing
bogus data in the ip->ip_len field I suspect.  I haven't verified this,
but will soon be doing so and applying a fix of some sort.  Probably
clamping the ip->ip_len value to the true packet size will be ok.
1996-08-14 05:53:18 +00:00
mycroft 08cc6b486f And PRU_SEND. 1996-05-22 19:06:07 +00:00
mycroft b85e5d8f5e PRU_CONNECT also needs a proc pointer. 1996-05-22 19:00:52 +00:00
mycroft 49d52c9b1c Pass a proc pointer down to the usrreq and pcbbind functions for PRU_ATTACH, PRU_BIND and
PRU_CONTROL.  The usrreq interface really needs to be split up, but this will have to wait.
Remove SS_PRIV completely.
1996-05-22 13:54:55 +00:00
christos e630447d8c First pass at prototyping 1996-02-04 02:17:43 +00:00
mycroft 5482957905 splnet --> splsoftnet 1995-08-12 23:59:09 +00:00
cgd 7e68171a95 properly determine if send/rcv timeout values are out of range. 1995-05-23 00:19:30 +00:00
christos 3d1b06ab09 - new copyargs routine.
- use emul_xxx
- deprecate nsysent; use constant SYS_MAXSYSCALL instead.
- deprecate ep_setup
- call sendsig and setregs indirectly.
1995-04-22 19:42:47 +00:00
cgd 6ac2bbfc35 be more careful with types, also pull in headers where necessary. 1994-10-30 21:43:03 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft d361acde18 Update to 4.4-Lite networking code, with a few local changes. 1994-05-13 06:01:27 +00:00
mycroft f8a6ac17b2 More return types... 1994-05-04 11:24:06 +00:00
mycroft f43af3a756 Remove another bit of that. 1994-04-25 08:47:50 +00:00
mycroft ccb0412b7c Remove a piece of the previous patch. 1994-04-25 08:41:03 +00:00
mycroft e4af8f69a5 Minor cleanup. 1994-04-25 08:22:07 +00:00
deraadt abf6a6bfdd more COMPAT_SUNOS changes. 1994-01-23 06:06:21 +00:00
mycroft 7f50bd1829 Canonicalize all #includes. 1993-12-18 04:21:37 +00:00
cgd 8068dd9add fix from david greenman, davidg@freefall.cdrom.com:
sosend was attempting to reserve space in an mbuf cluster for a datagram
header and because of bugs in the sosend's mbuf allocation algorithm,
sosend was calling uiomove twice as many times as was necessary. It turns
out that PREPEND does the right thing when a cluster is associated with
an mbuf header, so the datagram header allocation can be defered. This
also ends up additionally consuming one less mbuf for the TCP protocol
because TCP always allocates another header mbuf regardless if space is
available to prepend the protocol header. The net result of this fix is
that unix domain and pipe throughput is increased by a measured 10%.
1993-11-05 23:00:27 +00:00
cgd 299ff91b14 BSDI official patch #14:
SUMMARY:
    Here is a patch for a kernel hang that can be provoked with a write
    or send of a negative amount.  The talk program is capable of exercising
    this bug.  This patch also includes a fix for a bug that caused data
    to be delivered to TCP in smaller chunks than desired, and which caused
    TCP to send a short packet when starting up.  Finally, there is a bug
    fix for MSG_PEEK with an oobmark pending.
1993-10-26 22:36:25 +00:00
mycroft 64540d3533 Patch from David Greenman to reduce CPU usage during network transmit. 1993-09-08 21:12:49 +00:00
mycroft bbc8c11fd5 Nuke an extra `||' Chris inserted. 1993-08-03 02:45:20 +00:00
cgd d6b4910ac2 fix from Garrett Wollman <wollman@emba.uvm.edu> to return EPROTONOTSUPP
if user tries to get a socket for a protocol with no usrreq function
1993-08-03 01:36:10 +00:00
andrew d46fb2c3fb * ansifications
* Yuval Yarom's socket recv(2) fixes, to prevent incorrect blocking and
  lack thereof with recv(2) and MSG_WAITALL.  Fixes a sbdrop() panic during
  some MSG_WAITALL recv(2) sleeps.  Access rights fix (also in
  uipc_syscalls.c) too.  A test program which shows these problems is
  available.
1993-06-27 06:08:15 +00:00
cgd 8d6c77881c make kernel select interface be one-stop shopping & clean it all up. 1993-05-18 18:18:40 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00