355 Commits
Author SHA1 Message Date
Steven Noonan e52bc12d38 attempting build fix for non-x86 ubuntu:rolling
This might not work, but I can't test it locally (who actually has
ppc64le and s390x hardware, anyway?)

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-02-27 16:38:43 -08:00
Fletcher Dunn 2d2001f796 Fix SteamNetworkingIPAdd flat inteface.
Fixes issue #100.
2020-02-27 08:50:46 -08:00
Fletcher Dunn 9ba30bd6b0 Sync up flat interface with Steamworks SDK 1.48 2020-02-24 14:43:28 -08:00
Fletcher Dunn c1df31b4f2 Another try to fix libsodium.
Maaaaaybe I should actually get setup to build it for realz, so I am not
submitting fixes blind?

Nah.
2020-02-06 10:59:26 -08:00
Fletcher Dunn df44ad7cb6 Fix libsodium compile.
I think.
2020-02-05 11:58:31 -08:00
Fletcher Dunn 0307add013 Move 25519 crypto to a separate header.
Getting things closer to how they are organized in the Steam main branch
so I can stop having these files diverge so much.

Also tweaked defines.
2020-02-04 16:28:53 -08:00
Fletcher Dunn 66e2a6599f Promote some stuff from crypto.h to crypto_constants.h
Getting synced up with Steam main branch.
2020-02-04 15:57:04 -08:00
Fletcher Dunn 97079a44d6 Always use CSteamNetworkListenSocketBase::Destroy().
And hide destructor so it cannot be called directly.
2020-02-04 15:43:25 -08:00
Damiano dcf33ffa7f Fixing compilation under Mingw32
Reorder preprocessor directives fixing compilation under mingw-32.
2020-02-03 10:07:27 -08:00
Andrew Simpson b2ae48a260 implement libsodium support
- Added support for using libsodium for encryption rather than OpenSSL
 - Removed AES-GCM tests with keys shorter than 256; libsodium only supports 256
 - Added a build with libsodium to the CI matrix

Signed-off-by: Andrew Simpson <andy@aiusepsi.co.uk>

steven@ edited and rebased:

 - integrated with new USE_CRYPTO/USE_CRYPTO25519 options in CMake/meson
 - separated using libsodium for ed25519/curve25519 and AES/SHA256.
 - ensured libsodium simple crypto tests run on all builders instead of
   a single isolated builder.
 - prevented building with -DUSE_CRYPTO=libsodium for non-x86 hardware,
   as libsodium's AES implementation depends on AES-NI. it is still
   possible to configure with -DUSE_CRYPTO25519=libsodium on arbitrary
   hardware targets.

Fixes #88.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-21 05:02:07 -08:00
Steven Noonan 0bec7735de crypto_25519_donna: don't use sse2 on foreign architectures
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-21 02:55:20 -08:00
Steven Noonan 943c26c32b ed25519/curve25519: only build SSE2 variants on x86
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-21 02:43:20 -08:00
Steven Noonan ae735b094a meson: add -Duse_crypto and -Duse_crypto25519 options
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-21 01:44:08 -08:00
Steven Noonan b445a0d02d CMake: add -DUSE_CRYPTO and -DUSE_CRYPTO25519 options
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-21 01:41:33 -08:00
Fletcher Dunn c5721e15a9 More strict parsing of identities.
- We no longer return true when paring the string "invalid".  Yes, technically
  we *parsed* successfully.  However, most callers would not consider parsing
  the invalid identity a success for their puspose, they assume that if true
  is returned, we have a real identity of some kind.  (But perhaps one that is
  the "unknown" kind.)  This was true of all existing call sites.  So this
  was basicaly a bug trap and/or security issue.  If a new caller wants to
  handle the string "invalid", they can do it themselves.
- Assume that the relay is running the latest protocol, so treat an unknown
  prefix as failure / invalid.  Do not try to continue.  This doesn't impact
  this opensource code, since the relay is not currently open source.
2020-01-09 16:21:44 -08:00
Fletcher Dunn 6cf53780a1 Fix bug formating GenericBytes identities.
It's amazing the bugs that can be found once code actually gets executed.

