BUG/MINOR: dev/udp: properly preset the rx address size
addrlen was not preset to sizeof(addr) on rx, resulting in the address often not being filled and response packets not always flowing back. Let's also consistently use "addr" in the bind call (it points to frt_addr there but it's a bit confusing).
This commit is contained in:
parent
0bfa3e7ff2
commit
3ff9610356
|
@ -193,7 +193,7 @@ int create_udp_listener(struct sockaddr_storage *addr, struct errmsg *err)
|
|||
goto fail;
|
||||
}
|
||||
#endif
|
||||
if (bind(fd, (struct sockaddr *)&frt_addr, addr->ss_family == AF_INET6 ?
|
||||
if (bind(fd, (struct sockaddr *)addr, addr->ss_family == AF_INET6 ?
|
||||
sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == -1) {
|
||||
err->len = snprintf(err->msg, err->size, "bind(): '%s'", strerror(errno));
|
||||
goto fail;
|
||||
|
@ -297,6 +297,7 @@ int handle_frt(int fd, struct pollfd *pfd, struct conn *conns, int nbconn)
|
|||
pktbuf = history[history_idx].buf;
|
||||
}
|
||||
|
||||
addrlen = sizeof(addr);
|
||||
ret = recvfrom(fd, pktbuf, MAXPKTSIZE, MSG_DONTWAIT | MSG_NOSIGNAL,
|
||||
(struct sockaddr *)&addr, &addrlen);
|
||||
|
||||
|
|
Loading…
Reference in New Issue