-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#5014] IOOBE in DefaultDnsRecordDecoder#decodeName #5015
Conversation
…Decoder#decodeName()
@rkapsi will have a look. Thanks! |
@rkapsi what dns server you are using for the test ? |
@rkapsi asking as it works here ... Maybe can you also show me your /etc/hosts ? |
@normanmaurer Interesting. I'm using DnsNameResolver's defaults. When I set it explicitly to Google's DNS or let's say Level 3's it's working fine. When I use Squarespace's corp DNS then it doesn't and it seems this Unit Test triggered the exact same Exception on netty.io's TeamCity's CI box. |
@rkapsi can you just do a dig and show me what your dns return ? |
|
Btw. I was using 127.0.0.1 as an example. I'm getting the same error with something like |
@rkapsi can you give me the output against your dns and against the google one so I can see the diff between these ? |
Google DNS
Corp DNS
Google DNS
Corp DNS
|
Interesting. The 127.0.0.1 lookup is potentially misleading. Using public class ReverseDnsQueryTest {
@Test
public void rdns() throws Exception {
NioEventLoopGroup group = new NioEventLoopGroup();
DnsNameResolver resolver = new DnsNameResolverBuilder(group.next())
.channelType(NioDatagramChannel.class)
.nameServerAddresses(DnsServerAddresses.sequential(
new InetSocketAddress("8.8.8.8", 53)))
.build();
try {
String name = "1.64.249.66.in-addr.arpa";
DnsQuestion question = new DefaultDnsQuestion(name, DnsRecordType.PTR);
resolver.query(question).get();
} finally {
resolver.close();
group.shutdownGracefully();
}
}
} |
@rkapsi I will need to dig a bit deeper into the RFC I guess . I mean I know how to work around this but I'm not sure it is the correct thing to do in this case. |
@rkapsi in the meantime you can use |
@normanmaurer the @Test
public void wireshark() throws Exception {
DatagramDnsResponseDecoder decoder = new DatagramDnsResponseDecoder();
ByteBuf response = response("/home/rkapsi/ioobe-5015/response");
DatagramPacket packet = new DatagramPacket(
response, new InetSocketAddress("localhost", 53));
ChannelHandlerContext ctx = mock(ChannelHandlerContext.class);
decoder.channelRead(ctx, packet);
}
private static ByteBuf response(String path) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FileInputStream in = new FileInputStream(path);
try {
byte[] buf = new byte[4*1024];
int len = -1;
while ((len = in.read(buf)) != -1) {
baos.write(buf, 0, len);
}
} finally {
in.close();
}
return Unpooled.wrappedBuffer(baos.toByteArray());
} |
@rkapsi sure why not... norman dot maurer at googlemail dot com . |
@rkapsi I know its been a while but do you bay any chance still have "/home/rkapsi/ioobe-5015/response" somewhere ? |
This PR demonstrates the IOOBE as described in #5014.