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
befb06b1
Commit
befb06b1
authored
Sep 06, 2015
by
Steven Dee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ip4 sockets for wildcard on OpenBSD
Short-term fix for #220.
parent
96635cc8
Hide 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 @
befb06b1
...
...
@@ -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
();
...
...
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