1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-07 01:58:02 +03:00

resolved: don't stop handle messages after receiving a zero length UDP packet (#3323)

Fixes:

-bash-4.3# ss --udp -l -p
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     0      0          *:5355                     *:* users:(("systemd-resolve",pid=601,fd=12))
UNCONN     0      0         :::5355                    :::* users:(("systemd-resolve",pid=601,fd=14))

-bash-4.3# nping --udp -p 5355 --data-length 0 -c 1 localhost

-bash-4.3# journalctl -u systemd-resolved -b --no-hostname
...
May 21 14:59:22 systemd-resolved[601]: Event source llmnr-ipv4-udp (type io) returned error, disabling: Input/output error
...

-bash-4.3# nping --udp -p 5355 --data-length 1000 -c 1 localhost

-bash-4.3# ss --udp -l
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     2304   0          *:5355                     *:*
UNCONN     0      0         :::5355                    :::*
This commit is contained in:
Evgeny Vereshchagin 2016-05-23 11:19:14 +03:00 committed by Lennart Poettering
parent ffd9877ca9
commit f134289ac5

View File

@ -643,6 +643,8 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
mh.msg_controllen = sizeof(control);
l = recvmsg(fd, &mh, 0);
if (l == 0)
return 0;
if (l < 0) {
if (errno == EAGAIN || errno == EINTR)
return 0;
@ -650,9 +652,6 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
return -errno;
}
if (l <= 0)
return -EIO;
assert(!(mh.msg_flags & MSG_CTRUNC));
assert(!(mh.msg_flags & MSG_TRUNC));