net.lookup locked

21 views
Skip to first unread message

Gabriel Duarte

unread,
May 6, 2013, 7:57:19 PM5/6/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hello guys!

Today I was trying to use net.lookup to find the IP address of a host, to then ask data with net.connect, but, the net.lookup gets locked forever. Maybe it's not finding a DNS server to ask.

I am using a mizar32 with this build:


I made a simple test with:
= net.lookup("www.eluaproject.net")

Unfortunately it does nor work... Tips?

Cheers!

--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

Gabriel Duarte

unread,
May 6, 2013, 8:37:54 PM5/6/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Just to remember... I have a Stellaris LM3S8962 and the net.lookup runs as expected, so, I suppose the problem is not with my network.


2013/5/6 Gabriel Duarte <confu...@gmail.com>

Dado Sutter

unread,
May 6, 2013, 9:37:24 PM5/6/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hi Gabriel,
   Did you edit the default value for a valid DNS server?
   If you're using the eLua web builder, it is easy to find this field under advanced options.
   If you're building it in a toolchain of yours, grep for "dns_address =" and add the IP of the DNS server of your choice.
   I hope it helps, pls let us know.

Best
Dado








--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mizar32+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gabriel Duarte

unread,
May 6, 2013, 9:50:58 PM5/6/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Nop, I didn't.

I have used the SimpleMachines web builder... I do not know to where to point, once I do not have a DNS server. Actually I tried to use Google's DNS server in a second build, 8.8.8.8, but didn't work anyway.


I would like to know to where the LM3S8962 is pointing the DNS, considering the fact that it's working fine.

Cheers


2013/5/6 Dado Sutter <dados...@gmail.com>

Dado Sutter

unread,
May 7, 2013, 9:01:07 AM5/7/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
If your build has the the DHCP option active, the kit should receive and use not only it's IP but also the DNS server IP.
I don't know how this works on the Mizar32 web builder though :(  Maybe the defaults are different but their doc is 1st class.
Martin, Nuccio and Sergio are also here to help a hand ...

I'd love to see your Mizar32 working perfectly ASAP, for the number of projects where it can be used doesn't stop to grow.

Best
Dado








Gabriel Duarte

unread,
May 7, 2013, 9:31:09 AM5/7/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
It has... I can use, for example, it as a small webserver, receiving connections. The only problems is the lookup, since I need to translate hostnames into IP addresses to connect with the host and grab data.




2013/5/7 Dado Sutter <dados...@gmail.com>

Gabriel Duarte

unread,
May 7, 2013, 8:33:14 PM5/7/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
The guys from SimpleMachines could help me?


2013/5/7 Gabriel Duarte <confu...@gmail.com>

Lucas R. Martins

unread,
May 9, 2013, 9:58:02 PM5/9/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com

Gabriel,

Have you some progress?

Maybe you can sniff the network traffic, looking for DNS packages, to see if that has all data and for which address it is going to. This should be usefull for debugging...

_______________________________________________
eLua-dev mailing list
eLua...@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/elua-dev

Gabriel Duarte

unread,
May 10, 2013, 9:29:15 AM5/10/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Nop :( I do not know how to sniff the network to look for DNS packages, and anyway, I do not think there is a problem in my network. Probably it's just a tricky configuration somewhere and I will find it, but I would like to hear from SimpleMachines guys to know if they have seen this behavior before.

Cheers


2013/5/9 Lucas R. Martins <luka...@gmail.com>

Martin Guy

unread,
May 11, 2013, 4:48:58 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hi Gabriel, sorry for the delay in replying

When I tested the Mizar32 network stuff a year ago it gave no problems
in this area. Can you try the elua-0.9 firmware for Mizar32 from
http://www.eluaproject.net/get-started/downloads
and let us know if that improves things for you?

M

Martin Guy

unread,
May 11, 2013, 6:10:16 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
hi again.

I can confirm that Mizar32 gets its address correctly from a DHCP
server on the local network and that net.lookup() works fine.

> p=net.lookup("simplemachines.it")
> =p
-1341547820
> =net.unpackip(p, '*s')
176.9.154.212
>

I guess you need to sort out your local network/DHCP server/DNS
server/internet gateway.

M

Gabriel Duarte

unread,
May 11, 2013, 10:49:58 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hello Martin,
 
it's good to hear from you. I can test for you the 0.9 to see what is improved :D
 
I have flashed a firmware from simplemachines web builder, with UIP and DNS resolver.
 
I noticed that Mizar32 always gets the IP address that I set into the builder, not a DHCP address. It's strange, maybe it's a problem with
DHCP server (my router, in this case) and because of it does not find correct settings, like DNS server and gateway, only uses the default
address set at build time, 192.168.1.1, if I remember correctly.
 
 
Which firmware version are you using?


2013/5/11 Martin Guy <marti...@gmail.com>

    M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mizar32+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Gabriel Duarte

unread,
May 11, 2013, 10:50:41 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
-> 192.168.1.1
 
This was my last build:
 


2013/5/11 Gabriel Duarte <confu...@gmail.com>

Gabriel Duarte

unread,
May 11, 2013, 10:51:51 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
This one is without DHCP, but the previous has but does not work anyway:
 


2013/5/11 Gabriel Duarte <confu...@gmail.com>

Martin Guy

unread,
May 11, 2013, 11:42:53 AM5/11/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
OK, please use the official firmware, either 20120123 or elua 0.9, so
that we are talking about the same thing.

I am able to reproduce your symptom - that net.lookup() blocks - in
the following circumstances:

- No DHCP server gives the Mizar32 an address and routing info
- It gets a DHCP address but cannot contact the name server

If no DHCP server responds for 60 seconds, eLua stops trying and sets
the fixed addresses, which are:

#define ELUA_CONF_IPADDR0 192
#define ELUA_CONF_IPADDR1 168
#define ELUA_CONF_IPADDR2 1
#define ELUA_CONF_IPADDR3 10

#define ELUA_CONF_NETMASK0 255
#define ELUA_CONF_NETMASK1 255
#define ELUA_CONF_NETMASK2 255
#define ELUA_CONF_NETMASK3 0

#define ELUA_CONF_DEFGW0 192
#define ELUA_CONF_DEFGW1 168
#define ELUA_CONF_DEFGW2 1
#define ELUA_CONF_DEFGW3 1

#define ELUA_CONF_DNS0 192
#define ELUA_CONF_DNS1 168
#define ELUA_CONF_DNS2 1
#define ELUA_CONF_DNS3 1

I hope this helps

m

Martin Guy

unread,
May 13, 2013, 9:45:33 AM5/13/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hi again Gabriel.
Trying to reproduce your problem, our Mizar32 developers are finding
that net.lookup sometimes works and sometimes doesn't, apparently at
random.
On Saturday it was working for me - today it isn't, and that goes
for both SM's 0.8-based firmware and the 0.9 firmware on the
eluaproject.net site.

I've been trying to finalise the Simplemachines' release of elua-0.9
in the last few days, and with that am getting consistent success
where the other two firmwares are failing. Maybe you could help me
with a little beta-testing of the attached firmware, which you'll need
to gunzip first, and let me know if it improves anything for you?

M
elua_lualong_at32uc3a0256_mizar32_0.9rc1.hex.gz

Gabriel Duarte

unread,
May 13, 2013, 10:23:56 AM5/13/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hello Matin!

That's bad you coud reproduce the problem, I was wishing I would a problem only with me.
I will flash this firmware tonight and give you a report about what happens. I hope it will work.

You got any idea where is the problem? uIP?

Cheers


2013/5/13 Martin Guy <marti...@gmail.com>

    M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mizar32+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Martin Guy

unread,
May 14, 2013, 9:21:05 AM5/14/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
> You got any idea where is the problem? uIP?

That's a big question. It could be one of many things, and whether
it works for you is one test that may suggest the cause.
To apply most debugging methods, you have to be able to repeat the
failure. At present I only have it failing on your network and my
colleague's home network, with you using your firmware from the Web
Builder and him using his own firmware that he has been modifying to
improve other areas. That's why I ask you to test SM's 0.8 release
binary and eluaproject's 0.9 Mizar32 binary, reducing the problem to
bugs in those firmwares, problems with your Mizar32 hardware and the
setup of your home network.

M

Gabriel Duarte

unread,
May 14, 2013, 8:57:27 PM5/14/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hello Martin!

With this firmware you sent me, I cant get even access to eLua's command line, be through screen or Goat :/ This firmware is compiled with UART support?

I could not find how to build eLua 0.9 from eLua Web builder, only 0.8.

I have tested SM's 0.8, elua_lua_at32uc3a0256.hex, from mizar32-firmware-20120123.tgz and does not work anyway :(


2013/5/14 Martin Guy <marti...@gmail.com>

   M

_______________________________________________
eLua-dev mailing list
eLua...@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/elua-dev

Martin Guy

unread,
May 15, 2013, 8:23:02 AM5/15/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
> With this firmware you sent me, I cant get even access to eLua's command
> line, be through screen or Goat :/ This firmware is compiled with UART
> support?

No, console is on USB. Or yes, the virtual UART on the USB port.

> I could not find how to build eLua 0.9 from eLua Web builder, only 0.8.

For 0.9 with web builder, you can use the "Mizar32 WEB Builder (branch
master)" interface. I didn't write the web builder, but it looks like
it fetches the latest sources from github.com

