use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after: 1 week
This commit is contained in:
parent
a5b71fafb7
commit
fc99a00c7f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100505
@ -457,14 +457,12 @@ main(int argc, char *argv[], char **envp)
|
||||
if (setsockopt(ctl_sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&on, sizeof(on)) < 0)
|
||||
syslog(LOG_ERR, "control setsockopt: %m");
|
||||
#ifdef IPV6_BINDV6ONLY
|
||||
if (family == AF_INET6 && enable_v4 == 0) {
|
||||
if (setsockopt(ctl_sock, IPPROTO_IPV6, IPV6_BINDV6ONLY,
|
||||
if (setsockopt(ctl_sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(char *)&on, sizeof (on)) < 0)
|
||||
syslog(LOG_ERR,
|
||||
"control setsockopt(IPV6_BINDV6ONLY): %m");
|
||||
"control setsockopt(IPV6_V6ONLY): %m");
|
||||
}
|
||||
#endif /* IPV6_BINDV6ONLY */
|
||||
memcpy(&server_addr, res->ai_addr, res->ai_addr->sa_len);
|
||||
if (bind(ctl_sock, (struct sockaddr *)&server_addr,
|
||||
server_addr.su_len) < 0) {
|
||||
|
@ -1209,14 +1209,12 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
|
||||
(setsockopt(sep->se_fd, IPPROTO_IPV6, IPV6_PKTINFO,
|
||||
(char *)&on, sizeof (on)) < 0))
|
||||
syslog(LOG_ERR, "setsockopt (IPV6_RECVPKTINFO): %m");
|
||||
#ifdef IPV6_BINDV6ONLY
|
||||
if (sep->se_family == AF_INET6) {
|
||||
int flag = sep->se_nomapped ? 1 : 0;
|
||||
if (setsockopt(sep->se_fd, IPPROTO_IPV6, IPV6_BINDV6ONLY,
|
||||
if (setsockopt(sep->se_fd, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(char *)&flag, sizeof (flag)) < 0)
|
||||
syslog(LOG_ERR, "setsockopt (IPV6_BINDV6ONLY): %m");
|
||||
syslog(LOG_ERR, "setsockopt (IPV6_V6ONLY): %m");
|
||||
}
|
||||
#endif /* IPV6_BINDV6ONLY */
|
||||
#undef turnon
|
||||
if (sep->se_type == TTCP_TYPE)
|
||||
if (setsockopt(sep->se_fd, IPPROTO_TCP, TCP_NOPUSH,
|
||||
|
@ -362,12 +362,12 @@ main(argc, argv)
|
||||
* by default on NFS sockets too.
|
||||
*/
|
||||
if (udp6sock != -1 && setsockopt(udp6sock, IPPROTO_IPV6,
|
||||
IPV6_BINDV6ONLY, &one, sizeof one) < 0){
|
||||
IPV6_V6ONLY, &one, sizeof one) < 0){
|
||||
syslog(LOG_ERR, "can't disable v4-in-v6 on UDP socket");
|
||||
exit(1);
|
||||
}
|
||||
if (tcp6sock != -1 && setsockopt(tcp6sock, IPPROTO_IPV6,
|
||||
IPV6_BINDV6ONLY, &one, sizeof one) < 0){
|
||||
IPV6_V6ONLY, &one, sizeof one) < 0){
|
||||
syslog(LOG_ERR, "can't disable v4-in-v6 on UDP socket");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -438,8 +438,7 @@ main(argc, argv, envp)
|
||||
"can't create udp6 socket");
|
||||
nfsd_exit(1);
|
||||
}
|
||||
if (setsockopt(sock, IPPROTO_IPV6,
|
||||
IPV6_BINDV6ONLY,
|
||||
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
&on, sizeof on) < 0) {
|
||||
syslog(LOG_ERR,
|
||||
"can't set v6-only binding for "
|
||||
@ -581,7 +580,7 @@ main(argc, argv, envp)
|
||||
syslog(LOG_ERR,
|
||||
"setsockopt SO_REUSEADDR: %m");
|
||||
if (setsockopt(tcp6sock, IPPROTO_IPV6,
|
||||
IPV6_BINDV6ONLY, &on, sizeof on) < 0) {
|
||||
IPV6_V6ONLY, &on, sizeof on) < 0) {
|
||||
syslog(LOG_ERR,
|
||||
"can't set v6-only binding for tcp6 "
|
||||
"socket: %m");
|
||||
|
@ -339,7 +339,7 @@ init_transport(struct netconfig *nconf)
|
||||
continue;
|
||||
}
|
||||
if (setsockopt(fd, IPPROTO_IPV6,
|
||||
IPV6_BINDV6ONLY, &on, sizeof on) < 0) {
|
||||
IPV6_V6ONLY, &on, sizeof on) < 0) {
|
||||
syslog(LOG_ERR, "can't set v6-only binding for "
|
||||
"udp6 socket: %m");
|
||||
continue;
|
||||
|
@ -2370,17 +2370,15 @@ socksetup(int af, const char *bindhostname)
|
||||
logerror("socket");
|
||||
continue;
|
||||
}
|
||||
#ifdef IPV6_BINDV6ONLY
|
||||
if (r->ai_family == AF_INET6) {
|
||||
int on = 1;
|
||||
if (setsockopt(*s, IPPROTO_IPV6, IPV6_BINDV6ONLY,
|
||||
if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(char *)&on, sizeof (on)) < 0) {
|
||||
logerror("setsockopt");
|
||||
close(*s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
|
||||
close(*s);
|
||||
logerror("bind");
|
||||
|
Loading…
Reference in New Issue
Block a user