Commit Graph

1730 Commits

Author SHA1 Message Date
bouyer
bc93583ffe If we're going to byteswap fields in the TCP header, make sure the mbuf
area is writable first.
2006-05-25 21:49:19 +00:00
bouyer
df9be102c5 Make sure the mbuf is writable before trying to write to it. 2006-05-25 21:33:12 +00:00
liamjfoy
14c608becb remove a little white space 2006-05-25 15:22:05 +00:00
liamjfoy
d8d9494bf9 Add a check for our own advertisements. This is due to non-simplex
interfaces which received the packets they have just sent.

From: OpenBSD (rev. 1.124)
ok: christos@
2006-05-24 13:39:37 +00:00
liamjfoy
4876c304b1 Integrate Common Address Redundancy Procotol (CARP) from OpenBSD
'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@
2006-05-18 09:05:49 +00:00
christos
fc6d984beb kauth fallout 2006-05-15 00:05:16 +00:00
elad
874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
christos
8f60e3b3e5 Comment out attribute packed. Gcc4 warns us that the field is too narrow
for packing. Produces the same size struct on i386 (28 bytes)
2006-05-14 02:34:41 +00:00
mrg
126f7e1139 since ar_tha() can return NULL, don't pass it directly to functions
that expect real addresses.  explicitly KASSERT() that it is not
NULL in the kernel and just avoid using it userland.

(the kernel could be more defensive about this, but, until now it
would have just crashed anyway.)
2006-05-12 01:20:33 +00:00
mrg
084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
liamjfoy
64c2ef1711 #if -> #ifdef
ok christos
2006-05-08 18:50:12 +00:00
rpaulo
de8db47547 Add support for RFC 3542 Adv. Socket API for IPv6 (which obsoletes 2292).
* RFC 3542 isn't binary compatible with RFC 2292.
* RFC 2292 support is on by default but can be disabled.
* update ping6, telnet and traceroute6 to the new API.

From the KAME project (www.kame.net).
Reviewed by core.
2006-05-05 00:03:21 +00:00
liamjfoy
79f53c18fe - use MAXTTL
ok christos@
2006-04-25 08:29:08 +00:00
christos
49cd195740 Coverity CID 1153: Add KASSERT before deref. 2006-04-15 02:33:41 +00:00
christos
4fd8acf0f3 Coverity CID 1152: Add KASSERT before deref. 2006-04-15 02:32:22 +00:00
christos
ddb5372e69 Coverity CID 1149: Add KASSERT before deref. 2006-04-15 02:30:39 +00:00
christos
7a396ae9a9 Coverity CID 1148: Add KASSERT before deref. 2006-04-15 02:29:12 +00:00
christos
f190fa88ca Coverity CID 1134: Protect against NULL deref. 2006-04-15 02:24:12 +00:00
christos
3e3a249d3c Move pf2 assignment after we've assigned pf. 2006-04-15 00:29:25 +00:00
christos
519309ea6e Coverity CID 1154: Prevent NULL deref. 2006-04-14 23:17:24 +00:00
christos
0f609f1bfa Coverity CID 738: Fix the query size vs. result returning setup. 2006-04-14 23:09:16 +00:00
dyoung
4db39a7dbf When reflecting an ICMP Echo, do not scribble over read-only/shared
mbuf storage.
2006-03-29 21:13:55 +00:00
seanb
c6d79d21de Slight simplification of hdr len calculation in tcp_segsize().
No functional change.
2006-03-25 13:34:35 +00:00
matt
4c71408df5 An MTU can't be negative so store them in unsigned variables. 2006-03-22 01:07:24 +00:00
wiz
e2a71c2aab 'advertisment' -> 'advertisement', from leonardo chiquitto filho
via jmc@openbsd.
2006-03-07 18:15:28 +00:00
rpaulo
8c2379fd97 NDP-related improvements:
RFC4191
	- supports host-side router-preference

	RFC3542
	- if DAD fails on a interface, disables IPv6 operation on the
          interface
	- don't advertise MLD report before DAD finishes

	Others
	- fixes integer overflow for valid and preferred lifetimes
	- improves timer granularity for MLD, using callout-timer.
	- reflects rtadvd's IPv6 host variable information into kernel
	  (router only)
	- adds a sysctl option to enable/disable pMTUd for multicast
          packets
	- performs NUD on PPP/GRE interface by default
	- Redirect works regardless of ip6_accept_rtadv
	- removes RFC1885-related code

From the KAME project via SUZUKI Shinsuke.
Reviewed by core.
2006-03-05 23:47:08 +00:00
christos
23ecfee197 Handle IPSEC_NAT_T in the FAST_IPSEC case.
XXX: need to fix the FAST_IPSEC code now.
2006-02-23 01:35:19 +00:00
joerg
34096c9b32 Print the source and destination IP in ip_forward's DIAGNOSTIC code
with inet_ntoa, making it more human friendly.

