Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
287b0389
Commit
287b0389
authored
Feb 02, 2021
by
Ivan Vilata-i-Balaguer
Browse files
Use 16-bit random id for UPnP mapping descriptions.
32-bit was probably overkill.
parent
b3750c9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/upnp.h
View file @
287b0389
...
...
@@ -19,7 +19,7 @@ public:
,
uint16_t
internal_port
)
:
_external_port
(
external_port
)
,
_internal_port
(
internal_port
)
,
_random_id
(
util
::
random
::
number
<
uint
32
_t
>
())
,
_random_id
(
util
::
random
::
number
<
uint
16
_t
>
())
{
TRACK_SPAWN
(
exec
,
([
this
,
...
...
@@ -66,7 +66,7 @@ private:
static
const
auto
recent_margin
=
seconds
(
10
);
// max RPC round-trip time
static
const
auto
timeout_pause
=
seconds
(
1
);
// to ensure mapping removal after timeout
auto
mapping_desc
=
(
boost
::
format
(
"Ouinet-%0
8
x"
)
%
_random_id
).
str
();
auto
mapping_desc
=
(
boost
::
format
(
"Ouinet-%0
4
x"
)
%
_random_id
).
str
();
while
(
true
)
{
...
...
@@ -181,7 +181,7 @@ private:
// to ease tracking those added by this UPnP client.
// Probably not the most secure option but simple enough
// without having to check our own address (which is probaly unreliable).
uint
32
_t
_random_id
;
uint
16
_t
_random_id
;
bool
_mapping_is_active
=
false
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment