Changeset f4c118d in rtems


Ignore:
Timestamp:
03/27/02 14:36:07 (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
6d00095
Parents:
90f30c8
Message:

2002-03-27 Ilya Alexeev <ilya@…>

  • PR162
  • net/if_ppp.c ppp_txdaemon(), net/if_pppvar.h pppstart(): Local variables must not be used in a device write routines. Now ppp_softc structure have own character for writing to device (sc_outchar). I think that converting local variables to static is not a right solution, because problems will occur in the case of two or more ppp instances.
  • net/ppp_tty.c pppstart(): Type of the ioffset variable must be u_long, otherwise in the case of the big output packet endless loop may occur.
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libnetworking/ChangeLog

    r90f30c8 rf4c118d  
     12002-03-27      Ilya Alexeev <ilya@continuum.ru>
     2
     3        * PR162
     4        * net/if_ppp.c ppp_txdaemon(), net/if_pppvar.h pppstart(): Local
     5        variables must not be used in a device write routines.  Now
     6        ppp_softc structure have own character for writing to device
     7        (sc_outchar).  I think that converting local variables to static
     8        is not a right solution, because problems will occur in the case
     9        of two or more ppp instances.
     10        * net/ppp_tty.c pppstart(): Type of the ioffset variable must be
     11        u_long, otherwise in the case of the big output packet endless
     12        loop may occur.
     13
    1142002-03-21      Ilya Alexeev <ilya@continuum.ru>
    215
  • c/src/exec/libnetworking/net/if_ppp.c

    r90f30c8 rf4c118d  
    244244{
    245245  rtems_event_set             events;
    246   char                        cFrame   = (char              )PPP_FLAG;
    247246  int                         iprocess = (int               )0;
    248247  struct ppp_softc           *sc       = (struct ppp_softc *)arg;
     
    352351 
    353352        /* write out frame byte to start the transmission */
    354         (*tp->device.write)(tp->minor, &cFrame, 1);
     353        sc->sc_outchar = (u_char)PPP_FLAG;
     354        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    355355      }
    356356
  • c/src/exec/libnetworking/net/if_pppvar.h

    r90f30c8 rf4c118d  
    106106        u_char  sc_outfcsbuf[8];             /* output packet fcs buffer */
    107107        u_char *sc_outbuf;                   /* pointer to output data */
     108        u_char  sc_outchar;
    108109
    109110        rtems_id sc_rxtask;
  • c/src/exec/libnetworking/net/ppp_tty.c

    r90f30c8 rf4c118d  
    563563pppstart(struct rtems_termios_tty *tp)
    564564{
    565   char                c;
    566565  char               *sendBegin;
    567   char                cFrame  = (char         )PPP_FLAG;
    568   u_char              ioffset = (u_char       )0;
     566  u_long              ioffset = (u_long       )0;
    569567  struct mbuf        *m       = (struct mbuf *)0;
    570568  struct ppp_softc   *sc      = tp->t_sc;
     
    597595        /* done with this packet */
    598596        sc->sc_outflag &= ~SC_TX_BUSY;
    599         (*tp->device.write)(tp->minor, &cFrame, 1);
     597        sc->sc_outchar = (u_char)PPP_FLAG;
     598        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    600599        rtems_event_send(sc->sc_txtask, TX_TRANSMIT);
    601600      }
     
    605604    if ( sc->sc_outoff < sc->sc_outlen ) {
    606605      /* check to see if character needs to be escaped */
    607       c = sc->sc_outbuf[sc->sc_outoff];
    608       if ( ESCAPE_P(c) ) {
     606      sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff];
     607      if ( ESCAPE_P(sc->sc_outchar) ) {
    609608        if ( sc->sc_outflag & SC_TX_ESCAPE ) {
    610609          /* last sent character was the escape character */
    611           c = c ^ PPP_TRANS;
     610          sc->sc_outchar = sc->sc_outchar ^ PPP_TRANS;
    612611
    613612          /* clear the escape flag and increment the offset */
     
    617616        else {
    618617          /* need to send the escape character */
    619           c = PPP_ESCAPE;
     618          sc->sc_outchar = PPP_ESCAPE;
    620619
    621620          /* set the escape flag */
    622621          sc->sc_outflag |= SC_TX_ESCAPE;
    623622        }
    624         sendBegin = &c;
     623        sendBegin = &sc->sc_outchar;
    625624      }
    626625      else {
    627626        /* escape not needed - increment the offset as much as possible */
    628         while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
     627        while ((!ESCAPE_P(sc->sc_outchar)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
    629628            ioffset++;
    630             c = sc->sc_outbuf[sc->sc_outoff + ioffset];
     629            sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff + ioffset];
    631630        }
    632631        sendBegin = &sc->sc_outbuf[sc->sc_outoff];
  • c/src/libnetworking/ChangeLog

    r90f30c8 rf4c118d  
     12002-03-27      Ilya Alexeev <ilya@continuum.ru>
     2
     3        * PR162
     4        * net/if_ppp.c ppp_txdaemon(), net/if_pppvar.h pppstart(): Local
     5        variables must not be used in a device write routines.  Now
     6        ppp_softc structure have own character for writing to device
     7        (sc_outchar).  I think that converting local variables to static
     8        is not a right solution, because problems will occur in the case
     9        of two or more ppp instances.
     10        * net/ppp_tty.c pppstart(): Type of the ioffset variable must be
     11        u_long, otherwise in the case of the big output packet endless
     12        loop may occur.
     13
    1142002-03-21      Ilya Alexeev <ilya@continuum.ru>
    215
  • c/src/libnetworking/net/if_ppp.c

    r90f30c8 rf4c118d  
    244244{
    245245  rtems_event_set             events;
    246   char                        cFrame   = (char              )PPP_FLAG;
    247246  int                         iprocess = (int               )0;
    248247  struct ppp_softc           *sc       = (struct ppp_softc *)arg;
     
    352351 
    353352        /* write out frame byte to start the transmission */
    354         (*tp->device.write)(tp->minor, &cFrame, 1);
     353        sc->sc_outchar = (u_char)PPP_FLAG;
     354        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    355355      }
    356356
  • c/src/libnetworking/net/if_pppvar.h

    r90f30c8 rf4c118d  
    106106        u_char  sc_outfcsbuf[8];             /* output packet fcs buffer */
    107107        u_char *sc_outbuf;                   /* pointer to output data */
     108        u_char  sc_outchar;
    108109
    109110        rtems_id sc_rxtask;
  • c/src/libnetworking/net/ppp_tty.c

    r90f30c8 rf4c118d  
    563563pppstart(struct rtems_termios_tty *tp)
    564564{
    565   char                c;
    566565  char               *sendBegin;
    567   char                cFrame  = (char         )PPP_FLAG;
    568   u_char              ioffset = (u_char       )0;
     566  u_long              ioffset = (u_long       )0;
    569567  struct mbuf        *m       = (struct mbuf *)0;
    570568  struct ppp_softc   *sc      = tp->t_sc;
     
    597595        /* done with this packet */
    598596        sc->sc_outflag &= ~SC_TX_BUSY;
    599         (*tp->device.write)(tp->minor, &cFrame, 1);
     597        sc->sc_outchar = (u_char)PPP_FLAG;
     598        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    600599        rtems_event_send(sc->sc_txtask, TX_TRANSMIT);
    601600      }
     
    605604    if ( sc->sc_outoff < sc->sc_outlen ) {
    606605      /* check to see if character needs to be escaped */
    607       c = sc->sc_outbuf[sc->sc_outoff];
    608       if ( ESCAPE_P(c) ) {
     606      sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff];
     607      if ( ESCAPE_P(sc->sc_outchar) ) {
    609608        if ( sc->sc_outflag & SC_TX_ESCAPE ) {
    610609          /* last sent character was the escape character */
    611           c = c ^ PPP_TRANS;
     610          sc->sc_outchar = sc->sc_outchar ^ PPP_TRANS;
    612611
    613612          /* clear the escape flag and increment the offset */
     
    617616        else {
    618617          /* need to send the escape character */
    619           c = PPP_ESCAPE;
     618          sc->sc_outchar = PPP_ESCAPE;
    620619
    621620          /* set the escape flag */
    622621          sc->sc_outflag |= SC_TX_ESCAPE;
    623622        }
    624         sendBegin = &c;
     623        sendBegin = &sc->sc_outchar;
    625624      }
    626625      else {
    627626        /* escape not needed - increment the offset as much as possible */
    628         while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
     627        while ((!ESCAPE_P(sc->sc_outchar)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
    629628            ioffset++;
    630             c = sc->sc_outbuf[sc->sc_outoff + ioffset];
     629            sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff + ioffset];
    631630        }
    632631        sendBegin = &sc->sc_outbuf[sc->sc_outoff];
  • cpukit/libnetworking/ChangeLog

    r90f30c8 rf4c118d  
     12002-03-27      Ilya Alexeev <ilya@continuum.ru>
     2
     3        * PR162
     4        * net/if_ppp.c ppp_txdaemon(), net/if_pppvar.h pppstart(): Local
     5        variables must not be used in a device write routines.  Now
     6        ppp_softc structure have own character for writing to device
     7        (sc_outchar).  I think that converting local variables to static
     8        is not a right solution, because problems will occur in the case
     9        of two or more ppp instances.
     10        * net/ppp_tty.c pppstart(): Type of the ioffset variable must be
     11        u_long, otherwise in the case of the big output packet endless
     12        loop may occur.
     13
    1142002-03-21      Ilya Alexeev <ilya@continuum.ru>
    215
  • cpukit/libnetworking/net/if_ppp.c

    r90f30c8 rf4c118d  
    244244{
    245245  rtems_event_set             events;
    246   char                        cFrame   = (char              )PPP_FLAG;
    247246  int                         iprocess = (int               )0;
    248247  struct ppp_softc           *sc       = (struct ppp_softc *)arg;
     
    352351 
    353352        /* write out frame byte to start the transmission */
    354         (*tp->device.write)(tp->minor, &cFrame, 1);
     353        sc->sc_outchar = (u_char)PPP_FLAG;
     354        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    355355      }
    356356
  • cpukit/libnetworking/net/if_pppvar.h

    r90f30c8 rf4c118d  
    106106        u_char  sc_outfcsbuf[8];             /* output packet fcs buffer */
    107107        u_char *sc_outbuf;                   /* pointer to output data */
     108        u_char  sc_outchar;
    108109
    109110        rtems_id sc_rxtask;
  • cpukit/libnetworking/net/ppp_tty.c

    r90f30c8 rf4c118d  
    563563pppstart(struct rtems_termios_tty *tp)
    564564{
    565   char                c;
    566565  char               *sendBegin;
    567   char                cFrame  = (char         )PPP_FLAG;
    568   u_char              ioffset = (u_char       )0;
     566  u_long              ioffset = (u_long       )0;
    569567  struct mbuf        *m       = (struct mbuf *)0;
    570568  struct ppp_softc   *sc      = tp->t_sc;
     
    597595        /* done with this packet */
    598596        sc->sc_outflag &= ~SC_TX_BUSY;
    599         (*tp->device.write)(tp->minor, &cFrame, 1);
     597        sc->sc_outchar = (u_char)PPP_FLAG;
     598        (*tp->device.write)(tp->minor, &sc->sc_outchar, 1);
    600599        rtems_event_send(sc->sc_txtask, TX_TRANSMIT);
    601600      }
     
    605604    if ( sc->sc_outoff < sc->sc_outlen ) {
    606605      /* check to see if character needs to be escaped */
    607       c = sc->sc_outbuf[sc->sc_outoff];
    608       if ( ESCAPE_P(c) ) {
     606      sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff];
     607      if ( ESCAPE_P(sc->sc_outchar) ) {
    609608        if ( sc->sc_outflag & SC_TX_ESCAPE ) {
    610609          /* last sent character was the escape character */
    611           c = c ^ PPP_TRANS;
     610          sc->sc_outchar = sc->sc_outchar ^ PPP_TRANS;
    612611
    613612          /* clear the escape flag and increment the offset */
     
    617616        else {
    618617          /* need to send the escape character */
    619           c = PPP_ESCAPE;
     618          sc->sc_outchar = PPP_ESCAPE;
    620619
    621620          /* set the escape flag */
    622621          sc->sc_outflag |= SC_TX_ESCAPE;
    623622        }
    624         sendBegin = &c;
     623        sendBegin = &sc->sc_outchar;
    625624      }
    626625      else {
    627626        /* escape not needed - increment the offset as much as possible */
    628         while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
     627        while ((!ESCAPE_P(sc->sc_outchar)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
    629628            ioffset++;
    630             c = sc->sc_outbuf[sc->sc_outoff + ioffset];
     629            sc->sc_outchar = sc->sc_outbuf[sc->sc_outoff + ioffset];
    631630        }
    632631        sendBegin = &sc->sc_outbuf[sc->sc_outoff];
Note: See TracChangeset for help on using the changeset viewer.