Skip to content

Commit cac1771

Browse files
committed
Merge 'Fix incorrect union access in dns resolver' from Pavel Emelyanov
The resolver maintains a map of sock_entry's each containing union of tcp_entry and udp_entry and its type. There's (at least) one place that accesses the union without checking if it contains the expected object. Closes #3111 * github.com:scylladb/seastar: dns: Squash two if blocks together dns: Do not check tcp entry for udp type
2 parents eb05cf6 + c1ac4e8 commit cac1771

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/net/dns.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,15 +1350,17 @@ dns_resolver::impl::do_sendv(ares_socket_t fd, const iovec * vec, int len) {
13501350

13511351
for (;;) {
13521352
// check if we're already writing.
1353-
if (e.typ == type::tcp && !(e.avail & POLLOUT)) {
1354-
dns_log.trace("Send already pending {}", fd);
1355-
errno = EWOULDBLOCK;
1356-
return -1;
1357-
}
1353+
if (e.typ == type::tcp) {
1354+
if (!(e.avail & POLLOUT)) {
1355+
dns_log.trace("Send already pending {}", fd);
1356+
errno = EWOULDBLOCK;
1357+
return -1;
1358+
}
13581359

1359-
if (!e.tcp.socket) {
1360-
errno = ENOTCONN;
1361-
return -1;
1360+
if (!e.tcp.socket) {
1361+
errno = ENOTCONN;
1362+
return -1;
1363+
}
13621364
}
13631365

13641366
packet p;

0 commit comments

Comments
 (0)