~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server/, mon/: Introduce transport of TrIPE over IPv6.
[tripe]
/
server
/
peer.c
diff --git
a/server/peer.c
b/server/peer.c
index
34bfb6c
..
9462921
100644
(file)
--- a/
server/peer.c
+++ b/
server/peer.c
@@
-791,6
+791,7
@@
void p_init(struct addrinfo *ailist)
{
int fd;
int len = PKBUFSZ;
{
int fd;
int len = PKBUFSZ;
+ int yes = 1;
int i;
struct addrinfo *ai;
unsigned port, lastport = 0;
int i;
struct addrinfo *ai;
unsigned port, lastport = 0;
@@
-813,6
+814,11
@@
void p_init(struct addrinfo *ailist)
if ((fd = socket(ai->ai_family, SOCK_DGRAM, 0)) < 0)
die(EXIT_FAILURE, "socket creation failed: %s", strerror(errno));
if ((fd = socket(ai->ai_family, SOCK_DGRAM, 0)) < 0)
die(EXIT_FAILURE, "socket creation failed: %s", strerror(errno));
+ if (i == AFIX_INET6 &&
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes))) {
+ die(EXIT_FAILURE, "failed to set IPv6-only state: %s",
+ strerror(errno));
+ }
assert(ai->ai_addrlen <= sizeof(a));
memcpy(&a, ai->ai_addr, ai->ai_addrlen);
if ((port = getport(&a)) == 0 && lastport) setport(&a, lastport);
assert(ai->ai_addrlen <= sizeof(a));
memcpy(&a, ai->ai_addr, ai->ai_addrlen);
if ((port = getport(&a)) == 0 && lastport) setport(&a, lastport);