lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Problems using "chargen" sample code


From: Maddala Subrahmanyam
Subject: [lwip-users] Problems using "chargen" sample code
Date: Wed, 19 Jan 2005 18:02:58 -0800 (PST)

Hi David,

I have been trying to understand LwIP by using the "chargen" application sample code.
I copied the chargen.c file from ./contrib/apps/chargen directory to
/net/contrib/ports/unix/proj/unixsim directory.

I made necessary changes to chargen.c
The main() routine and chargen_init() looks as below after modifications.

void chargen_init(void)
{
  sys_thread_new(chargen_thread, 0, CHARGEN_PRIORITY);
  pause();
}

int main(int argc, char *argv[])
{
      struct ip_addr ipaddr, netmask, gw;
      sys_sem_t sem;

#if LWIP_STATS
      stats_init();
#endif /* STATS */
      sys_init();
      mem_init();
      memp_init();
      pbuf_init();
#ifdef LWIP_TCPDUMP
      tcpdump_init();
#endif
      sem = sys_sem_new(0);
      tcpip_init(tcpip_init_done, &sem);
      sys_sem_wait(sem);
      sys_sem_free(sem);

      netif_init();
      printf("TCP/IP  initialized.\n");

      IP4_ADDR(&gw, 192,168,0,1);
      IP4_ADDR(&ipaddr, 192,168,0,2);
      IP4_ADDR(&netmask, 255,255,255,0);

      netif_set_default(netif_add(&netif,&ipaddr, &netmask, &gw, NULL,
                              tapif_init, tcpip_input));
      chargen_init();
      /* Block for ever */
      sem = sys_sem_new(0);
      sys_sem_wait(sem);

      return 0;
}

And I substituted chargen in place of simhost  in the Makefile under /unixsim.
I could build the sources and get chargen running.

I believe this code should work as expected over the tap0 interface on a standalone
machine(as it is suppose to run between two different machines).  I mean to say, if I
$ telnet 192.168.0.2  19

from a termial on the same machine, isn't it suppose to throw some garbage as explained
in the README file of chargen?
I see lots of "packet not for us" messages.

I copied the initial portion of my debug log below this message for further reference.

I'm new to LwIP, so please correct me if I'm wrong.

Thanks in advance,
subbu

blrk43fx:/home/subbu/SBOX/s3c2410_kernel2.4.18_r1.1/net/contrib/ports/unix/proj/unixsim
# ./chargen
TCP/IP  initialized.
netif_set_ipaddr: netif address being changed
netif: IP address of interface  set to 192.168.0.2
netif: netmask of interface  set to 255.255.255.0
netif: GW address of interface  set to 192.168.0.1
tapif_init: fd 3
tapif_init: system("ifconfig tap0 inet 192.168.0.1");
sys_timeout: 0x80652f0 msecs=5000 h=0x8054f77 arg=(nil)
netif: added interface tp IP addr 192.168.0.2 netmask 255.255.255.0 gw
192.168.0.1
netif: setting default interface tp
Application Started.
sys_mbox_post: mbox 0x806b148 msg 0x80651b0
sys_mbox_fetch: mbox 0x806b148 msg 0x4008b560
tcpip_thread: API message 0x80651b0
sys_mbox_post: mbox 0x806b4e0 msg (nil)
sys_mbox_fetch: mbox 0x806b4e0, null msg
lwip_socket(PF_INET, SOCK_STREAM, 0) = 0
lwip_bind(0, addr=0.0.0.0 port=19)
sys_mbox_post: mbox 0x806b148 msg 0x80651b0
sys_mbox_fetch: mbox 0x806b148 msg 0x80651b0
tcpip_thread: API message 0x80651b0
tcp_bind: bind to port 19
sys_mbox_post: mbox 0x806b4e0 msg (nil)
sys_mbox_fetch: mbox 0x806b4e0, null msg
lwip_bind(0) succeeded
lwip_listen(0, backlog=5)
sys_mbox_post: mbox 0x806b148 msg 0x80651b0
sys_mbox_fetch: mbox 0x806b148 msg 0x80651b0
tcpip_thread: API message 0x80651b0
sys_mbox_post: mbox 0x806b4e0 msg (nil)
sys_mbox_fetch: mbox 0x806b4e0, null msg
lwip_select(1, 0x4077c9f0, 0x4077c970, (nil), tvsec=-1 tvusec=-1)
tapif_input: ARP packet
update_arp_entry()
update_arp_entry: 192.168.0.1 - 00:ff:7c:f3:20:08
find_entry: found empty entry 0
find_entry: selecting empty entry 0
update_arp_entry: updating stable entry 0
etharp_arp_input: incoming ARP request
etharp_arp_input: replying to ARP request for our IP address
tapif_input: IP packet
etharp_ip_input: updating ETHARP table.
update_arp_entry()
update_arp_entry: 192.168.0.1 - 00:ff:7c:f3:20:08
find_entry: found matching stable entry 0
update_arp_entry: updating stable entry 0
sys_mbox_post: mbox 0x806b148 msg 0x80651b0
sys_mbox_fetch: mbox 0x806b148 msg 0x80651b0
tcpip_thread: IP packet 0x80651b0
lwip_chksum(0x806537e, 20)
inet: chksum: no odd byte
ip_input: iphdr->dest 0x200a8c0 netif->ip_addr 0x200a8c0 (0xa8c0,
0xa8c0, 0x2000000)
ip_input: packet not for us.
ip_forward: not bouncing packets back on incoming interface.
tapif_input: IP packet
etharp_ip_input: updating ETHARP table.
update_arp_entry()
update_arp_entry: 192.168.0.1 - 00:ff:7c:f3:20:08
find_entry: found matching stable entry 0
update_arp_entry: updating stable entry 0
sys_mbox_post: mbox 0x806b148 msg 0x80651b0
sys_mbox_fetch: mbox 0x806b148 msg 0x80651b0
tcpip_thread: IP packet 0x80651b0
lwip_chksum(0x806537e, 20)
inet: chksum: no odd byte
ip_input: iphdr->dest 0x200a8c0 netif->ip_addr 0x200a8c0 (0xa8c0,
0xa8c0, 0x2000000)
ip_input: packet not for us.
ip_forward: not bouncing packets back on incoming interface.


Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
reply via email to

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