Further questions about LWIP/HTTP server

Stefan Kalkowski stefan.kalkowski at ...1...
Mon Mar 1 17:21:57 CET 2010


On Monday, 1. March 2010 16:17:05 Christian Helmuth wrote:
> Hello Peter,
>
> On Tue, Mar 02, 2010 at 12:20:15AM +1030, Peter Nguyen wrote:
> > Sorry, I should have mentioned more specifically what i was after. So, i
> > was referring to the http_server_serve function in the http server code,
> > whereby upon receiving a HTTP request, the struct netconn variable (conn)
> > seems to store IP addresses which I think refer to the IP address that
> > the HTTP request will be sent back to. In following the struct netconn
> > variable, I noticed two IP addresses are stored: a local IP, and a remote
> > IP. I discovered this via the following code that I added:
> >
> > addr = conn->pcb.ip->remote_ip.addr (remote_ip can be replaced by
> > local_ip)
>
> You're digging deep into lwIP here, that we just adopted for Genode,
> but I'll share my limited knowledge...
>
> > I was wondering what the purpose of the remote_ip and local_ip variables
> > were? Am i right in saying that remote_ip refers to the machine that
> > performed the HTTP request?
>
> 'pcb.ip' is the lwIP-internal protocol control block for IP packets
> [1]. Therefore, I assume that the fields (e.g., local_ip or tos)
> correspond to the connection configuration and will end as in the
> final network packet on the wire. Note, IP addresses are stored in
> network byte order [2].
>
> [1] lwip-1.3.2/src/include/lwip/api.h:114
> [2] lwip-1.3.2/src/include/ipv4/lwip/ip.h:76
>
> Regards

Hi Peter,

as Christian already mentioned, this code is related to the LwIP library and 
is not specific to Genode. If you have questions regarding the internals of 
LwIP, the lwip-users mailing list might be of value for you:
http://lists.nongnu.org/mailman/listinfo/lwip-users

Nevertheless, within Genode I recommend to not use the netconn interface 
directly, but use LwIP's BSD-like socket interface (lwip/socket.h) or our 
LwIP plugin for the libc, as its more convenient to use.
Regardless of what kind of interface you choose, I strongly recommend you to 
update to Genode's last release 10.02, as it contains a far-reaching rework 
of Genode's LwIP backend, including several bug-fixes. 

regards
-- 
Stefan Kalkowski
Genode Labs Developer
http://genode-labs.com




More information about the users mailing list