lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] dns_gethostbyname


From: Sandra Gilge
Subject: Re: [lwip-users] dns_gethostbyname
Date: Tue, 5 May 2015 11:27:48 +0200

Hallo Christoph,

I think the tcpip_callback_with_block is the right solution for me. Many
thanks for that hint.

But I wonder how I can pass several parameters to dns_gethostbyname then. Is
it done in a struct?
Dns_gethostbyname has four parameters:
dns_gethostbyname (const char *hostname, struct ip_addr *addr,
dns_found_callback  found,
                void *callback_arg)

As far as I understand a message is sent to tcpip_thread with
functionpointer and pointer to parameter as payload of that message. 

Best regards,
Sandra


-----Ursprüngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Im Auftrag von
address@hidden
Gesendet: Montag, 4. Mai 2015 18:00
An: address@hidden
Betreff: lwip-users Digest, Vol 141, Issue 4

Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific than
"Re: Contents of lwip-users digest..."


Today's Topics:

   1. Re: dns_gethostbyname (Krzysztof Weso?owski)
   2. Unix port does not work on Ubuntu 14.04 (Edgar Bonet)


----------------------------------------------------------------------

Message: 1
Date: Sun, 3 May 2015 20:15:59 +0200
From: Krzysztof Weso?owski <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Subject: Re: [lwip-users] dns_gethostbyname
Message-ID:
        <address@hidden>
Content-Type: text/plain; charset="utf-8"

Hi there,


What do you mean with "You can however post your callback to be executed on
> lwip thread"?

What callback do you talk about, the callback function that is given as
> parameter in the dns_gethostbyname?


both "netconn api" and "socket api use "raw api" under the hood, those APIs
handle inter thread communication for you.

You can do something similar if you need to execute code on tcpip_thread
from your code. Just use function:

tcpip_callback_with_block

This function simply takes function pointer, void * argument (to pass
additional context to your function if it is needed), and uses RTOS
mechanisms to execute in on tcpip thread (extra argument determines if
current thread will block until execution on tcpip thread completes).

You need to prepare your own functions:
- one responsible for starting request, which will call dns_gethostbyname
and will be passed to tcpip_callback_with_block,
- one responsible for handling result of request, passed to
dns_gethostbyname. This function will be called by dns code on tcpip thread
when requests completes.

Unfortunately I do not have sample at hand.

Regards,
Krzysztof Weso?owski
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.nongnu.org/archive/html/lwip-users/attachments/20150503/44f766
12/attachment.html>

------------------------------

Message: 2
Date: Mon, 04 May 2015 10:01:51 +0200
From: Edgar Bonet <address@hidden>
To: address@hidden
Subject: [lwip-users] Unix port does not work on Ubuntu 14.04
Message-ID: <address@hidden>
Content-Type: text/plain; charset=utf-8; format=flowed

Hello every one!

I am new to lwIP and to this list. Right now I am just trying to get the
Unix port work on my box (Ubuntu 14.04 on x86_64) in order to get started
with lwIP. My understanding is that echop (minimal project) and unixsim (the
development platform, according to the README) are good starting points...
but I am struggling to get these work.

What I did is basically the following:

     # Get a development snapshot
     git clone --depth 1 git://git.sv.gnu.org/lwip.git
     git clone --depth 1 git://git.sv.gnu.org/lwip/lwip-contrib.git

     # First, try the minimal project
     cd lwip-contrib/ports/unix/proj/minimal
     make  # -> fail
     # fix the compile errors
     make  # -> success
     sudo ./echop  # test -> fail

     # Next, try simhost
     cd ../unixsim
     make  # -> fail
     # fix the compile errors
     make  # -> success
     sudo ./simhost  # test -> fail

As shown above, I had to edit a few files in order to get this compile.
Here is the list of the edits, as patches attached to this message:

   * patches to lwip:

     + define-fd-set-val.patch:
         In src/include/lwip/sockets.h, define FD_SET_VAL() if needed. Do
         not assume defined(FD_SET) implies defined(FD_SET_VAL).

     + const-mib_node.patch
         In src/core/snmp/mib2.c, add a const qualifier to a struct
         mib_node* array. This array is used to initialize a struct
         mib_array_node which requires the qualifier.

   * patches to lwip-contrib:

     + contrib-const-mib_node.patch
         Same as above, but for several arrays in
         apps/snmp_private_mib/lwip_prvmib.c.

     + snmp_set_stuff-nbargs.patch
         In ports/unix/proj/minimal/main.c, call snmp_set_syscontact()
         and snmp_set_syslocation() with the proper number of arguments
         (3 instead of 2).

Now that it compiles, the results of my tests are the following:

   * Both echop and simhost create a tap0 interface bound to
     192.168.0.1/24 on the Linux side. Both display, upon startup, the
     message:

         Host at 192.168.0.2 mask 255.255.255.0 gateway 192.168.0.1

     Both respond to arp and ping requests to 192.168.0.2. However, TCP
     connection requests (on port 7 for echop and port 80 for simhost)
     are not answered. According to Wireshark, the SYN packets are just
     silently dropped.

   * On echop, the -d (debug) option has no effect. On simhost, this
     same option triggers a very verbose output. When simhost receives a
     TCP SYN while in verbose mode, it outputs

         ip_route: No route to 192.168.0.1

     This makes little sense to me: 192.168.0.1 is on the same local net
     (192.168.0.0/24) than simhost itself, how come it cannot find the
     route?

   * Stracing echop shows that it reads all the incoming packets from
     /dev/net/tun and writes the replies (arp and ping) to the same
     special file. Nothing is written in response to TCP SYNs.

Now I come with a lot of questions: Is this the proper venue to get help on
debugging all this? Should I go to lwip-devel instead? What should I do with
my patches? Should I open a bug on the savannah bug tracker for each of
them? If so, should I attach the patch to the bug or put it on the patch
tracker instead? Anyone an idea on how to debug the "No route to
192.168.0.1" problem? Anyone managed to get this Unix port working on a
Debian-like system?

Oh, BTW, I also tried the 1.4.1 release: simhost works fine on that version
(after applying a different set of patches to make it compile):
I can see a nice web page on http://192.168.0.2/ . echop does not work.

Regards,

Edgar Bonet.

PS: This is the second time I am sending this message. First time was last
Thursday, and it did not get through. At this point I assume it has been
dropped, not just delayed. This time I am omitting the patches that where
originally attached, on the assumption that the list server may just be
filtering out any message with attachments.



------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

End of lwip-users Digest, Vol 141, Issue 4
******************************************




reply via email to

[Prev in Thread] Current Thread [Next in Thread]