Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
9afcada8
Commit
9afcada8
authored
9 years ago
by
Kenton Varda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #243 from mrdomino/async-io-v4only-openbsd
Use ip4 sockets for wildcard on OpenBSD
parents
f478b0f5
befb06b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
async-io.c++
c++/src/kj/async-io.c++
+11
-0
No files found.
c++/src/kj/async-io.c++
View file @
9afcada8
...
...
@@ -412,12 +412,14 @@ public:
}
void
bind
(
int
sockfd
)
const
{
#if !defined(__OpenBSD__)
if
(
wildcard
)
{
// Disable IPV6_V6ONLY because we want to handle both ipv4 and ipv6 on this socket. (The
// default value of this option varies across platforms.)
int
value
=
0
;
KJ_SYSCALL
(
setsockopt
(
sockfd
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
&
value
,
sizeof
(
value
)));
}
#endif
KJ_SYSCALL
(
::
bind
(
sockfd
,
&
addr
.
generic
,
addrlen
),
toString
());
}
...
...
@@ -560,9 +562,18 @@ public:
// Check for wildcard.
if
(
addrPart
.
size
()
==
1
&&
addrPart
[
0
]
==
'*'
)
{
result
.
wildcard
=
true
;
#if defined(__OpenBSD__)
// On OpenBSD, all sockets are either v4-only or v6-only, so use v4 as a
// temporary workaround for wildcards.
result
.
addrlen
=
sizeof
(
addr
.
inet4
);
result
.
addr
.
inet4
.
sin_family
=
AF_INET
;
result
.
addr
.
inet4
.
sin_port
=
htons
(
port
);
#else
// Create an ip6 socket and set IPV6_V6ONLY to 0 later.
result
.
addrlen
=
sizeof
(
addr
.
inet6
);
result
.
addr
.
inet6
.
sin6_family
=
AF_INET6
;
result
.
addr
.
inet6
.
sin6_port
=
htons
(
port
);
#endif
auto
array
=
kj
::
heapArrayBuilder
<
SocketAddress
>
(
1
);
array
.
add
(
result
);
return
array
.
finish
();
...
...
This diff is collapsed.
Click to expand it.
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