From Liam J. Foy in private mail.
2006-02-18 17:47:07 +00:00
rpaulo
ae6865ba83 PR 13952: Noritoshi Demizu: correct the TCP window information update check. 2006-02-18 17:34:49 +00:00
perry
fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
riz
854279801b If TCP_SIGNATURE is defined, include netinet6/scope6_var.h for the
prototype of in6_clearscope().  Kernels with options TCP_SIGNATURE now
compile again after the IPv6 scoped address changes.
2006-02-02 05:52:23 +00:00
elad
6a22a76f5c fix tyop.
pr 32678 from yves emmanuel jutard.
2006-01-31 17:19:39 +00:00
rpaulo
78678b130a Better support of IPv6 scoped addresses.
- most of the kernel code will not care about the actual encoding of
  scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
  scoped addresses as a special case.
- scope boundary check will be stricter.  For example, the current
  *BSD code allows a packet with src=::1 and dst=(some global IPv6
  address) to be sent outside of the node, if the application do:
    s = socket(AF_INET6);
    bind(s, "::1");
    sendto(s, some_global_IPv6_addr);
  This is clearly wrong, since ::1 is only meaningful within a single
  node, but the current implementation of the *BSD kernel cannot
  reject this attempt.
- and, while there, don't try to remove the ff02::/32 interface route
  entry in in6_ifdetach() as it's already gone.

This also includes some level of support for the standard source
address selection algorithm defined in RFC3484, which will be
completed on in the future.

From the KAME project via JINMEI Tatuya.
Approved by core@.
2006-01-21 00:15:35 +00:00
perry
f8824a9b43 change comment from __const__ to const 2005-12-24 23:43:17 +00:00
perry
0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos
f01a2f5714 Define INADDR_NONE when we are in the kernel too. 2005-12-20 19:32:30 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
elad
9702e98730 Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
2005-12-10 23:31:41 +00:00
manu
9d0ec64222 Fix a bug in ESP over UDP: because udp4_espinudp() called m_pullup, it
could modify the struct mbuf and calling functions (udp_input() and
udp4_realinput()) would have used a garbled local copy of the pointer.

The fix is not perfect. udp4_espinudp() should use m_pulldown()...
2005-12-09 15:36:34 +00:00
yamt
d3ac0a8b69 revert rev.1.72 as it isn't necessary. 2005-11-22 17:52:38 +00:00
dsl
c24781af04 Pass the current process structure to in_pcbconnect() so that it can
pass it to in_pcbbind() so that can allocate a low numbered port
if setsockopt() has been used to set IP_PORTRANGE to IP_PORTRANGE_LOW.
While there, fail in_pcbconnect() if the in_pcbbind() fails - rather
than sending the request out from a port of zero.
This has been largely broken since the socket option was added in 1998.
2005-11-15 18:39:46 +00:00
christos
2fa7cb2348 Remove redundant assignment (from Liam Foy) 2005-11-10 13:40:38 +00:00
christos
8481673c7a Don't decrement the ttl, until we are sure that we can forward this packet.
Before if there was no route, we would call icmp_error with a datagram
packet that has an incorrect checksum. (From Liam Foy)
2005-11-01 21:21:09 +00:00
christos
ff7f1eddad No need to pass an interface when only the mtu is needed. From OpenBSD via
Liam Foy.
2005-10-23 18:38:53 +00:00
christos
30756e31a3 small list macro cleanup:
- remove duplicate LIST_FIRST (Liam Foy)
- change to use LIST_FOREACH or for () instead of while () for consistency
2005-10-17 19:51:24 +00:00
seanb
6d8b694cb5 - Close NULL dereference when a GIFALIAS is performed on
a non existant address.
- Code review: christos
2005-09-28 17:56:27 +00:00
dyoung
a58bd46ec2 People have to read this code, so I am removing the double-negative
tautology, #ifndef notdef, which is not only superfluous, but easily
misread as #ifdef notyet.
2005-09-19 05:28:46 +00:00
seb
cf017dd18f Replace plain 255 by MAXTTL. 2005-09-11 22:15:19 +00:00
christos
8c1f164eb6 Allow the multicast_ttl and the multicast_loop options to be set with both
u_char and u_int option variables. Original patch from seb.
2005-09-11 21:57:24 +00:00
elad
348574574d Implement curtain for AF_INET{,6} PCB lists. 2005-09-07 17:58:13 +00:00
rpaulo
67a0c36218 Correct SYSCTL_DESCR for tcp.debx. 2005-09-06 02:57:04 +00:00
rpaulo
37cbe61e67 Implement tcp.inet{,6}.tcp{,6}.(debug|debx) when TCP_DEBUG is set. They
can be used to ``transliterate protocol trace'' like trpt(8) does.
2005-09-06 02:41:14 +00:00
rpaulo
f8bcc940fb Wrap two big lines. 2005-09-06 01:05:38 +00:00
kleink
c69ab4901b udp4_espinudp(): don't assume that the Non-ESP marker (or UDP payload)
is aligned on a 64-bit boundary.
2005-09-03 18:01:07 +00:00
christos
2368c3b779 make ICMPPRINTFS work; from Liam Foy. 2005-08-19 12:29:18 +00:00
yamt
2e85eff671 - introduce M_MOVE_PKTHDR and use it where appropriate.
intended to be mostly API compatible with openbsd/freebsd.
- remove a glue #define in netipsec/ipsec_osdep.h.
2005-08-18 00:30:58 +00:00
christos
622690226a If called from syn_cache_add, we need to initialize t_state before calling
tcp_dooptions. Pointed out by yamt.
2005-08-12 14:41:00 +00:00
hubertf
a72fe4e4bf Clarify comment that "the protocol specification dated September, 1981"
is really RFC 793.
2005-08-12 04:19:22 +00:00
christos
5910d08b05 Don't process TCP options in SYN packets after the connection has
been established. (FreeBSD-SA-05:15.tcp)
2005-08-11 22:25:18 +00:00
yamt
b211b85ff4 wrap INET-only code by #if defined(INET). 2005-08-10 13:07:21 +00:00
yamt
f02551ec2d move {tcp,udp}_do_loopback_cksum back to tcp/udp
so that they can be referenced by ipv6.
2005-08-10 13:06:49 +00:00
yamt
8220c378e6 device independent part of ipv6 rx checksum offloading. 2005-08-10 13:05:16 +00:00
yamt
40a140d919 ipv6 tx checksum offloading. reviewed by Jason Thorpe. 2005-08-10 12:58:37 +00:00
elad
6439f2618f Add sysctls for IP, ICMP, TCP, and UDP statistics. 2005-08-05 09:21:25 +00:00
gdt
e25f2a0d87 Restore to working order; this has apparently been nonworking since
the decapsulator dispatch changes in 2001.  Problems found and fixed
by Christine Jones of BBN.  Specifically:

