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

Problem in using PPP & Ethernet Interface, together, with TCP/IP



Hi All,

We are facing problems when we activate two interfaces viz. Ethernet and PPP to the TCP/IP stack on RTEMS 4.9.4.
The system crashes at below code in the function ip_ouput().
   /*
    * Verify that we have any chance at all of being able to queue
    *      the packet or packet fragments
    */

    if ((ifp->if_snd.ifq_len + ip->ip_len / ifp->if_mtu + 1) >=
       ifp->if_snd.ifq_maxlen)

In the above code / ifp->if_mtu evaluates to zero since it is referring to some wrong ifp. This ifp points to a structure which has all members as zero.
Surprisingly this piece of code is executed only when we activate both Ethernet and PPP simultaneously. It does not get called when only PPP is attached.
When we check the global structure ifnet we can see that it has proper values for both the interfaces. But somehow when it comes to ip_output() it is not able to find the correct values.
Below is the sequence in which the ip_output() is called:
rtems_pppd_connect() --->rtems_event_send()--->pppdTask()--->pppdmain() --->
udp_usrreq (struct socket *so, int req......) ----> case PRU_SEND: ---->
udp_output (struct inpcb *inp, struct mbuf *m....) ----> ip_output (struct mbuf *m0, struct mbuf *opt...)

Also,
- no crashes are observed before doing the ppp initializtion, and we can successfully send and receive TCP/IP on Ethernet
- no crashes were observed before when only the ppp interface was present, and the PPP could place calls and transfer TCP/IP, SSL etc. successfully
Please refer below structures and code which we have used for the initialization.
1) Config structure for Ethernet interface

    static struct rtems_bsdnet_ifconfig eth_netdriver_config =
   {
       ETH_DEV_NAME,              /* name */
       &GC_eth_driver_attach,      /* attach function */

       // Chain the next adaptor:
        &ppp_netdriver_config,      /* Chain the PPP interface after the ETH adapter */
         NULL,                     /* No more interfaces */
       NULL,                      /* IP address */
       NULL,                      /* IP net mask */
       NULL,                      /* Driver supplies hardware address */
       0                          /* Use default driver parameters */
   };
The IP address and netmask in the above structure is initialized at system startup before calling rtems_bsdnet_initialize_network().

2) Config structure for PPP interface
    static struct rtems_bsdnet_ifconfig ppp_netdriver_config =
   {
       PPP_DEV_NAME,              /* name */
       rtems_ppp_driver_attach,   /* attach function */
       // Chain the next adaptor:
       NULL,                     /* No more interfaces */
       NULL,                      /* IP address */
       NULL,                      /* IP net mask */
       NULL,                      /* Driver supplies hardware address */
       0                          /* Use default driver parameters */
   };

struct rtems_bsdnet_config rtems_bsdnet_config =
{
    &ppp_netdriver_config,
    &eth_netdriver_config,
    NULL,               /* BOOTP */
   30,                 /* Default network task priority */
   (128*1024),         /* Default mbuf capacity */
   (256*1024),         /* Default mbuf cluster capacity */
   0,                  /* Host name */
   0,                  /* Domain name */
   0,                  /* Gateway */
   0,                  /* Log host */
   { 0 },              /* Name server(s) */
   { 0 },              /* NTP server(s) */
                   /* sb_efficiency */
                   /*udp_tx_buf_size*/
                   /*udp_rx_buf_size*/
                   /*tcp_tx_buf_size*/
                   /*tcp_rx_buf_size*/
};

After this we set following options for the PPP interface.
    // set default pppd options
     rtems_pppd_set_option("crtscts", NULL);
     rtems_pppd_set_option("modem", NULL);
     rtems_pppd_set_option("defaultroute", NULL);
     rtems_pppd_set_option("ipcp-accept-remote", NULL);
     rtems_pppd_set_option("lcp-echo-failure", "5");
     rtems_pppd_set_option("lcp-echo-interval", "5");
     rtems_pppd_set_option("lock", NULL);
     rtems_pppd_set_option("nodetach", NULL);
     rtems_pppd_set_option("nopersist", NULL);
     rtems_pppd_set_option("usepeerdns", NULL);
     rtems_pppd_set_option("init", NULL);
     rtems_pppd_set_option("disconnect", NULL);
     rtems_pppd_set_option("/dev/ttyS3", NULL);
     rtems_pppd_set_option("mru", "296");
     rtems_pppd_set_option("mtu", "296");
     rtems_pppd_set_option("novj", NULL);

Can someone who has used two interfaces over TCP/IP have faced a similar problem or anyone can guide what is wrong?


Thanks & Regards,

Viral Shah



________________________________
Information contained and transmitted by this e-mail is confidential and proprietary to Patni Computer Systems Ltd and its affiliates (hitherto referred as Patni Computers) and is intended for use only by the recipient. If you are not the intended recipient , you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or netadmin at patni.com. Patni Computers does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of Patni Computers. Patni Computers is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While Patni Computers has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about Patni Computers please visit www.patni.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rtems.org/pipermail/rtems-users/attachments/20110301/f7257bef/attachment.html>