DNS Malformed Packet
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: DNS Malformed Packet
by becky ·
I tested DNS using the W5100S-EVB and ioLibrary. But it worked well.
I see flag is wrong in your packet unlike my packet.
Opcode is not 1010, it should be 0000. Likewise, Questions is not 4164, it should be 1.
So i think there may be a problem with your hardware, interface or environment.
RE: RE: DNS Malformed Packet
by CraigTZ ·
Hi Becky,
I think this might be related to another problem I am seeing.
My packets from socket 0 and socket 1 are as I would expect, but everything coming out of socket 3 and socket 4 is not what I am sending at all. DNS was tested on socket 4
Here I am sending the exact same packet, from the same buffer on socket 2 and socket 3, with different outputs. Socket 2 is the correct data in the left of the screenshot below.
My initialisation is here:
I thought it could be a RX/TX memory allocation issue, but it seems the default is 2kB RX/TX for each socket. I have checked that the RMSR and TMSR registers on the device are set to the default (0x55).
RE: DNS Malformed Packet
by CraigTZ ·
As a follow up to this, I’ve also read back the socket Tx buffer on the W5100S and have seen that the memory does in fact store the correct data.
My process was:
So it seems the data is being written where it’s being told…
When wizchip_send_data is called I can see where the data is being put in memory, which seems to be based on some calculations and a call to getSn_TxBASE(Sn).
I’ve looked the values for each socket:
You’ll notice that there is only 1KB between those memory locations, but in my initialisation sets all Tx and Rx buffers at 2KB!
So it seems that the chip is assuming the buffers are 2KB long, but the driver is treating them as if they are 1KB.
Funnily enough, if I send data to socket 2 (txBase+21KB), then send to socket 1 (txBase+11KB), I will see nonsense in the first packet and the first packet’s data coming from the second packet:
Either the ioLibrary driver has an error in it, or I am missing an additional step to configure the socket Tx buffer size in the chip.
RE: DNS Malformed Packet
by becky ·
This is the W5500’s Memory organization. The W5100S is similar to this.
Therefore,
it is not true. There is 2KB of physical memory.
If you can give me your firmware, I’ll check. Please email me at becky@wiznet.io.
RE: DNS Malformed Packet
by CraigTZ ·
I’m not near my computer right now, but I can send firmware later.
I know there is supposed to be 2kB of memory, but there definitely is only 1kB between socket memories when the tx memory is written. I can literally see the memory locations it is trying to access and they are 1024 bytes apart!
So what I am seeing is the ioLibrary is storing the socket TX buffers only 1kB apart, but reading as if they are 2KB apart. This explains a few other issues I had been seeing with incorrect packet data. I had mistakenly thought socket 0 and socket 1 worked, but socket 1 was in fact just seeing what I had previously tried to write from socket 2.
I feel like I may have just missed some sort of configuration step because as you say this is not how it’s supposed to be. Can you look at the w5100_init function I posted and let me know if I have missed anything? Or are there any other strange config options/defines required?
For now I have implemented a quick hacky fix which multiplies the socket tx memory offset by two so it stores the packet in the correct location for the chip to send from.
RE: DNS Malformed Packet
by CraigTZ ·
Hi,
I’ve already done as much as I feel I can to resolve this myself… I spent an entire day troubleshooting this to find and understand the source of the problem before implementing a fix that I feel may not be necessary.
I would really appreciate some help from WIZnet to figure out how this problem happened and how to resolve it without implementing a hacky fix to the driver.
Thanks
RE: DNS Malformed Packet
by CraigTZ ·
Still waiting on a real resolution for this!
I’m also apparently not getting the correct information back from my DNS request. I can see I am getting a packet received, but it contains no information. I’m thinking it could be a similar issue to this memory misalignment.
RE: DNS Malformed Packet
by CraigTZ ·
STILL waiting on a reply from WIZnet on this issue!
RE: DNS Malformed Packet
by becky ·
Sorry,
I thought you solved the problem because of this post.
In fact, I have experienced this situation.
I also debugged it like you did to make sure the data fits in buf, but the actual packet was sent with different data.
So i downloaded the latest version of iolibrary and created a new project, thus the same code worked.
I think there is a problem with your project configuration or interface.
So hope you like me too.
RE: DNS Malformed Packet
by CraigTZ ·
Thanks Becky, it does appear there has been a fix issued at some point.
If there isn’t one already (I can’t find one) perhaps it would be a good idea to maintain a public changelog and release notes to allow people to identify if their problems have been solved? Its difficult to know without this.
I also noted that there is possibly another error in the latest version: line 542 of dns.c makes a call to wizchip_close() function which does not exist.