lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] New to Lwip - seeking suggestions on how to proceed


From: Kieran Mansley
Subject: Re: [lwip-users] New to Lwip - seeking suggestions on how to proceed
Date: Fri, 29 Jul 2011 13:35:57 +0100

On Tue, 2011-07-19 at 15:30 -0700, Richard Shinn wrote:
> Hello,
> 
>  
> 
> I am new to Lwip and am trying to get the unixsim example code
> running. I can compile it and run it. However, when I do ‘ifconfig’ I
> see that the address of the tap0 device is 192.168.0.1 instead of
> 192.168.0.2 as described by the README and, indeed, as specified in
> the code:
> 
>  
> 
> IP4_ADDR(&gw, 192,168,0,1)  
> 
> IP4_ADDR(&ipaddr, 192,168,0,2)         from main() in simhost.c
> 
>  
> 
> I’m confused as to why the interface is coming up with 192.168.0.1
> when it seems the code is setting it to 192.168.0.2

192.168.0.1 is the address at the Linux host's end of the link, so the
Linux host gets an interface with that address.  192.168.0.2 is the
address at the lwIP's end of the link, so the Linux host has no
interface with that address, but you should be able to ping it.  The
Linux host is acting as the gateway for the lwIP simhost application.

When I run simhost I see:

./simhost 
Host at 192.168.0.2 mask 255.255.255.0 gateway 192.168.0.1
System initialized.
TCP/IP initialized.
Applications started.


and ifconfig shows:

tap0      Link encap:Ethernet  HWaddr 06:5C:51:2E:55:27  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

I can then run ping, and it works:

ping 192.168.0.2
PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=1 ttl=255 time=0.412 ms
64 bytes from 192.168.0.2: icmp_seq=2 ttl=255 time=0.085 ms
64 bytes from 192.168.0.2: icmp_seq=3 ttl=255 time=0.088 ms

lsmod shows me there are two users of the tun modules:

lsmod | grep tun
tun                    11716  2 

and if I kill the simhost client this drops to zero and the tap0
interface goes away.

I haven't tried on the latest Fedora, but this is on an older version of
Fedora, and I'd be surprised if that difference caused any problems.

> The README specifies that the tap interface must be enabled. I’m
> running the latest version of Fedora and I assume (though perhaps
> wrongly) that the tap interface is enabled since a pingable tap0
> interface comes up with address 192.168.0.1. But, I haven’t been able
> to determine, for certain, whether the interface is, in fact, enabled.
> In any case, I see a /dev/net/tun file but do not see any tap devices
> under /dev. Does this mean that my interface is, in fact, not enabled?

If you're getting the tap interface come up and /dev/net/tun exists then
that is hopeful.  I usually "modprobe tun" before running the simhost
example to make sure it is loaded so worth checking that.

> I am trying to get a proof of concept up and running in which I run my
> companies security software on top of Lwip instead of the native
> stack. I’m guessing that the easiest way to do this would probably be
> to bring up the example code and then figure out how to modify it to
> run our code. Does this sound like a reasonable approach?

It rather depends on what you're aiming for as to whether the unix
example project is a good example to follow.  I think it's unlikely
you'll want to actually use the tap interfaces in your product, so the
unixsim example might not be a good route to follow. If you have any
more details about what you're aiming for I'll try and advise.

Thanks

Kieran





reply via email to

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