Check for a packet's protocol to be ENCAP_PROTO, not AF_INET.

Remove one-back cache for last vif, because vif_encapcheck is called
for each vif, rather than being expected to find the appropriate vif.
The cache usage caused packets to be input on the wrong vif and hence
usually dropped.

In vif_encapcheck, verify the local source as well.  While mrouted
endeavors not to create multiple tunnels with a peer, a packet
arriving with the wrong local address is still wrong and should not be
accepted.  (This is a correctness nit, not a security issue.)  Order
checks to fail quickly for packets being checked to see if they match
a vif other than the one they belong on (essentially, check peer
source address in outer header first).

Claim 69 bits of match (32 each from outer src/dst and 5 from checking
that inner dst is within 224/5).  This should result in the vif having
a higher priority for multicast packets compared to a parallel gif(4)
tunnel, and that both seems appropriate if both are configured and
seems to match the semantics expected by the decapsulator dispatch
machinery.

(These changes were made in 2.99.15 and about a dozen nodes are
running them with many vifs.  ip_mroute.c has not changed
significantly since then (February 2005) and the changes applied
cleanly to current and compile cleanly.)
2005-08-03 18:20:11 +00:00
christos
afe9d603ec PR/30844: Gert Doering: Non-inet traffic is passed to bpf incorrectly (as inet) 2005-07-26 21:26:48 +00:00
riz
fba9a3bda6 Add a definition for TCPOLEN_SIGLEN from OpenBSD, so a kernel with
options TCP_SIGNATURE will compile again after the new PMTU checks
were brought in from OpenBSD.  Approved by christos.
2005-07-21 17:32:11 +00:00
he
4047396e46 Make this build without INET6. 2005-07-20 08:05:43 +00:00
christos
89940190d0 Implement PMTU checks from:
http://www.gont.com.ar/drafts/icmp-attacks-against-tcp.html

1. Don't act on ICMP-need-frag immediately if adhoc checks on the
advertised MTU fail. The MTU update is delayed until a TCP retransmit
happens.
2. Ignore ICMP Source Quench messages meant for TCP connections.

