Permalink
Browse files

make sure we do not transmit scope_id extension to the wire, even if

we are using 2553bis-01 getaddrinfo (fill scope_id by 0).
sync with netbsd-current
  • Loading branch information...
1 parent 7e788db commit 0b0cb6c9d7d69a4c9987ad7701b6bb42249afa4f itojun committed Nov 26, 2000
Showing with 11 additions and 9 deletions.
  1. +11 −9 netbsd/usr.bin/ftp/ftp.c
@@ -1705,10 +1705,9 @@ initconn(void)
warn("listen");
if (sendport) {
-#ifdef INET6
- char hname[INET6_ADDRSTRLEN];
+ char hname[NI_MAXHOST], sname[NI_MAXSERV];
int af;
-#endif
+ union sockunion tmp;
switch (data_addr.su_family) {
case AF_INET:
@@ -1719,14 +1718,18 @@ initconn(void)
/* FALLTHROUGH */
#ifdef INET6
case AF_INET6:
+#endif
af = (data_addr.su_family == AF_INET) ? 1 : 2;
- if (getnameinfo((struct sockaddr *)&data_addr,
- data_addr.su_len, hname, sizeof(hname),
- NULL, 0, NI_NUMERICHOST)) {
+ tmp = data_addr;
+ if (tmp.su_family == AF_INET6)
+ tmp.su_sin6.sin6_scope_id = 0;
+ if (getnameinfo((struct sockaddr *)&tmp,
+ tmp.su_len, hname, sizeof(hname), sname,
+ sizeof(sname), NI_NUMERICHOST | NI_NUMERICSERV)) {
result = ERROR;
} else {
- result = command("EPRT |%d|%s|%d|", af, hname,
- ntohs(data_addr.su_port));
+ result = command("EPRT |%d|%s|%s|", af, hname,
+ sname);
if (!connected)
return (1);
if (result != COMPLETE) {
@@ -1738,7 +1741,6 @@ initconn(void)
}
}
break;
-#endif
default:
result = COMPLETE + 1;
break;

0 comments on commit 0b0cb6c

Please sign in to comment.