Commit graph

23 commits

Author SHA1 Message Date
Jeremy Leconte
1bd331f102 Ensure <netinet/in.h> is included by using rtc_base/ip_address.h.
Change-Id: I1b48275ef458bcd579d027b879240c702975ab56
Bug: b/236227627
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362280
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#43001}
2024-09-11 08:11:44 +00:00
Philipp Hancke
2cfedb277a Remove vestiges of GTURN
and update some usage to use the "correct" stun attribute names

BUG=webrtc:42229250

Change-Id: If0c34d1d9b399766d7073661ea2a5515100256a5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359440
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42810}
2024-08-19 16:05:37 +00:00
Dor Hen
ec5a968070 Apply include-cleaner to api/transport
Bug: webrtc:42226242
Change-Id: I41fe8dcb2f68b1f05c70058fee527f4cae67c51b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358502
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Dor Hen <dorhen@meta.com>
Cr-Commit-Position: refs/heads/main@{#42742}
2024-08-07 16:09:45 +00:00
Harald Alvestrand
502afbf510 Change StunByteStringAttribute to have uint8_t* internal type
Also make it more convenient to use uint8_t array view for
interfacing to the class.

Bug: webrtc:15665
Change-Id: Ib671b5add79a48004133a6ecd99429534f7de1de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328140
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41212}
2023-11-22 13:18:26 +00:00
Harald Alvestrand
572502c2ab Deprecate char* functions on ByteBufferReader
Bug: webrtc:15661, webrtc:15665
Change-Id: Ia35b0092c219a89b5eba08d2e1a91be6e47dc746
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328000
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41210}
2023-11-22 11:46:25 +00:00
Harald Alvestrand
47627626dd STUN: Avoid ICE message revalidation wherever possible.
Also call out the places where it happens explicitly - these are places
that need to be redesigned.

Bug: chromium:1177125
Change-Id: I3237d028dbb22380e8fbf7cedb03e965d1fcf2aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279022
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38384}
2022-10-13 10:55:31 +00:00
Harald Alvestrand
ac7577854f Reland "Add test for StunMessage::ValidateMessageIntegrity"
This reverts commit 3d992bf47f.

Reason for revert: Added counter reset at the right place.

Original change's description:
> Revert "Add test for StunMessage::ValidateMessageIntegrity"
>
> This reverts commit 1f4f672687.
>
> Reason for revert: Breaks downstream test.
>
> Original change's description:
> > Add test for StunMessage::ValidateMessageIntegrity
> >
> > This also tests the UMA stats newly added to it.
> >
> > Bug: chromium:1177125
> > Change-Id: I89bb17c1897565cd91ea5bbd92062018317738ca
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278600
> > Reviewed-by: Johannes Kron <kron@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#38345}
>
> Bug: chromium:1177125
> Change-Id: I2490f2f740db8282ab293583013a50d03ead9141
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278801
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38349}

Bug: chromium:1177125
Change-Id: I38212aeff3a366d4b8beb9c822f709b9fcbb7146
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278802
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38353}
2022-10-11 13:15:40 +00:00
Mirko Bonadei
3d992bf47f Revert "Add test for StunMessage::ValidateMessageIntegrity"
This reverts commit 1f4f672687.

Reason for revert: Breaks downstream test.

Original change's description:
> Add test for StunMessage::ValidateMessageIntegrity
>
> This also tests the UMA stats newly added to it.
>
> Bug: chromium:1177125
> Change-Id: I89bb17c1897565cd91ea5bbd92062018317738ca
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278600
> Reviewed-by: Johannes Kron <kron@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38345}

Bug: chromium:1177125
Change-Id: I2490f2f740db8282ab293583013a50d03ead9141
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278801
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38349}
2022-10-11 11:49:01 +00:00
Harald Alvestrand
1f4f672687 Add test for StunMessage::ValidateMessageIntegrity
This also tests the UMA stats newly added to it.

