summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/src/exec/libblock/ChangeLog5
-rw-r--r--c/src/exec/libnetworking/ChangeLog5
-rw-r--r--c/src/exec/libnetworking/net/if_ppp.c32
-rw-r--r--c/src/exec/libnetworking/net/ppp_tty.c22
-rw-r--r--c/src/libblock/ChangeLog5
-rw-r--r--c/src/libnetworking/ChangeLog5
-rw-r--r--c/src/libnetworking/net/if_ppp.c32
-rw-r--r--c/src/libnetworking/net/ppp_tty.c22
8 files changed, 96 insertions, 32 deletions
diff --git a/c/src/exec/libblock/ChangeLog b/c/src/exec/libblock/ChangeLog
index dffc41ab88..325e8258d8 100644
--- a/c/src/exec/libblock/ChangeLog
+++ b/c/src/exec/libblock/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2002-03-21 Alexander Kukuta <kam@oktet.ru>
* src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch
diff --git a/c/src/exec/libnetworking/ChangeLog b/c/src/exec/libnetworking/ChangeLog
index 1a816f0d30..8305cf2bc0 100644
--- a/c/src/exec/libnetworking/ChangeLog
+++ b/c/src/exec/libnetworking/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2001-03-20 Till Straumann <strauman@SLAC.Stanford.EDU>
* PR158
diff --git a/c/src/exec/libnetworking/net/if_ppp.c b/c/src/exec/libnetworking/net/if_ppp.c
index 9fd7dde6f3..bb90eac78a 100644
--- a/c/src/exec/libnetworking/net/if_ppp.c
+++ b/c/src/exec/libnetworking/net/if_ppp.c
@@ -378,7 +378,7 @@ static void ppp_init(struct ppp_softc *sc)
/* check to see if we need to start up daemons */
if ( sc->sc_rxtask == 0 ) {
/* start rx daemon task */
- status = rtems_task_create(rtems_build_name('R','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_rxtask);
@@ -393,7 +393,7 @@ static void ppp_init(struct ppp_softc *sc)
}
/* start tx daemon task */
- status = rtems_task_create(rtems_build_name('T','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_txtask);
@@ -409,7 +409,8 @@ static void ppp_init(struct ppp_softc *sc)
}
/* mark driver running and output inactive */
- sc->sc_if.if_flags |= IFF_RUNNING;
+ /* ilya: IFF_RUNNING flag will be marked after the IPCP goes up */
+/* sc->sc_if.if_flags |= IFF_RUNNING; */
}
/*
@@ -417,12 +418,25 @@ static void ppp_init(struct ppp_softc *sc)
*/
int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
- int i = (int)0;
+/* int i = (int)0; */
struct ppp_softc *sc;
-
- for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ char *name;
+ int number;
+
+
+ number = rtems_bsdnet_parse_driver_name (config, &name);
+
+ if (!attaching || (number >= NPPP))
+ return 0;
+
+ sc = &ppp_softc[number];
+
+ if (sc->sc_if.if_name != NULL)
+ return 0; /* interface is already attached */
+
+/* for (sc = ppp_softc; i < NPPP; sc++) { */
+ sc->sc_if.if_name = name /*"ppp"*/;
+ sc->sc_if.if_unit = number /*i++*/;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
@@ -441,7 +455,7 @@ int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
#if NBPFILTER > 0
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
- }
+/* } */
return ( 1 );
}
diff --git a/c/src/exec/libnetworking/net/ppp_tty.c b/c/src/exec/libnetworking/net/ppp_tty.c
index cab3278f30..b655fd4f04 100644
--- a/c/src/exec/libnetworking/net/ppp_tty.c
+++ b/c/src/exec/libnetworking/net/ppp_tty.c
@@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty)
int i;
register struct ppp_softc *sc;
struct mbuf *m = (struct mbuf *)0;
+ extern int termios_baud_to_number(int);
if (tty->t_line == PPPDISC) {
sc = (struct ppp_softc *)tty->t_sc;
@@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty)
/* initialize values */
sc->sc_if.if_flags |= IFF_RUNNING;
- sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */
+ sc->sc_if.if_baudrate =
+ termios_baud_to_number(tty->termios.c_cflag & CBAUD);
tty->t_sc = (void *)sc;
@@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
- int i;
+/* int i; */
int error = RTEMS_SUCCESSFUL;
int cmd = args->command;
caddr_t data = args->buffer;
@@ -561,6 +563,7 @@ int
pppstart(struct rtems_termios_tty *tp)
{
char c;
+ char *sendBegin;
char cFrame = (char )PPP_FLAG;
u_char ioffset = (u_char )0;
struct mbuf *m = (struct mbuf *)0;
@@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp)
/* set the escape flag */
sc->sc_outflag |= SC_TX_ESCAPE;
}
+ sendBegin = &c;
}
else {
- /* escape not needed - increment the offset */
- ioffset++;
+ /* escape not needed - increment the offset as much as possible */
+ while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
+ ioffset++;
+ c = sc->sc_outbuf[sc->sc_outoff + ioffset];
+ }
+ sendBegin = &sc->sc_outbuf[sc->sc_outoff];
}
- /* write out the character and update the stats */
- (*tp->device.write)(tp->minor, &c, 1);
- sc->sc_stats.ppp_obytes++;
+ /* write out the character(s) and update the stats */
+ (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1);
+ sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1;
sc->sc_outoff += ioffset;
}
}
diff --git a/c/src/libblock/ChangeLog b/c/src/libblock/ChangeLog
index dffc41ab88..325e8258d8 100644
--- a/c/src/libblock/ChangeLog
+++ b/c/src/libblock/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2002-03-21 Alexander Kukuta <kam@oktet.ru>
* src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch
diff --git a/c/src/libnetworking/ChangeLog b/c/src/libnetworking/ChangeLog
index 1a816f0d30..8305cf2bc0 100644
--- a/c/src/libnetworking/ChangeLog
+++ b/c/src/libnetworking/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-21 Ilya Alexeev <ilya@continuum.ru>
+
+ * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple
+ PPPD connections.
+
2001-03-20 Till Straumann <strauman@SLAC.Stanford.EDU>
* PR158
diff --git a/c/src/libnetworking/net/if_ppp.c b/c/src/libnetworking/net/if_ppp.c
index 9fd7dde6f3..bb90eac78a 100644
--- a/c/src/libnetworking/net/if_ppp.c
+++ b/c/src/libnetworking/net/if_ppp.c
@@ -378,7 +378,7 @@ static void ppp_init(struct ppp_softc *sc)
/* check to see if we need to start up daemons */
if ( sc->sc_rxtask == 0 ) {
/* start rx daemon task */
- status = rtems_task_create(rtems_build_name('R','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('R','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_rxtask);
@@ -393,7 +393,7 @@ static void ppp_init(struct ppp_softc *sc)
}
/* start tx daemon task */
- status = rtems_task_create(rtems_build_name('T','x','P','0'), priority, 2048,
+ status = rtems_task_create(rtems_build_name('T','x','P','0'+sc->sc_if.if_unit), priority, 2048,
RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
&sc->sc_txtask);
@@ -409,7 +409,8 @@ static void ppp_init(struct ppp_softc *sc)
}
/* mark driver running and output inactive */
- sc->sc_if.if_flags |= IFF_RUNNING;
+ /* ilya: IFF_RUNNING flag will be marked after the IPCP goes up */
+/* sc->sc_if.if_flags |= IFF_RUNNING; */
}
/*
@@ -417,12 +418,25 @@ static void ppp_init(struct ppp_softc *sc)
*/
int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
- int i = (int)0;
+/* int i = (int)0; */
struct ppp_softc *sc;
-
- for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ char *name;
+ int number;
+
+
+ number = rtems_bsdnet_parse_driver_name (config, &name);
+
+ if (!attaching || (number >= NPPP))
+ return 0;
+
+ sc = &ppp_softc[number];
+
+ if (sc->sc_if.if_name != NULL)
+ return 0; /* interface is already attached */
+
+/* for (sc = ppp_softc; i < NPPP; sc++) { */
+ sc->sc_if.if_name = name /*"ppp"*/;
+ sc->sc_if.if_unit = number /*i++*/;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
@@ -441,7 +455,7 @@ int rtems_ppp_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
#if NBPFILTER > 0
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
- }
+/* } */
return ( 1 );
}
diff --git a/c/src/libnetworking/net/ppp_tty.c b/c/src/libnetworking/net/ppp_tty.c
index cab3278f30..b655fd4f04 100644
--- a/c/src/libnetworking/net/ppp_tty.c
+++ b/c/src/libnetworking/net/ppp_tty.c
@@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty)
int i;
register struct ppp_softc *sc;
struct mbuf *m = (struct mbuf *)0;
+ extern int termios_baud_to_number(int);
if (tty->t_line == PPPDISC) {
sc = (struct ppp_softc *)tty->t_sc;
@@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty)
/* initialize values */
sc->sc_if.if_flags |= IFF_RUNNING;
- sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */
+ sc->sc_if.if_baudrate =
+ termios_baud_to_number(tty->termios.c_cflag & CBAUD);
tty->t_sc = (void *)sc;
@@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
- int i;
+/* int i; */
int error = RTEMS_SUCCESSFUL;
int cmd = args->command;
caddr_t data = args->buffer;
@@ -561,6 +563,7 @@ int
pppstart(struct rtems_termios_tty *tp)
{
char c;
+ char *sendBegin;
char cFrame = (char )PPP_FLAG;
u_char ioffset = (u_char )0;
struct mbuf *m = (struct mbuf *)0;
@@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp)
/* set the escape flag */
sc->sc_outflag |= SC_TX_ESCAPE;
}
+ sendBegin = &c;
}
else {
- /* escape not needed - increment the offset */
- ioffset++;
+ /* escape not needed - increment the offset as much as possible */
+ while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) {
+ ioffset++;
+ c = sc->sc_outbuf[sc->sc_outoff + ioffset];
+ }
+ sendBegin = &sc->sc_outbuf[sc->sc_outoff];
}
- /* write out the character and update the stats */
- (*tp->device.write)(tp->minor, &c, 1);
- sc->sc_stats.ppp_obytes++;
+ /* write out the character(s) and update the stats */
+ (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1);
+ sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1;
sc->sc_outoff += ioffset;
}
}