> I have tested SM's 0.8, elua_lua_at32uc3a0256.hex, from
> mizar32-firmware-20120123.tgz and does not work anyway :(

Please be more specific. What exact commands are you using? What
output do you get? What "does not work"?

M

Gabriel Duarte

unread,
May 15, 2013, 12:36:49 PM5/15/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
I will try to deploy this firmware tonight and I let you know what happens. I will describe which commmands I've used to either burn the firmware and access eLua's console.

One thing I can assure you is that I used screen to accees the serial with the following parameters:


screen /dev/ttyUSB0 8n1

With SM's 0.8 based firmware, it works fine, but with the 0.9 you sent me, I cant access eLua's console.







2013/5/15 Vagner nascimento <vagnerna...@gmail.com>
Hi Grabriel,

About eLua Web Build, in a couple of days the new version will be working with eLua 0.9 . We are reimplementing some modules to support the new eLua build system written in Lua.
Will be announced here soon.

Best,
Vagner

Martin Guy

unread,
May 15, 2013, 2:30:39 PM5/15/13
to miz...@googlegroups.com
OK, I've found one problem.

The web builder defines BUILD_DHCP but the correct define is
BUILD_DHCPC... so the firmware it produces never enables DHCP, if you
select it or not, and always uses fixed IP addresses. This explains
why it always appeared as 192.168.1.* for you!

The web builder's author has fixed this but it's still giving me
problems with DHCP and with net.lookup. From my tests I fear that we
have compiler bugs in Atmel's toolchain.

Can I ask you to try this firmware, which is working for me with DHCP
and with net.lookup() also?

Sorry about this...

M
elua_lualong_at32uc3a0256_mizar32_0.9rc2.hex.gz

Gabriel Duarte

unread,
May 15, 2013, 2:36:14 PM5/15/13
to Martin Guy, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Cool! At least one bug found and fixed :)

As I said before, tonight I will try to test this firmware! You don't need to be sorry, it is being a pleasure to help you and improve eLua and Mizar32 ecosystem :)


2013/5/15 Martin Guy <marti...@gmail.com>
Oops, got the Cc:s wrong...

Vagner nascimento

unread,
May 15, 2013, 10:30:24 AM5/15/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hi Grabriel,

About eLua Web Build, in a couple of days the new version will be working with eLua 0.9 . We are reimplementing some modules to support the new eLua build system written in Lua.
Will be announced here soon.

Best,
Vagner

Gabriel Duarte

unread,
May 15, 2013, 8:42:50 PM5/15/13
to Martin Guy, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hello!

So, good news, in steps/

1 - Before, I could not access eLua's shell because I was pointing to the wrong device, ttyUSB0 instead of ttyACM0. The device changed I do know why, but fortunatelly I saw the change in dmesg's output.


