Further questions about LWIP/HTTP server

Christian Helmuth christian.helmuth at ...1...
Mon Mar 1 16:17:05 CET 2010


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
-- 
Christian Helmuth
Genode Labs

http://www.genode-labs.com/ · http://genode.org/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list