Commit Graph

124 Commits

Author SHA1 Message Date
john hood 5bc1c6c032 include-once -impl files 2016-05-14 02:58:07 -04:00
John Hood 882539884e Remove unnecessary usage of #include <iostream>. Rename templated impls from .cc to -impl.h. 2016-05-14 00:10:59 -04:00
John Hood dfdfa5d9b0 FreeBSD TOS issues 2016-05-14 00:05:41 -04:00
John Hood 7af87d85cc Remove redundant stringification for decrypt(). 2016-03-30 23:52:19 -04:00
John Hood c964d40dd8 Do not throw from destructors, fatal_assert() instead. 2016-03-30 23:52:19 -04:00
John Hood 255dc39c9f Factor encrypt/decrypt out of Network::Message. 2016-03-30 23:52:19 -04:00
John Hood 6abd4739de Const correctness and const-ref in Crypto and elsewhere. 2016-03-30 23:52:19 -04:00
John Hood 13928e9c10 Use a secure counter for OCB's nonce. Protect nonce in Network::Packet. 2016-03-30 23:52:19 -04:00
John Hood 60e3d380b8 Fix Cygwin compile warning. 2016-01-16 12:56:39 -05:00
John Hood e0f6eb78ef Improve roundtrip verification tests and debug dump.
Add another round-trip verification.  For both original and generated
state, generate a diff from an initial, empty state.  Verify that
these two diffs are the same.
2015-12-06 17:42:34 -05:00
John Hood 0b51260540 Fix for UTF-8 roundtrip verification bug.
The problem was that the round-trip verification code copies the
current state, which may contain intermediate Parser state for
multibyte characters and ANSI escape sequences.  It then applies diffs
to that copy, which may appear as badly formed input.

Also removes some dead, never-used code.
2015-12-06 17:42:34 -05:00
John Hood 3fa42cb8bb Support different IPv4 and IPv6 MTUs.
Closes #688.
2015-11-29 10:31:17 -05:00
John Hood 310b899a23 Support older getaddrinfo() missing AI_NUMERICSERV
Define this flag as 0 if unavailable.
This is needed for my OS X 10.5 system.

Signed-off-by: John Hood <cgull@glup.org>
2015-06-21 16:14:41 -04:00
John Hood 026a3f0346 Resolve cppcheck issues.
Signed-off-by: John Hood <cgull@glup.org>
2015-06-10 23:50:56 -04:00
Geoffrey Thomas aeffb71cfc Style cleanup: "foo &x", not "foo& x" 2015-06-04 23:47:32 -04:00
Geoffrey Thomas 5721b392ab Make all exception classes inherit from std::exception
This refactors out a very common pattern of formatting "%s: %s" with
e.function.c_str() and strerror( e.the_errno ) into just the what()
method of NetworkException. It's also a prerequisite for making cleaner
public API for any exceptions we throw, and allows us to more easily
get exceptions passed back to us to handle.
2015-06-04 23:47:31 -04:00
Anders Kaseorg 7c942e6836 Connection::try_bind: Pass port argument 0 as a string
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-01-04 04:31:30 -05:00
Anders Kaseorg b39da20edc AddrInfo: Fix error message generation when node == NULL
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-01-04 04:31:30 -05:00
Anders Kaseorg 5532117984 Revert "Fix mosh-server segfault on startup when run without arguments"
This reverts commit 578db45fbf.