2 - It works!!!!!! net.lookup could resolve names and return the correct parameters to net.connect :D


I would like to help more if you need, be programming, giving ideas or reporting bugs!

Thanks for the good job and for helping me to solve my problem, now I can continue with my studies and development!


Cheers





2013/5/15 Gabriel Duarte <confu...@gmail.com>
mizar32_lookup_works.png

Gabriel Duarte

unread,
May 15, 2013, 8:56:39 PM5/15/13
to Martin Guy, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Ahhhh just to let you know... I have built a firmware from master branch and it does not work, only the firmware you sent me.


2013/5/15 Gabriel Duarte <confu...@gmail.com>

Gabriel Duarte

unread,
May 15, 2013, 8:59:20 PM5/15/13
to Martin Guy, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
The boad grabs an dynamic IP address but does not resolve with net.lookup...

What is the difference between these 2 branchs?


2013/5/15 Gabriel Duarte <confu...@gmail.com>

Martin Guy

unread,
May 16, 2013, 2:26:27 AM5/16/13
to Gabriel Duarte, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hi Gabriel
Thanks for your detailed feedback

> Before, I could not access eLua's shell because I was pointing to the wrong device, ttyUSB0 instead of ttyACM0.

OK thanks.

2 - It works!!!!!! net.lookup could resolve names and return the
correct parameters to net.connect :D

"It" == ??? -rc2? -rc1? Both? To find the bug I need to divide the
firmwares into ones that seem to work and those that are known to have
some problem.
I mean, I can test them here, but that doesn't mean that they work for you!

> I have built a firmware from master branch and it does not work, only the firmware you sent me.

OK, good to know you are seeing the same results as me. Thanks.

> What is the difference between these 2 branchs?

- The compiler (Atmel-GCC 3.4.1 on b.sm.it vs. my one built with ct-ng here)
- builder.simplemachines.it doesn't define BUILD_RTC so you get no
mizar32.rtc.*() Lua module, which was added since the web builder was
written. That "should" make no difference to net.*() but if it's the
kind of bug that corrupts memory at random, just adding one byte
changes what gets crapped on
- builder.sm.it is a 64-bit Linux, my laptop has 32-bit linux. That
should make no difference either! But I have seen that the Atmel
64-bit version generates binaries with 4 bytes more data than the same
32-bit version, due to padding a one-character variable to 8 bytes
instead of 4, and that would also move the rest of the data by 4 bytes
and change which variable get corrupted.
- something else that I haven't though of...

> I would like to help more if you need, be programming, giving ideas or reporting bugs!

Thanks. Do let me know if -rc1 or -rc2 show any bugs. I'll run some
more tests to see if I can find out what the deciding factor is. Of
course, I'm hoping that the cause is that my compiler works and
Atmel's doesn't but that's just my big-headedness ;-)

M

Martin Guy

unread,
May 16, 2013, 8:24:49 AM5/16/13
to Gabriel Duarte, eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
OK, I've tried all builds:
- elua-trunk-0.9 on 32-bit Ubuntu
- elua-trunk-0.9 on 64-bit Debian
- elua-webbuild-0.8 on simplemachines web builder
- elua-master-0.9 on simplemachines web builder
with compilers
- Atmel GNU Toolchain 3.4.1
- my ct-ng one

In all cases, with Atmel 3.4.1 toolchain they hang on net.lookup()
All the ct-ng builds work.

In the meantime, Atmel have released their GNU Toolchain 3.4.2, which
my ct-ng is based on, and all versions work OK with that too.

So it looks like Atmel 3.4.1 was generating wrong code, fixed in their
3.4.2 release.

I've updated the compiler that builder.simplemachines.it uses to Atmel
3.4.2, so the firmware generated by the web builder should work now.

Vagner, I suggest you update your web builder's avr32 toolchain to
Atmel 3.4.2 also.

And thanks to Gabriel for insisting about the bug! :)

(BTW, Gabriel, even with a working system it can happen that
net.lookup() returns 0, which seems to mean "I don't know", but trying
it again succeeds.
You might like to test for 0 and retry a few times if it does this)

M
Reply all
Reply to author
Forward
0 new messages