This used to work.  It broke when I changed the prefix text and forgot to
update the hardcoded literals.  [Insert comment here about the evils of
using hadrcoded literals. Yes yes.]
2020-01-09 10:54:07 -08:00
Fletcher Dunn 970f0e09a3 Use STL mutex for VS2017.
A partner reports that it is sane now.
2020-01-09 10:54:07 -08:00
Steven Noonan 6ff97b8d13 snp: more endianness fixes in ACK blocks
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 12:19:01 -08:00
Fletcher Dunn d168400090 Tweak hack for protobuf deprecation of ByteSize() 2020-01-08 11:46:51 -08:00
Steven Noonan 7894516320 snp: fix ack encoding endianness
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 11:13:08 -08:00
Steven Noonan 1c57d78fb2 snp: ensure CalcTimeUntilNextSend components are all floats
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 11:13:08 -08:00
Fletcher Dunn dcaa249bfe Fix windows compile 2020-01-08 11:07:03 -08:00
Steven Noonan 8b3333c08f dbg.cpp: disable valgrind header on s390x
It still fails to compile with Clang on s390x, even after updating the
header:

    https://travis-ci.org/tycho/GameNetworkingSockets/jobs/634128048

For now we can just disable it. We aren't making extensive use of the
valgrind header anyway, except to detect whether we're running under
a debugger.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 01:03:32 -08:00
Steven Noonan 4fc27a7ade valgrind.h: update from latest public Valgrind release
The current version we have breaks on s390x, and this looks like it may
fix it.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 01:03:32 -08:00
Steven Noonan 998904b34c minbase_endian: drop unused load/store macros
They cause compile errors on s390x for example, because the
__storewordbytereverse and friends don't exist there. But since we
aren't using any of these it's pointless.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 01:03:31 -08:00
Steven Noonan 2f26f66d56 minbase_macros: stomp stupid -Werror=empty-body on ARM64
And possibly others -- we just want to ensure that the semicolon after
DebuggerBreak() doesn't seem superfluous to the compiler. Ugh.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-08 01:03:31 -08:00
Andrew Simpson 97035a622b protobuf: eliminate deprecation warning breaking Fedora rawhide builds
- Abstracted difference between ByteSize() and ByteSizeLong() to use only
  the non-deprecated version where available.

- Remove check which disables C++ static_assert() on macOS; pretty sure
  it is supported in Apple Clang these days

Signed-off-by: Andrew Simpson <andy@aiusepsi.co.uk>
2020-01-07 23:42:55 -08:00
Steven Noonan 5d5880c530 common_bcrypt: normalize case for bcrypt.h include
Windows isn't case-sensitive but Linux is, and the MinGW distributions
use a lower-case filename.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-01-07 23:42:54 -08:00
Fletcher Dunn e18d08d733 Fixes for P2P connections with custom signaling.
Most of the important stuff is in files that are not part of the opensource
distribution, unfortunately.  There were some bugs where the destructor was
declared public in a derived class, which made it possible to use operator
delete directly.

Also fixed some comments.
2020-01-07 16:27:27 -08:00
helloer 9a66b776dc Update flat interface
Added wrappers for new group poll interface and removed SteamAPI_SteamNetworkingIdentity_Hash which was a leftover
2019-12-19 13:46:33 +01:00
Eddie James 35f69763a1 Fix hashmap index removal for sockets and poll groups
Remove() takes a key to lookup and remove. Since we already have the
index when removing entries from the map of sockets and poll groups,
RemoveAt() is the appropriate function.
2019-12-14 14:39:43 -06:00
Fletcher Dunn a9e5e86b28 Added "poll group" interface.
This is used to poll many connections in a single function call.  Previously,
this was only possible if all of the connections were those accepted on the
same listen socket.  (ReceiveMessagesOnListenSocket).  But this left out at
least two important use cases with known users:

- If you create more than one listen socket (because there is more way to
  contact your service, e.g. once for P2P and another for direct IP, and
  another for relayed connections), then you could not poll all of the
  connections efficiently.
- In P2P use cases, we may initiate many connections to peers, and we want
  to poll all of them at once.

