Commit Graph

58 Commits

Author SHA1 Message Date
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
Anton Lundin 99dc1f93cf Use MSG_NONBLOCK when MSG_DONTWAIT doesn't exist 2012-12-01 14:49:29 +01: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 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 9eb9a0386e Warn on congestion 2012-10-04 21:47:58 -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
Keith Winstein 89da6105aa When not connected, (1) client hops port numbers (2) server stops sending. 2012-08-13 11:19:25 +03:00
Timo Sirainen 620152261e Don't use s_addr as parameter name. Fixes compiling with Solaris.
Signed-off-by: Timo Sirainen <tss@iki.fi>
2012-08-11 17:14:44 -04:00
Keith Winstein a744004bf6 Get system timestamp less often (only after sleeping/selecting) 2012-07-26 21:13:26 -04:00
Keith Winstein 92ecb99b71 Add OpenSSL licensing exception 2012-07-20 16:46:00 -04:00
Alexander Chernyakhovsky 0099f080ad Fix FTBFS on ARM on GCC 4.7.0
GCC v4.7.0, as found in Fedora 17 and newer, fails to build mosh on
ARM because of a narrowing warning, which is then promoted to an error
by -Werror.  This error message is new, and did not occur under
previous versions of GCC.

This patch corrects this error by explicitly casting to the desired
datatype the return value of the offending code, the result of a macro
from glibc to implement htobe16().
2012-06-20 01:24:08 -04:00
Keith Winstein 88bed3e94a Remove warning for IP_TOS failure 2012-06-12 14:39:36 -04:00
Keith Winstein 37f78d0e4c Disable out-of-order warning (fires too much on some 802.11n networks)
This reverts commit 682bbdfebd.
2012-05-30 02:04:32 -04:00
Keith Winstein ade0aaa3e8 Make IP_TOS failure non-fatal per Keegan. 2012-05-25 21:00:51 -04:00
Dave Taht 72e6c85e3d Set diffserv values to AF42 + ECT
AF42 has both the properties of CS42 and the IMM bit.

Whether this has the advantages or disadvantages of just one or
the other, I don't know. With most mac80211 stacks this will
force mosh packets in the VI queue on wireless.

As for pfifo_fast, have to look it up...
2012-05-25 20:40:49 -04:00
Keith Winstein 682bbdfebd Warn on out-of-order or duplicated packets (or missing nonce increment!) 2012-05-23 18:08:31 -04:00
Keegan McAllister 67a85eaf99 Deliver sendto() exceptions without disturbing control flow
This prevents the client from waking up every 200 ms while the network is down.
Addresses #243.
2012-05-09 14:19:46 -04:00
Massimo Gengarelli 49fc21c8a3 Catch by const reference (remove Eclipse warnings)
(closes #245)
2012-04-29 02:24:31 -04:00
Keith Winstein 22e7cf60d3 Keep aligned buffers around, instead of allocing on each packet
Fixes #238 github issue.
Also fixes armel "Bad alignment" problem.
2012-04-24 18:40:01 -04:00
Keith Winstein 99e8626a01 Tidy check for exception in Network::Connection::send(). 2012-04-15 23:29:05 -04:00
Keith Winstein aca69ef684 Server does not need to raise exception on failed sendto(). Fixes #183. 2012-04-15 23:13:58 -04:00
Keith Winstein 7be90ae244 Close server-related file descriptors before executing child process
Closes #170 github issue.
2012-04-13 13:48:56 -04:00
Alexander Chernyakhovsky 87d57c9567 Add unistd.h to network.cc to allow mosh to build on Fedora Rawhide (future Fedora 18) 2012-03-26 18:46:52 -04:00
Keith Winstein 66c6c0669a Print pre-CONNECT output only on failure 2012-03-10 03:55:25 -05:00
Keith Winstein df3eec1397 Allow explicit UDP port option, confine ports to range 60000..61000 2012-03-10 03:34:47 -05:00
Quentin Smith a1671bcf3b Handle the absence of IP_MTU_DISCOVER 2012-03-07 03:05:36 -05:00