From OpenBSD.
2005-07-19 17:00:02 +00:00
gdt
b0239c745e Add PR_PURGEIF flag for protocols to indicate that the protocol might
store a struct ifnet *, and define it for udp/tcp/rawip for INET and
INET6.  When deleting a struct ifnet, invoke PRU_PURGEIF on all
protocols marked with PR_PURGEIF.  Closes PR kern/29580 (mine).
2005-07-19 12:58:24 +00:00
xtraeme
997ffdbad9 Move ipl.h into the ipfilter block, which is the right place. 2005-07-09 14:15:11 +00:00
christos
a85b0c68e0 Normalize our PAWS code with Free and Open, as mentioned in tech-security. 2005-06-30 02:58:28 +00:00
seanb
d7185c5796 - Return ICMP_UNREACH_NET when no route found as per
section 4.3.3.1 of rfc1812.
2005-06-28 19:38:58 +00:00
drochner
de48323ae9 typo in comment 2005-06-28 19:16:02 +00:00
mlelstv
d23f1d6e16 expire cached route. Fixes PR 22792. 2005-06-26 10:39:21 +00:00
atatat
df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
atatat
420d91208b Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code.  I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
2005-06-09 02:19:59 +00:00
yamt
0e70c535bf tcp_input: don't overload opti.ts_ecr. 2005-06-06 12:10:09 +00:00
martin
71d020f371 Since we decided "const struct mbuf *" would not do the right thing (tm),
remove ~all const from mbuf pointers.
2005-06-06 06:06:50 +00:00
martin
4ba4736381 Adapt to ip_encap.h constification. 2005-06-06 04:51:06 +00:00
christos
578e0f23a2 make this compile again. 2005-06-06 02:47:59 +00:00
martin
782608e87b Sprinkle some const 2005-06-03 21:40:56 +00:00
tron
c86b2622dd Change the first argument of the encapsulation check function from
"const struct mbuf *" to "struct mbuf *". Without this change the
actual implementation cannot even use m_copydata() on the mbuf chain
which is broken.
2005-06-02 15:21:35 +00:00
tron
41dcb3a310 Remove type casts and lint directives which are now longer necessary
because the first argument of m_copydata() is "const struct mbuf *" now.
2005-06-02 10:54:58 +00:00
riz
c86368208b Fix some const fallout. 2005-06-02 04:40:46 +00:00
drochner
49d230fa91 need a "const" 2005-06-01 12:27:15 +00:00
blymn
e703150707 Unconstify rnode to prevent compile error when GATEWAY option set. 2005-06-01 09:45:15 +00:00
christos
ea2d4204b6 - add const
- remove bogus casts
- avoid nested variables
2005-05-29 21:41:23 +00:00
christos
00c7362be7 change casts to proper unconst. mark XXXUNCONST 2005-05-29 21:40:27 +00:00
christos
52d3dc717e - remove local copy of hexdigits.
- sprinkle const
- use mem*() instead of b*()
2005-05-29 21:39:21 +00:00
christos
5e5ed54bfe remove stupid hand-rolled loop and kernel conditional. 2005-05-29 21:38:37 +00:00
yamt
f398966b60 tcp_output: account FIN when building sack option. 2005-05-08 04:52:05 +00:00
yamt
a448e5be5b tcp_output: don't try to send more data than we have. PR/30160. 2005-05-08 04:51:05 +00:00
yamt
0afea4b00f tcp_output: clear TH_FIN where appropriate. related to PR/30160. 2005-05-08 04:48:47 +00:00
yamt
b8690cc289 tcp_sack_option: ignore sack beyond snd_max. 2005-05-08 04:46:20 +00:00
christos
761bd09636 PR/30154: YAMAMOTO Takashi: tcp_close locking botch
chgsbsize() as mentioned in the PR can be called from an interrupt context
via tcp_close(). Avoid calling uid_find() in chgsbsize().
- Instead of storing so_uid in struct socketvar, store *so_uidinfo
- Add a simple lock to struct uidinfo.
2005-05-07 17:42:09 +00:00
matt
89ba134744 Add #include <sys/protosw.h> when _KERNEL 2005-05-06 04:28:37 +00:00
martti
840228057a Install netinet/ipl.h (bin/30095) 2005-05-01 14:57:27 +00:00
manu
e0d963d34b Fix memory leak 2005-04-29 13:06:23 +00:00
yamt
34c3fec469 move decl of inetsw to its own header to avoid array of incomplete type.
found by gcc4.  reported by Adam Ciarcinski.
2005-04-29 10:39:09 +00:00
manu
cddc307094 Fix build problem after recent NAT-T changes 2005-04-26 05:37:45 +00:00
manu
52786ce730 Don't sleep when handling ESP over UDP packets. 2005-04-25 20:37:06 +00:00
manu
455d55f55b Enhance IPSEC_NAT_T so that it can work with multiple machines behind the
same NAT.
2005-04-23 14:05:28 +00:00
yamt
23cd288d37 ip_output: handle the case M_CSUM_TSOv4 but !IFCAP_TSOv4. 2005-04-18 22:06:28 +00:00
yamt
fa67035590 add a function to handle M_CSUM_TSOv4 by software. 2005-04-18 21:55:06 +00:00
yamt
e5a2b5a4a4 fix problems related to loopback interface checksum omission. PR/29971.
- for ipv4, defer decision to ip layer as h/w checksum offloading does
  so that it can check the actual interface the packet is going to.
- for ipv6, disable it.
  (maybe will be revisited when it implements h/w checksum offloading.)

ok'ed by Jason Thorpe.
2005-04-18 21:50:25 +00:00
yamt
0b4d50d7bd when doing TSO, avoid to use duplicated ip_id heavily.
XXX ip_randomid
2005-04-07 12:22:47 +00:00
kurahone
f7707899c1 Added sysctl tunable limits for the number of maximum SACK holes
per connection and per system.

Idea taken from FreeBSD.
2005-04-05 01:07:17 +00:00
yamt
4b935040d0 tcp_input: update a comment to match with the code. 2005-04-03 05:02:46 +00:00
is
a0c9bc9616 Add IPv6 over GRE (contributed by Gert Doering in PR 29150). 2005-03-30 16:34:54 +00:00
yamt
73a5d8f913 s of sack is selective, not selection. pointed by Michael Eriksson. 2005-03-30 11:09:16 +00:00
yamt
8b0967ff45 protect tcpipqent with splvm. 2005-03-29 20:10:16 +00:00
yamt
c08e90ff51 tcp_output: lock reass queue when building sack. 2005-03-29 20:09:24 +00:00
yamt
2c742b20e6 ip_reass: clear stale csum_flags. 2005-03-29 09:37:08 +00:00
christos
3136f75efa defopt IPFILTER_DEFAULT_BLOCK 2005-03-26 18:08:42 +00:00
kurahone
0eb940bc75 TCP/SACK changes from FreeBSD.
Ignore the SACK option if
 * The packet is not an ACK.
 * The ACK is outside of snd_una -> snd_max
2005-03-18 21:25:09 +00:00
yamt
df05ca7085 simplify data receiver side sack processing.
- introduce t_segqlen, the number of segments in segq/timeq.
  the name is from freebsd.
- rather than maintaining a copy of sack blocks (rcv_sack_block[]),
  build it directly from the segment list when needed.
2005-03-16 00:39:56 +00:00
yamt
0446b7c3e3 - use full sized segments unless we actually have SACKs to send.
- avoid TSO duplicate D-SACK.
- send SACKs regardless of TF_ACKNOW.
- don't clear rcv_sack_num when transmitting.

discussed on tech-net@.
2005-03-16 00:38:27 +00:00
yamt
9482bc7356 don't try to use TSO to transmit a single segment.
- there's no benefit.
- rtl8169 seems to be stuck with it.
2005-03-12 07:53:08 +00:00
matt
7dfa1d8cf7 Set ip_len to 0 in the wm driver when TSO is being used. 2005-03-11 17:07:51 +00:00
atatat
5b8a6c916d Revert the change that made kern.file2 and net.*.*.pcblist into nodes
instead of structs.  It had other deleterious side-effects that are
rather nasty.  Another solution must be found.
2005-03-11 06:16:15 +00:00
thorpej
3901f760df In ip_fragment():
- Use the correct IP header length variable for other-than-first packets.
- Remove redundant setting of the original IP header length in the first
  packet's csum_data.  (It's already set before ip_fragment() is called
  in 1.147.)
2005-03-10 06:03:00 +00:00
atatat
d945605f5b Make this build without INET6 xor INET (hah!) again. 2005-03-10 05:49:14 +00:00
atatat
ca63da437a Change types of kern.file2 and net.*.*.pcblist to NODE 2005-03-10 05:43:25 +00:00
atatat
7c62c74d09 Add the following nodes to the sysctl tree:
net.local.stream.pcblist
	net.local.dgram.pcblist
	net.inet.tcp.pcblist
	net.inet.udp.pcblist
	net.inet.raw.pcblist
	net.inet6.tcp6.pcblist
	net.inet6.udp6.pcblist
	net.inet6.raw6.pcblist