Bug: chromium:1177125
Change-Id: I89bb17c1897565cd91ea5bbd92062018317738ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278600
Reviewed-by: Johannes Kron <kron@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38345}
2022-10-11 09:27:40 +00:00
Tommi
e83500e17b [Connection] Construct ping/connection requests in one step.
This moves the construction of StunMessage instances for
ConnectionRequest, outside of the Prepare() method.

Following this, removing Construct()+Prepare() is relatively
straight forward.

Bug: none
Change-Id: Ibcf0510cef30a6e648005b43602c7ae1fb06729e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264558
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37122}
2022-06-03 20:04:24 +00:00
Tommi
408143d5af Refactor StunMessage a bit
* Add ctors for providing the type and transaction id at construction.
* Update tests to use them instead of SetType+SetTransactionID
* Make sure stun message enum types are based on uint16_t
* Mark SetTransactionID as deprecated.
* Mark SetStunMagicCookie as deprecated (unused in webrtc).
* Add SetTransactionIdForTest for the one test that uses it (might not
  actually need it)
* Make StunRequest::Construct() protected.
  * Add a TODO to follow up on this since construction of StunRequest
    goes through an unnecessarily complex 3-step process involving
    other classes and a virtual method.

Bug: none
Change-Id: Ib013e58f28e7b2b4fcb3b3e1034da31dfc93e9d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264546
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37079}
2022-06-01 17:43:55 +00:00
Philipp Hancke
08a6e35848 Reland "Revert "Reland "remove stun origin support"""
This reverts commit 3b18208f13
and is the third attempt at removing stun origin support

Bug: webrtc:12132
Change-Id: Ic41a6d011fb6239907a257cc4c81ec4d2923dc4e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236260
Reviewed-by: Taylor Brandstetter <deadbeef@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35294}
2021-11-02 09:53:11 +00:00
Taylor Brandstetter
3b18208f13 Revert "Reland "remove stun origin support""
This reverts commit 11a89c99e9.

Reason for revert: Breaks downstream code which is using the TurnPort constructor.

Original change's description:
> Reland "remove stun origin support"
>
> This is a reland of ba29ce320f
> readding the origin to the CreateRelayPortArgs structure to not break
> downstream tests yet:
>   https://webrtc-review.googlesource.com/c/src/+/235300/1..2
>
> Original change's description:
> > remove stun origin support
> >
> > Bug: webrtc:12132
> > Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35202}
>
> Bug: webrtc:12132
> Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35220}

TBR=deadbeef@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com,philipp.hancke@googlemail.com

Change-Id: If16cedb8ccba22d83c919f64f7234873ba859a75
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:12132
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235346
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35221}
2021-10-15 21:27:48 +00:00
Philipp Hancke
11a89c99e9 Reland "remove stun origin support"
This is a reland of ba29ce320f
readding the origin to the CreateRelayPortArgs structure to not break
downstream tests yet:
  https://webrtc-review.googlesource.com/c/src/+/235300/1..2

Original change's description:
> remove stun origin support
>
> Bug: webrtc:12132
> Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35202}

Bug: webrtc:12132
Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35220}
2021-10-15 19:46:24 +00:00
Artem Titov
41205b3c4d Revert "remove stun origin support"
This reverts commit ba29ce320f.

Reason for revert: Breaks downstream projects

Original change's description:
> remove stun origin support
>
> Bug: webrtc:12132
> Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35202}

TBR=deadbeef@webrtc.org,hta@webrtc.org,philipp.hancke@googlemail.com,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5f3a7a15c7da8e752569683bfeac91f2160a4f55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:12132
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235241
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35209}
2021-10-14 15:08:28 +00:00
Philipp Hancke
ba29ce320f remove stun origin support
Bug: webrtc:12132
Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35202}
2021-10-14 11:27:46 +00:00
Harald Alvestrand
07d83c8a9a Modified STUN verification functions
The new verification makes verification a function on a message.
It also stores the password used in the request message, so that
it is easily accessible when verifying the response.

