Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
ortp
Commits
d37b7097
Commit
d37b7097
authored
Nov 19, 2010
by
Simon Morlat
Browse files
decode xor mapped address (there is no reason not to do it)
parent
930fac6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
src/stun.c
src/stun.c
+11
-13
No files found.
src/stun.c
View file @
d37b7097
...
...
@@ -612,7 +612,11 @@ stunParseMessage( char* buf, unsigned int bufLen, StunMessage *msg)
}
else
{
ortp_debug
(
"stun: SA_XORMAPPEDADDRESS = %s
\n
"
,
ipaddr
(
&
msg
->
xorMappedAddress
.
ipv4
)
);
uint32_t
cookie
=
0x2112A442
;
uint16_t
cookie16
=
0x2112A442
>>
16
;
msg
->
xorMappedAddress
.
ipv4
.
port
=
msg
->
xorMappedAddress
.
ipv4
.
port
^
cookie16
;
msg
->
xorMappedAddress
.
ipv4
.
addr
=
msg
->
xorMappedAddress
.
ipv4
.
addr
^
cookie
;
ortp_debug
(
"stun: SA_XORMAPPEDADDRESS = %s
\n
"
,
ipaddr
(
&
msg
->
xorMappedAddress
.
ipv4
)
);
}
}
else
if
(
atrType
==
SA_XORONLY
)
...
...
@@ -2538,10 +2542,8 @@ stunOpenSocket( StunAddress4 *dest, StunAddress4* mapAddr,
if
(
resp
.
hasXorMappedAddress
==
TRUE
)
{
uint32_t
cookie
=
0x2112A442
;
uint16_t
cookie16
=
0x2112A442
>>
16
;
mappedAddr
.
port
=
resp
.
xorMappedAddress
.
ipv4
.
port
^
cookie16
;
mappedAddr
.
addr
=
resp
.
xorMappedAddress
.
ipv4
.
addr
^
cookie
;
mappedAddr
.
port
=
resp
.
xorMappedAddress
.
ipv4
.
port
;
mappedAddr
.
addr
=
resp
.
xorMappedAddress
.
ipv4
.
addr
;
}
else
mappedAddr
=
resp
.
mappedAddress
.
ipv4
;
...
...
@@ -2648,10 +2650,8 @@ stunOpenSocketPair(StunAddress4 *dest,
if
(
resp
.
hasXorMappedAddress
==
TRUE
)
{
uint32_t
cookie
=
0x2112A442
;
uint16_t
cookie16
=
0x2112A442
>>
16
;
mappedAddr
[
i
].
port
=
resp
.
xorMappedAddress
.
ipv4
.
port
^
cookie16
;
mappedAddr
[
i
].
addr
=
resp
.
xorMappedAddress
.
ipv4
.
addr
^
cookie
;
mappedAddr
[
i
].
port
=
resp
.
xorMappedAddress
.
ipv4
.
port
;
mappedAddr
[
i
].
addr
=
resp
.
xorMappedAddress
.
ipv4
.
addr
;
}
else
mappedAddr
[
i
]
=
resp
.
mappedAddress
.
ipv4
;
...
...
@@ -2840,10 +2840,8 @@ turnAllocateSocketPair(StunAddress4 *dest,
{
if
(
resp
.
hasXorRelayedAddress
==
TRUE
)
{
uint32_t
cookie
=
0x2112A442
;
uint16_t
cookie16
=
0x2112A442
>>
16
;
mappedAddr
[
i
].
port
=
resp
.
xorRelayedAddress
.
ipv4
.
port
^
cookie16
;
mappedAddr
[
i
].
addr
=
resp
.
xorRelayedAddress
.
ipv4
.
addr
^
cookie
;
mappedAddr
[
i
].
port
=
resp
.
xorRelayedAddress
.
ipv4
.
port
;
mappedAddr
[
i
].
addr
=
resp
.
xorRelayedAddress
.
ipv4
.
addr
;
}
else
{
...
...
Write
Preview
Markdown
is supported
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