forked from mirrors/tftp-hpa-google
tftpd: Canonicalize all the addresses
We cannot canonicalize myaddr and not the from address. We need to canonicalize both of them, or else we'll try to create an IPv4 socket and bind an IPv6-mapped IPv4 address to it, which is going to fail. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
ff819b108a
commit
7678ae7f14
3 changed files with 25 additions and 26 deletions
|
@ -93,7 +93,6 @@ static unsigned int max_blksize = MAX_SEGSIZE;
|
|||
static char tmpbuf[INET6_ADDRSTRLEN], *tmp_p;
|
||||
|
||||
static union sock_addr from;
|
||||
static socklen_t fromlen;
|
||||
static off_t tsize;
|
||||
static int tsize_ok;
|
||||
|
||||
|
@ -874,9 +873,7 @@ int main(int argc, char **argv)
|
|||
set_socket_nonblock(fd, 0);
|
||||
#endif
|
||||
|
||||
fromlen = sizeof(from);
|
||||
n = myrecvfrom(fd, buf, sizeof(buf), 0,
|
||||
(struct sockaddr *)&from, &fromlen, &myaddr);
|
||||
n = myrecvfrom(fd, buf, sizeof(buf), 0, &from, &myaddr);
|
||||
|
||||
if (n < 0) {
|
||||
if (E_WOULD_BLOCK(errno) || errno == EINTR) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue