Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
a8ddac96
Commit
a8ddac96
authored
16 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
handle ipv6 in socks5 requests.
svn:r16476
parent
22259a08
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/TODO.021
+2
-2
2 additions, 2 deletions
doc/TODO.021
src/or/buffers.c
+16
-7
16 additions, 7 deletions
src/or/buffers.c
with
18 additions
and
9 deletions
doc/TODO.021
+
2
−
2
View file @
a8ddac96
...
...
@@ -186,14 +186,14 @@ R d Do we want to maintain our own set of entryguards that we use as
- Teach resolving code how to handle ipv6.
. Teach exit policies about ipv6 (consider ipv4/ipv6 interaction!)
o Use IPv6 in connect/connected/failed-exitpolicy cells
-
accept ipv6 from socks
o
accept ipv6 from socks
o Generate END_REASON_EXITPOLICY cells right
. ... and parse them right
. Generate new BEGIN cell types and parse them right
- Detect availability of ipv6
- Advertise availability of ipv6.
- Geoip support, if only to add a zone called "ipv6"
-
- 118: Listen on and advertise multiple ports:
- Tor should be able to have a pool of outgoing IP addresses that it is
able to rotate through. (maybe. Possible overlap with proposal 118.)
...
...
This diff is collapsed.
Click to expand it.
src/or/buffers.c
+
16
−
7
View file @
a8ddac96
...
...
@@ -1309,7 +1309,8 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
int
log_sockstype
,
int
safe_socks
)
{
unsigned
int
len
;
char
tmpbuf
[
INET_NTOA_BUF_LEN
];
char
tmpbuf
[
TOR_ADDR_BUF_LEN
+
1
];
tor_addr_t
destaddr
;
uint32_t
destip
;
uint8_t
socksver
;
enum
{
socks4
,
socks4a
}
socks4_prot
=
socks4a
;
...
...
@@ -1374,13 +1375,20 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
}
switch
(
*
(
buf
->
head
->
data
+
3
))
{
/* address type */
case
1
:
/* IPv4 address */
case
4
:
/* IPv6 address */
{
const
int
is_v6
=
*
(
buf
->
head
->
data
+
3
)
==
4
;
const
unsigned
addrlen
=
is_v6
?
16
:
4
;
log_debug
(
LD_APP
,
"socks5: ipv4 address type"
);
if
(
buf
->
datalen
<
10
)
/* ip/port there? */
if
(
buf
->
datalen
<
6
+
addrlen
)
/* ip/port there? */
return
0
;
/* not yet */
destip
=
ntohl
(
*
(
uint32_t
*
)(
buf
->
head
->
data
+
4
));
in
.
s_addr
=
htonl
(
destip
);
tor_inet_ntoa
(
&
in
,
tmpbuf
,
sizeof
(
tmpbuf
));
if
(
is_v6
)
tor_addr_from_ipv6_bytes
(
&
destaddr
,
buf
->
head
->
data
+
4
);
else
tor_addr_from_ipv4n
(
&
destaddr
,
get_uint32
(
buf
->
head
->
data
+
4
));
tor_addr_to_str
(
tmpbuf
,
&
destaddr
,
sizeof
(
tmpbuf
),
1
);
if
(
strlen
(
tmpbuf
)
+
1
>
MAX_SOCKS_ADDR_LEN
)
{
log_warn
(
LD_APP
,
"socks5 IP takes %d bytes, which doesn't fit in %d. "
...
...
@@ -1389,8 +1397,8 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
return
-
1
;
}
strlcpy
(
req
->
address
,
tmpbuf
,
sizeof
(
req
->
address
));
req
->
port
=
ntohs
(
*
(
uint16
_t
*
)
(
buf
->
head
->
data
+
8
));
buf_remove_from_front
(
buf
,
10
);
req
->
port
=
ntohs
(
get_
uint16
(
buf
->
head
->
data
+
4
+
addrlen
));
buf_remove_from_front
(
buf
,
6
+
addrlen
);
if
(
req
->
command
!=
SOCKS_COMMAND_RESOLVE_PTR
&&
!
addressmap_have_mapping
(
req
->
address
)
&&
!
have_warned_about_unsafe_socks
)
{
...
...
@@ -1410,6 +1418,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
return
-
1
;
}
return
1
;
}
case
3
:
/* fqdn */
log_debug
(
LD_APP
,
"socks5: fqdn address type"
);
if
(
req
->
command
==
SOCKS_COMMAND_RESOLVE_PTR
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment