[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip minimal example, echo server
From: |
Sergio R. Caprile |
Subject: |
Re: [lwip-users] lwip minimal example, echo server |
Date: |
Fri, 10 Oct 2014 09:31:41 -0300 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Even though my name is on that bug report (I reopened it), I completely
forgot about that.
I don't even remember how I got there, though I do remember doing step
by step debugging and finding those flags. Somehow the wireshark capture
led me there but I don't remember the symptoms.
Simon reported it's been patched in git HEAD anyway.
On 03/10/2014 10:27 a.m., Sergio R. Caprile wrote:
> OK, here I go...
> The UN*X examples use a tun/tap device, and there is a specific
> configuration parameter for different flavors of it. Check the Makefile
> for this, did you ?
> #To compile for linux: make ARCH=linux
> #To compile for cygwin: make ARCH=cygwin
> #To compile for openbsd: make ARCH=openbsd
> ARCH=linux
> Once you have the correct tun or tap device, it will show up in your
> ifconfig and you will be able to ping the lwIP stack as a new machine on
> a new network, which is what you should do first when debugging
> networking problems.
>
> In main.c:
> /* startup defaults (may be overridden by one or more opts) */
> IP4_ADDR(&gw, 192,168,0,1);
> IP4_ADDR(&ipaddr, 192,168,0,2);
> IP4_ADDR(&netmask, 255,255,255,0);
>
> So, 192.168.0.1 will be the address of the gateway in your machine to
> "the lwIP network", via a tun or tap interface. In Linux seems to be tap
>
> tap0 Link encap:Ethernet HWaddr 86:99:D8:CE:27:DC
> inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
> inet6 addr: fe80::8499:d8ff:fece:27dc/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:500
> RX bytes:0 (0.0 b) TX bytes:468 (468.0 b)
>
> The specifics to get the tap working are beyond my knowledge, I remember
> I just followed a tutorial. The interface will be up once the example is
> running, and will dissappear after that.
> Anyway, you should be able to ping that interface to check if the tap is
> working.
>
> And, 192.168.0.2 will be your "lwIP machine" address, you should be
> able to ping it
>
> address@hidden minimal]# 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=8.76 ms
> 64 bytes from 192.168.0.2: icmp_seq=2 ttl=255 time=9.66 ms
>
> --- 192.168.0.2 ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 999ms
> rtt min/avg/max/mdev = 8.766/9.214/9.663/0.458 ms
>
> and you should be able to telnet to it in port 7, cause no one knows if
> your
>
> SimpleEchoClient really works, although you probably will.
>
>
> address@hidden minimal]# telnet 192.168.0.2 7
> Trying 192.168.0.2...
> Connected to 192.168.0.2.
> Escape character is '^]'.
> hola
> hola
>
> You probably noticed I run this as root... there are some permissions
> associated to the tap interface, and I'm lazy enough to change them.
> Anyway, you should see something like this:
> tapif: tapif_init: open: Permission denied
> if that is the case.
>
>
--
-------------------------------------------------
Sergio R. Caprile, Human Being, Bs.As., Argentina
Electronics Engineer, Musician (guitarist), TaoFx
http://www.scaprile.ldir.com.ar/
-------------------------------------------------