Skip to content

Commit

Permalink
- shutdown(0) for write only sockets
Browse files Browse the repository at this point in the history
- do not set IPV6_MULTICAST_IF for a read-only socket.
  • Loading branch information
jinmei committed Apr 14, 2000
1 parent 1ae0c1f commit 9676ee7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions kame/kame/dhcp6/dhcp6c.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ client6_init()
err(1, "setsockopt(outbound, IPV6_MULTICAST_IF)");
/*NOTREACHED*/
}
if (shutdown(outsock, 0)) {
/* make the socket write-only */
err(1, "shutdown(outbound, 0)");
/* NOTREACHED */
}
freeaddrinfo(res);

#if 0
Expand Down
11 changes: 6 additions & 5 deletions kame/kame/dhcp6/dhcp6s.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ server6_init()
err(1, "bind(insock)");
/*NOTREACHED*/
}
if (setsockopt(insock, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&ifidx, sizeof(ifidx)) < 0) {
err(1, "setsockopt(insock, IPV6_MULTICAST_IF)");
/*NOTREACHED*/
}
freeaddrinfo(res);

hints.ai_flags = 0;
Expand Down Expand Up @@ -261,11 +256,17 @@ server6_init()
err(1, "socket(outsock)");
/*NOTREACHED*/
}
/* set outgoing interface of multicast packets for DHCP reconfig */
if (setsockopt(outsock, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&ifidx, sizeof(ifidx)) < 0) {
err(1, "setsockopt(outsock, IPV6_MULTICAST_IF)");
/*NOTREACHED*/
}
if (shutdown(outsock, 0)) {
/* make the socket write-only */
err(1, "shutdown(outbound, 0)");
/* NOTREACHED */
}
freeaddrinfo(res);

#if 0
Expand Down

0 comments on commit 9676ee7

Please sign in to comment.