The NULL inputs to getaddrinfo are valid in certain cases, and at
least in the case of node, important.  The segfault happens not with
getaddrinfo, but with the error message generation below it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-01-04 04:31:02 -05:00
Keith Winstein 578db45fbf Fix mosh-server segfault on startup when run without arguments 2014-01-04 03:08:57 -05:00
Keith Winstein 27678941d4 network.cc: Properly close old fd on Socket assignment operator
Fix thanks to Igor Bukanov. Closes #470.
2014-01-04 02:51:37 -05:00
Anders Kaseorg 553918d3f2 Connection: Support IPv6 addresses
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 09:02:44 -04:00
Anders Kaseorg 110cce3773 Connection: Move socket creation out of setup
Once we support IPv6, we won’t be able to create a socket until we
know which address family to use.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 08:58:16 -04:00
Anders Kaseorg c1f96b37a1 Connection: Store the port number as a string
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-08-17 08:26:30 -04:00
Keith Winstein 1bd38e6dab Include sys/uio.h to fix OpenBSD build problem (closes #391) 2013-03-10 16:58:16 -04:00
Keith Winstein 770e4208cc DiffServ codepoint and ECN: Roll back to just ECT (no DSCP) 2013-03-10 16:41:44 -04:00
Anders Kaseorg 866e1399d5 Socket::operator=: Return non-const reference
Found by cppcheck.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-03-10 15:48:08 -04:00
Anders Kaseorg 5365d6b21d Connection::recv: Rethrow the original exception instead of a copy
Found by cppcheck.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2013-03-10 15:48:08 -04:00
Keith Winstein 2dcef54e24 Allow new states slowly even when queue full (fixes Axel Beckert lockup) 2013-01-15 02:03:35 -05:00
Anton Lundin 99dc1f93cf Use MSG_NONBLOCK when MSG_DONTWAIT doesn't exist 2012-12-01 14:49:29 +01:00
Keith Winstein 486325e76b mosh-server: Fix bug where spins forever if process dies while disconnected 2012-11-26 02:14:48 -05:00
Keith Winstein 6a16eecce0 Use dup() instead of move semantics for Network::Socket 2012-11-23 13:31:23 -05:00
Luke Mewburn 141ec239da Support port range as -p/--port PORT[:HIGHPORT].
Extend mosh and mosh-server to support parsing a high port from
the desired_port argument.  The first (low) port must not be
greater than the second (high) port.
If only one value is provided, behaviour is as before; bind
to one port.  Also tweak the formatting in mosh-server(1) synopsis
to be consistent.

This resolves mosh issue # 296.

Signed-off-by: Luke Mewburn <luke@mewburn.net>
2012-10-29 14:59:28 -04:00
Keith Winstein b99da057bb Back out use of ip.h IPTOS_DSCP_AF42 constant (missing on OS X) 2012-10-22 10:50:28 -04:00
Keith Winstein c53a174d0c Revert "Check for netinet/ip.h (now that we are using it), and don't also use in.h"
This reverts commit 0909ea55d6.
2012-10-22 10:50:07 -04:00
Keith Winstein 0909ea55d6 Check for netinet/ip.h (now that we are using it), and don't also use in.h 2012-10-22 10:34:16 -04:00
olgeni 2e39dbc977 Fix calls to setsockopt.
On FreeBSD, the socket option length must be declared as an int.

While I'm here, translate dscp (0x92) to the appropriate constants.

(tested on FreeBSD only so far)
2012-10-22 14:29:39 +02:00
Keith Winstein 39276a46ad More conservative default MTU, and react to MSGSIZE 2012-10-16 17:46:05 -04:00
Keith Winstein be3b1259b6 Make sendto() non-blocking 2012-10-16 17:40:02 -04:00
Keith Winstein 052e7cc812 Change assert() to fatal_assert() since can be triggered by evil sender 2012-10-05 04:14:49 -04:00
Ira Cooper deecf6bb2f Add limits.h to allow for illumos to compile.
Closes #331
2012-10-05 04:02:11 -04:00
Keith Winstein c0092a6e7e Hop new ports, but keep the old [for a minute, and up to 10 at a time]
(One is silver and the other gold...)
2012-10-05 02:51:25 -04:00
Keith Winstein b8df3eed11 Lengthen port hop interval to 30 seconds 2012-10-04 23:46:08 -04:00
Keith Winstein 9eb9a0386e Warn on congestion 2012-10-04 21:47:58 -04:00
Keith Winstein 9cf411ac3f Change server association timeout to 40 seconds 2012-10-04 21:45:42 -04:00
Keith Winstein 9ac3b65090 Respond to explicit congestion notification (slow down sender) 2012-09-28 19:07:31 -04:00
Keith Winstein 815aff9a73 Don't assert has_remote_addr, because can change between fragments. 2012-08-15 23:58:21 +03:00
Keith Winstein 5376ed1996 Use end-to-end-to-end connectivity (in transport layer) to control port hop.
Avoid playing games with network-layer timestamps.
2012-08-13 16:48:25 +03:00
Keith Winstein a21fed3dca Remove automatic hopping triggers from SSP. 2012-08-13 14:59:20 +03:00
Keith Winstein 82830344ca Hop ports when missing E2E2E connectivity, even if downlink working. 2012-08-13 14:26:53 +03:00