This change is relevant to: Issue #49, Issue #50, and issue #52.  (But I don't
this it really "fixes" any of them.)
2019-12-05 15:51:33 -08:00
Fletcher Dunn 8fcfe152eb Added simple tools to measure perf impact of global lock. 2019-12-05 15:33:17 -08:00
Fletcher Dunn 50319cba63 Refactor ping stats.
A bunch of stuff was only used for SDR connections, so I moved that to the
SDR-specific files.
2019-12-05 15:18:57 -08:00
Fletcher Dunn 6ce738fcfd Added the concept of "dev" config values.
This is to try to limit what is exposed in a naive generic interface to allow
users to adjust config values, in a way that doesn't allow the user to break
the security in a trivial way.
2019-12-05 15:16:23 -08:00
Fletcher Dunn 9f32f3577e Rate limit some spew 2019-12-05 15:15:23 -08:00
Fletcher Dunn 5a8cc00915 Try to handle IThinker bugs more gracefully.
Don't go into an infinite loop, but complain loudly and hopefully in a way
that provides enough information to identify the problem.
2019-12-05 15:14:09 -08:00
Fletcher Dunn 9b328e2f70 Make SteamDatagramTransportLock::OnLocked private. 2019-12-05 15:13:29 -08:00
Fletcher Dunn 731c44b056 Switch fancy lambda to old school macro.
So that any asserts will get a real line number.
2019-12-05 15:11:39 -08:00
Fletcher Dunn bd53c178a7 Swicth JSON parser provider to picojson.
No more C++ exceptions!
(We aren't even compiling this tool in the opensource code.)
2019-12-05 15:10:15 -08:00
Fletcher Dunn 3db4fab456 Compiler warning. 2019-12-05 15:07:33 -08:00
Fletcher Dunn 7125be2f55 Fix compiler warnings.
They only happen when compiling in the steam codebase.
2019-10-04 17:18:41 -07:00
Fletcher Dunn 827d267dd7 IP_AllowWithoutAuth can be set at listen socket creation time. 2019-10-04 17:17:44 -07:00
Fletcher Dunn b7180e2dbf Simplify IThinker system.
After reviewing all existing use cases, I realized that all of them were
tolerant of being woken up earlier instead of late, and that all of the
complexity I was doing with tracking earliest and latest allowed wake up
times was not really getting anything.  Furthermore, the way the code was
written, forcing everybody to accept a 1ms late slack had the effect of
almost *always* waking up 1ms late, even if we could have woken up at the
right time.

So now each thinker just has a target wake up time, and we will not call
them before that, but we will call them as soon as possible after that.

I suspect that I could make this a lot better by using waitable timers
on Windows and the timerfd functions on linux.  I'd need a solution for
other POSIX systems, though.
2019-09-30 11:56:51 -07:00
Steven Noonan 4a930cad76 use std::atomic for s_nLowLevelSupportRefCount
This fixes a ThreadSanitizer complaint from the ubuntu-devel docker
builder.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-09-26 19:34:11 -07:00
Fletcher Dunn a33953c155 Add k_nSteamNetworkingSend_UseCurrentThread.
This improved latency in the remote play Streaming client, due to the way
we are polling.
2019-09-26 15:31:40 -07:00
Fletcher Dunn 2beeb2f3c2 Give transports a chance to react to state changes.
This is another bug introduced when I split up connection and transport objects.
2019-09-25 16:56:03 -07:00
Fletcher Dunn 0e988ec0fe Fix bugs with loopback connections. 2019-09-25 15:29:19 -07:00
Fletcher Dunn 419b9ba284 Fix bug waiting longer than caller requested.
This was a problem for manual polling mode.

Also for "normal" mode, where there is a service thread, increase the timeout.
We should never depend on this timeout to avoid any bad performance or solve
race conditions.  We should explicitly wake up the trhead when needed.  So if
we have a bug, we want it to stall for a long time, and cause people to ask
questions and investigate.
2019-09-24 13:44:03 -07:00
Fletcher Dunn 2a7577cb60 Enable dynamic toggleing of manual poll mode. 2019-09-24 12:06:02 -07:00