which allow retrieval of the pcbs in use for those protocols.  The
struct involved is 32/64 bit clean and incorporates parts of struct
inpcb, struct unpcb, a bit of struct tcpcb, and two socket addresses.
2005-03-09 05:07:19 +00:00
atatat
76a9013c25 gc the tcp_sysctl() prototype since it's completely vestigial 2005-03-09 04:51:56 +00:00
simonb
e491fee6a5 s/quence/quench/. 2005-03-09 04:24:12 +00:00
simonb
3792275475 Add an extra `i' to notifes/notifed. 2005-03-09 04:23:33 +00:00
matt
47df382bfe Move all the hardware-assisted checksum/segment offload code together. 2005-03-09 03:39:27 +00:00
matt
ea3d151322 For AF_INET, always set m->m_pkthdr.csum_data. Don't or TSOv4, just set it. 2005-03-09 03:38:33 +00:00
yamt
a0f802e2ac tcp_sack_option: handle the case that the right-most sack'ed block is expanded.
a fix from Noritoshi Demizu (FreeBSD PR/78226) via Kentaro A. Kurahone.
2005-03-08 11:27:14 +00:00
yamt
e55b9169d1 tcp_sack_option: fix the cases that some sack blocks go into a hole. 2005-03-07 10:27:39 +00:00
yamt
ff614e1114 tcp_sack_option: fix a typo(?), which can cause to ignore valid blocks. 2005-03-07 09:40:35 +00:00
yamt
ed8b840f26 tcp_sack_option: the max number of sack blocks in a packet is 4, not 3. 2005-03-07 09:32:51 +00:00
yamt
e16a97f90b - unwrap short lines.
- remove unneeded parenthesis.
- whitespace.
2005-03-06 23:06:40 +00:00
yamt
fd5005e8d7 don't assume alignment of sack options. 2005-03-06 23:05:56 +00:00
yamt
1152380a6b wrap long lines. 2005-03-06 23:05:20 +00:00
yamt
2dc19239d5 update SYSCTL_DESCR; sack is implemented. 2005-03-06 10:15:30 +00:00
thorpej
1f89264732 Add a /*CONSTCOND*/ to last. 2005-03-06 03:41:36 +00:00
matt
c24b749deb Fix typo. Opposite of >= is <, not ==. 2005-03-06 00:52:25 +00:00
matt
9337b701be Replace some gotos with a do while (0) and breaks. No functional change. 2005-03-06 00:48:52 +00:00
matt
8e04817c50 Add IPv4/TCP hooks for TCP Segment Offload on transmit. 2005-03-06 00:35:07 +00:00
briggs
6fe1c07527 Fix checksum offload for fragmented packets. From John Heasley
on gnats-bugs in PR kern/29544.
Tested with an NFS client using default rwsize on an NFS server
with wm(4) interface configured IP4CSUM,TCP4CSUM,UDP4CSUM.
Prior revision required the server to have checksum offload disabled.
2005-03-05 02:46:38 +00:00
mycroft
5640dcbb4a Re-add callout_active(), in a way compatible with the FreeBSD version, and use
it in the TCP stack to test which of the REXMT or PERSIST timer is in use.
This fixes a race condition that could cause "panic: tcp_output REXMT".  See
tech-net for details.
2005-03-04 05:51:41 +00:00
mycroft
c9f058f65e Copyright maintenance. 2005-03-02 10:20:18 +00:00
jonathan
4ae1f36dc9 Commit TCP SACK patches from Kentaro A. Karahone's patch at:
http://www.sigusr1.org/~kurahone/tcp-sack-netbsd-02152005.diff.gz

Fixes in that patch for pre-existing TCP pcb initializations were already
committed to NetBSD-current, so are not included in this commit.

The SACK patch has been observed to correctly negotiate and respond,
to SACKs in wide-area traffic.

There are two indepenently-observed, as-yet-unresolved anomalies:
First, seeing unexplained delays between in fast retransmission
(potentially explainable by an 0.2sec RTT between adjacent
ethernet/wifi NICs); and second, peculiar and unepxlained TCP
retransmits observed over an ath0 card.

After discussion with several interested developers, I'm committing
this now, as-is, for more eyes to use and look over.  Current hypothesis
is that the anomalies above may in fact be due to link/level (hardware,
driver, HAL, firmware) abberations in the test setup, affecting  both
Kentaro's  wired-Ethernet NIC and in my two (different) WiFi NICs.
2005-02-28 16:20:59 +00:00
perry
f07677dd81 nuke trailing whitespace 2005-02-26 22:45:09 +00:00
peter
1c9b56c830 Add MKIPFILTER; if set to no, don't build and install the ipf(4) programs,
headers and LKM.

Add MKPF; if set to no, don't build and install the pf(4) programs,
headers, LKM and spamd.

Both options default to yes, so nothing changed in the default build.

Reviewed by lukem.
2005-02-22 14:39:58 +00:00
heas
0f8efdd552 My last change for pseudo-header checksums was flawed. The pseudo-header
checksum is always in the L4 header by the time we get to this point.  It
was occasionally not there due to a bug in tcp_respond, which has since
been fixed.
So, instead just stash the length of the L3 header in the high 16 bits of
csum_data.
2005-02-18 00:52:56 +00:00
briggs
da725d663a Initialize snd_high as part of tcp_sendseqinit().
From Kentaro A. Kurahone.
2005-02-16 15:00:47 +00:00
briggs
a825f3e77c Initialize t_partialacks in the tcpcb template.
From Kentaro A. Kurahone.
2005-02-16 14:59:40 +00:00
heas
2d4ced7c82 For controllers (eg: hme & gem) that can only perform linear hardware checksums
(from an offset to the end of the packet), the pseudo-header checksum must be
calculated by software.  So, provide it in the TCP/UDP header when
M_CSUM_NO_PSEUDOHDR is set in the interface's if_csum_flags_tx.

The start offset, the end of the IP header, is also provided in the high 16
bits of pkthdr.csum_data.  Such that the driver need not examine the packet
at all.

XXX At the request of Jonathan Stone, note that sharing of if_csum_flags_tx &
    pkthdr.csum_flags for checksum quirks should be re-evaluated.
2005-02-12 23:25:29 +00:00
manu
5c217c1a67 Add support for IPsec Network Address Translator traversal (NAT-T), as
described by RFC 3947 and 3948.
2005-02-12 12:31:07 +00:00
heas
52b0cd6b47 ntohs->htons for ip6 plen (payload length).
It is not technically necessary to set plen here, since ip6_output() starts
off by calculating it, but leaving it keeps it consistent with other code.
2005-02-12 01:24:07 +00:00
pk
237a0c2d85 Update tcp_trace() prototype to match implementation. 2005-02-06 20:13:09 +00:00
perry
b02c92c5bf ANSIfy function declarations 2005-02-03 23:50:33 +00:00
perry
870f206724 ANSIfy function declarations 2005-02-03 23:39:32 +00:00
perry
dcf288607c ANSIfy function declarations 2005-02-03 23:25:22 +00:00
perry
d5c8fcf31c ANSIfy function declarations 2005-02-03 23:13:20 +00:00
perry
71ef63c98f ANSIify function declarations 2005-02-03 23:08:43 +00:00
perry
402f8626b1 ANSIfy function declarations 2005-02-03 22:51:50 +00:00
perry
90789ef318 some ANSIfying, and remove an unsightly tab 2005-02-03 22:45:28 +00:00
perry
babe6a957c KNF + slightly ANSIfy 2005-02-03 22:43:34 +00:00
perry
51ad03a950 ANSIfy function prototypes. (Still have about 3/5ths of the C files in
netinet to go...)
2005-02-03 03:49:01 +00:00
perry
3494482345 de-__P -- will ANSIfy .c files later. 2005-02-02 21:41:55 +00:00
perry
695648ddc8 de-__P, do some ANSIfication. 2005-02-02 21:41:01 +00:00
he
1c9ef2aa0a Fix "unused local variable" warning/error if compiling without
bridge support by making variable declaration conditional.  Found
while compiling for shark.
2005-02-01 12:56:30 +00:00
kim
c9f56c04dc Add RFC 3378 EtherIP support, ported from OpenBSD to NetBSD by
Hans Rosenfeld (rosenfeld at grumpf.hope-2000.org)

This change makes it possible to add gif interfaces to bridges, which
will then send and receive IP protocol 97 packets. Packets are Ethernet
frames with an EtherIP header prepended.
2005-01-31 23:49:36 +00:00
mycroft
47759e6333 Several changes based on comparison with NS:
1) dupseg_fix_=true from NS: do not count a segment with completely duplicate
data as a duplicate ack.  This can occur due to duplicate packets in the
network, or due to fast retransmit from the other side.

2) dupack_reset_=false from NS: do not reset the duplicate ack counter or exit
fast recovery if we happen to get data or a window update along with a
duplicate ack.

3) In the "very old ack" case that itojun added, send an ACK before dropping
the segment, to try to update the other side's send sequence number.

4) Check the ssthresh crossover point with >= rather than >.  Otherwise we
start to do "exponential" growth immediately following recovery, where we
should be doing "linear".  This is what NS does.
2005-01-28 00:18:22 +00:00
mycroft
e236dc1c36 Whoops. Exit fast recovery when handling a timeout. 2005-01-27 18:45:41 +00:00
mycroft
746d109a3c There is no reason to adjust ts_recent_age for ts_timebase; it's strictly an
internal variable.
2005-01-27 17:14:04 +00:00
mycroft
470f2d0705 Do the other TCP_PAWS_IDLE check unsigned as well. It doesn't do us any harm,
and it could detect even older time stamps.  (Really, to be 100% correct, there
should be a timer that clears these out -- but it probably doesn't matter in
the real world.)
2005-01-27 17:10:07 +00:00
mycroft
42655f2a87 Also check whether an echoed RTT is very large -- this *could* cause the
smoothing function to overflow.  I use TCP_PAWS_IDLE (24 days) for this.
2005-01-27 16:56:06 +00:00
mycroft
7215a0b3f1 Introduce a new state variable, t_partialacks. It has 3 states:
* t_partialacks<0 means we are not in fast recovery.
* t_partialacks==0 means we are in fast recovery, but we have not received
  any partial acks yet.
* t_partialacks>0 means we are in fast recovery, and we have received
  partial acks.

This is used to implement 2 changes in RFC 3782:
* We keep the notion that we are in fast recovery separate from t_dupacks, so
  it is not reset due to out-of-order acks.  (This affects both the Reno and
  NewReno cases.)
* We only reset the retransmit timer on the first partial ack -- preventing us
  from possibly taking one RTO per segment once fast recovery is initiated.

As before, it is hard to measure any difference between Reno and NewReno in the
real-world cases that I've tested.
2005-01-27 03:39:36 +00:00
mycroft
5283ca74ad Fix two problems in our TCP stack:
1) If an echoed RFC 1323 time stamp appears to be later than the current time,
   ignore it and fall back to old-style RTT calculation.  This prevents ending
   up with a negative RTT and panicking later.

2) Fix NewReno.  This involves a few changes:

   a) Implement the send_high variable in RFC 2582.  Our implementation is
      subtly different; it is one *past* the last sequence number transmitted
      rather than being equal to it.  This simplifies some logic and makes
      the code smaller.  Additional logic was required to prevent sequence
      number wraparound problems; this is not mentioned in RFC 2582.

   b) Make sure we reset t_dupacks on new acks, but *not* on a partial ack.
      All of the new ack code is pushed out into tcp_newreno().  (Later this
      will probably be a pluggable function.)  Thus t_dupacks keeps track of
      whether we're in fast recovery all the time, with Reno or NewReno, which
      keeps some logic simpler.

   c) We do not need to update snd_recover when we're not in fast recovery.
      See tech-net for an explanation of this.

   d) In the gratuitous fast retransmit prevention case, do not send a packet.
      RFC 2582 specifically says that we should "do nothing".

   e) Do not inflate the congestion window on a partial ack.  (This is done by
      testing t_dupacks to see whether we're still in fast recovery.)

This brings the performance of NewReno back up to the same as Reno in a few
random test cases (e.g. transferring peer-to-peer over my wireless network).
I have not concocted a good test case for the behavior specific to NewReno.
2005-01-26 21:49:27 +00:00
matt
027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +00:00
enami
f1b6d58e81 To fix bad pointer dereference on start up when gif is used,
- Allow rn_init() to be called multiple times, but do nothing except the
  first call.
- Include opt_inet.h so that #ifdef INET works.
- Call rn_init() from encap_init() explicitly rather than depending on the
  order of initialization.
2005-01-24 04:46:49 +00:00
itojun
fd232dd798 get zero-cleared field on malloc. kame-pr-856 2005-01-24 02:42:49 +00:00
matt
d341be30f4 Change initialzie of domains to use link sets. Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.
2005-01-23 18:41:56 +00:00
manu
5ff6d3d572 Duplicate nested if statement in PIM code (from the OpenBSD tree) 2005-01-15 06:50:47 +00:00
drochner
aeae2d9c94 compile tcp_debug.c only if the TCP_DEBUG option is set,
and remove the "#ifdef TCP_DEBUG" around everything
2005-01-13 19:09:40 +00:00
heas
fe4b3cd078 In tcp_respond(), clear the m_pkthdr.csum_flags that was inherited from the
received packet so that the checksum is not performed twice.  Also,
tcp_respond() does not fill-in the m_pkthdr.csum_data, so a h/w checksum may
have the wrong offset.

OK from Jason Thorpe.
2005-01-03 19:47:30 +00:00
yamt
ffebedd625 factor out receive side tcp/udp checksum handling code so that they
can be used by eg. packet filters.

reviewed by Christos Zoulas on tech-net@.
(slightly tweaked since then to make tcp and udp similar.)
2004-12-21 05:51:31 +00:00
christos
77e7bdb8aa yamt's changes seem to fix all the checksumming issues. Turn the loopback
checksums back off so we can make sure that everything works.
2004-12-19 06:42:24 +00:00
yamt
ea04ddb694 udp6_input: correct loopback test. 2004-12-18 15:31:26 +00:00
yamt
6e353db6e4 tcp_input: add missing loopback checksum omission code for ipv6. 2004-12-18 07:30:17 +00:00
christos
60fb5c0ece Turn checksumming on loopback back on until we fix the bugs in it.
Connect over tcp on the loopback is broken:

  4729 amq      0.000007 CALL  connect(4,0x804f2a0,0x1c)
  4729 amq      75.007420 RET   connect -1 errno 60 Connection timed out
2004-12-17 22:54:52 +00:00
thorpej
7994b6f95e Don't perform checksums on loopback interfaces. They can be reenabled with
the net.inet.*.do_loopback_cksum sysctl.

Approved by: groo
2004-12-15 04:25:19 +00:00
yamt
e745dd4766 remove TCPOPT_MD5SIGNATURE because no one in our tree uses it
and it's duplicated with TCPOPT_SIGNATURE.
i preferred TCPOPT_SIGNATURE because it's used by FreeBSD and OpenBSD.
2004-12-07 14:24:04 +00:00
peter
396b87b8c2 Convert lo(4) to a clonable device.
This also removes the loif array and changes all code to use the new
lo0ifp pointer which points to the lo0 ifnet structure.

Approved by christos.
2004-12-04 16:10:25 +00:00
christos
1ad35fcc9a PR/25749: Peter Postma: missing splx() in kernel. 2004-11-13 19:17:50 +00:00
thorpej
402ff2cf29 Slight simplification to IFA_STATS handling. 2004-10-06 05:42:24 +00:00
darrenr
0543239818 Add a comment to document what setting "srcrt" is really on about in ipintr() 2004-10-06 01:34:11 +00:00
yamt
2c46ccce37 move netinet/ip_lookup.h -> dist/ipf/netinet/ip_lookup.h. 2004-10-05 04:56:41 +00:00
yamt
8484dd9eed move ipf headers and add a comment. 2004-10-05 04:55:48 +00:00
jdolecek
46134b3da6 move ip_htable.h from sys/netinet/ to sys/dist/ipf/netinet/, it's ipfilter file 2004-10-02 07:59:14 +00:00
christos
722688d056 These are ipfilter files, although they don't have the same copyright.
Thanks jaromir.
2004-10-02 07:51:11 +00:00
christos
5976437e5f Move ipf to sys/dist/ipf; Note that I followed the pattern used for pf.
I think though that the files.ipfilter and Makefile glue should go to
the dist directory, not like it is done now.
2004-10-01 15:24:45 +00:00
christos
1b492809a0 PR/27082: Sean Boudreau: redundant assignment or NULL dereference in
in_pcbconnect()
2004-09-29 21:30:00 +00:00
christos
d790aa42d0 PR/27081: Sean Boudreau: ip_input() bad csum count not incremented on sw csum 2004-09-29 21:28:34 +00:00