Bug: chromium:1177125
Change-Id: I505df4b54214643a28a6b292c4e2262b9d97b097
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209060
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33366}
2021-03-02 10:34:17 +00:00
Harald Alvestrand
bee6408d7b Introduce length checking of all STUN byte string attributes
This will cause encoding of a STUN message with an over-long
byte string attribute to fail.

Bug: chromium:1144646
Change-Id: I265174577376ce01439835c03f2d46700842d211
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191322
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Justin Uberti <juberti@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32603}
2020-11-13 12:31:37 +00:00
Yves Gerey
2257c087b1 [Cleanup/Optim] Pass IPAddress by const reference.
The IPAddress class (32 bytes) was copied for each invocation.
This CL also saves some bytes in generated binary.

Bug: webrtc:9855
Change-Id: I40f2fe8570ee30d1d2251fddd56131ca4c3e7155
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164521
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#30147}
2020-01-03 18:42:32 +00:00
Jonas Oreland
253d50fbe6 Add new Stun utility functions
This patch introduces 3 new functions on StunMessages
- Clone, copy a message
- IsStunMethod, verifies that a buffer is a StunMessage
  w/o requring a fingerprint
- EqualAttributes, compare attributes in two stun messages
  (with filter)

This methods will be used to implement GOOG_PING

BUG=webrtc:11100

Change-Id: I284726c74aa0437be0bb9fbcf943c7d64a18acec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160281
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29950}
2019-11-28 16:57:30 +00:00
Jonas Oreland
63737a918b Add new GOOG_PING and GOOG_MESSAGE_INTEGRITY_32
This patch adds
- Attribute: STUN_ATTR_GOOG_MESSAGE_INTEGRITY_32
  which is a ordinary message integrity but truncated to 32-bit
- Method: GOOG_PING,
  which will be used for webrtc:11100

Both the attribute and the method has been registered at iana,
https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml#stun-parameters-4

BUG=webrtc:11100

Change-Id: Iddd5614473fd6f18fbbe76e72d047c617df7123f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160180
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29864}
2019-11-21 15:29:50 +00:00
Jonas Oreland
1721de12bd Add STUN_ATTR_GOOG_MISC_INFO
This patch adds the new STUN attribute that has been registered at iana,
https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml#stun-parameters-4

This is part of the effort to land https://webrtc-review.googlesource.com/c/src/+/85520.
I have merged that patch with upstream, and is now doing privacy review of it.

This attribute is hence not yet used.

BUG=webrtc:9446

Change-Id: Iaf177b0c28a6aa830a9422260b67436bb05ac756
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160043
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29843}
2019-11-20 13:07:25 +00:00
Patrik Höglund
56d945233d Move stun.h to api/.
We now have two downstream users of stun.h, so it appears to be
generally usable. I put this in a new dir networking/, but I'm open to
suggestions here (maybe some things in api/ should move in there).

I checked what our downstream users are actually using, and it's

cricket::ComputeStunCredentialHash
cricket::<constants>
cricket::TurnMessage
cricket::GetStunErrorResponseType
cricket::StunAttribute::CreateAddress
cricket::StunErrorCodeAttribute
cricket::StunByteStringAttribute
StunAttribute::CreateUnknownAttributes
cricket::TurnErrorType
cricket::StunMessage

I reckoned that was pretty much everything in stun.h, so I didn't
bother splitting it up. They don't use every function and constant
in there, but all _types_ of functions and constants, so for the
sake of coherence I don't think it makes sense to split it.

There's some old stuff in there like GTURN which could arguably
be split out, but it should likely go away soon anyway, so I don't
think it's worth the effort.

Steps:
1) land this
2) update downstream to point to the new header and target
3) remove p2p/base:stun_types.

Bug: webrtc:11091
Change-Id: I1f05bf06055475d25601197ec6fefb8d3b55e8e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159923
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29822}
2019-11-18 16:11:27 +00:00
Renamed from p2p/base/stun_unittest.cc (Browse further)