This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PPP Issues


The following are various issues I have encountered with the PPP stack.
Attached is a  patch for your consideration.


1.  The stack does not prepend initial frames with a starting Flag Sequence.
Per RFC 1549:

"Transmitters SHOULD send an open Flag Sequence whenever 'appreciable time'
has elapsed after the prior closing Flag Sequence. The maximum value for
'appreciable time' is likely to be no greater than the typing rate of a slow
typist, say 1 second (S4)."

Although a timer could be implemented, this patch prepends every frame with
a Flag sequence, regardless of the time between frames:

"Only one Flag Sequence is required between two frames. Two consecutive Flag
Sequences constitute an empty frame, which is ignored, and not counted as a
FCS error (S3.1)."

Affects: ppp_io.c


2.  If a session is terminated due to unanswered echo-requests, an
echo-request still remains in the timeout queue; consequently, once the
session is reestablished, every echo-request interval will send out two
echo-requests. If the session is terminated again for the same reason, then
three echo-requests will be sent out each interval (and so on--the process
is cumulative, and will add an additional request for each termination due
to unanswered echo-reuquests).  This patch prevents the above from
happening.

Affects: lcp.c


3.  Warnings are generated when compiling pppd.c and magic.c:

arm-elf-gcc -c -I/home/jpking/src/ecos/ecos_install/include -I/opt/ecos/ecos
_cvs/packages/net/ppp/current -I/opt/ecos/ecos_cvs/packages/net/ppp/current/
src -I/opt/ecos/ecos_cvs/packages/net/ppp/current/tests -I. -I/opt/ecos/ecos
_cvs/packages/net/ppp/current/src/ -finline-limit=7000 -mcpu=arm7tdmi -mno-s
hort-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -
g -O2 -ffunction-sections -fdata-sections -fno-exceptions -D__ECOS -Wp,-MD,s
rc/pppd.tmp -o src/net_ppp_pppd.o
/opt/ecos/ecos_cvs/packages/net/ppp/current/src/pppd.c
/opt/ecos/ecos_cvs/packages/net/ppp/current/src/pppd.c: In function
`cyg_ppp_timeout':
/opt/ecos/ecos_cvs/packages/net/ppp/current/src/pppd.c:598: warning:
implicit declaration of function `cyg_ppp_gettimeofday'

"cyg_ppp_gettimeofday" is not defined anywhere in the ecos source, but a
version of "gettimeofday" is defined in the ppp source. This patch uses that
version.

Affects: pppd.h and sys-ecos.c


Index: packages/net/ppp/current/include/pppd.h
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/include/pppd.h,v
retrieving revision 1.2
diff -u -r1.2 pppd.h
--- packages/net/ppp/current/include/pppd.h	17 Apr 2004 03:13:06 -0000	1.2
+++ packages/net/ppp/current/include/pppd.h	18 Jun 2004 21:08:12 -0000
@@ -355,6 +355,8 @@
 void logwtmp __P((const char *, const char *, const char *));
 				/* Write entry to wtmp file */
 int  get_host_seed __P((void));	/* Get host-dependent random number seed */
+int  cyg_ppp_gettimeofday __P((struct timeval *, struct timezone *));
+                                /* Get elapsed time in secs/usecs */
 #ifdef PPP_FILTER
 int  set_filters __P((struct bpf_program *pass, struct bpf_program
*active));
 				/* Set filter programs in kernel */
Index: packages/net/ppp/current/src/lcp.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/src/lcp.c,v
retrieving revision 1.2
diff -u -r1.2 lcp.c
--- packages/net/ppp/current/src/lcp.c	17 Apr 2004 03:13:06 -0000	1.2
+++ packages/net/ppp/current/src/lcp.c	18 Jun 2004 21:08:15 -0000
@@ -1794,9 +1794,11 @@
     /*
      * Start the timer for the next interval.
      */
-    assert (lcp_echo_timer_running==0);
-    TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval);
-    lcp_echo_timer_running = 1;
+    if (f->state == OPENED) {
+        assert (lcp_echo_timer_running==0);
+        TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval);
+        lcp_echo_timer_running = 1;
+    }
 }

 /*
Index: packages/net/ppp/current/src/ppp_io.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/src/ppp_io.c,v
retrieving revision 1.3
diff -u -r1.3 ppp_io.c
--- packages/net/ppp/current/src/ppp_io.c	6 May 2004 14:46:35 -0000	1.3
+++ packages/net/ppp/current/src/ppp_io.c	18 Jun 2004 21:08:16 -0000
@@ -624,6 +624,14 @@
 	    /* Calculate the FCS for the first mbuf's worth. */
 	    sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len);
 	    getmicrotime(&sc->sc_if.if_lastchange);
+            {
+                cyg_serial_buf_info_t info;
+                cyg_uint32 ilen = sizeof(info);
+                char ppp_flag = 0x7e;
+                int ppp_flag_len = 1;
+                if( cyg_io_get_config( tp->t_handle,
CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO, &info, &ilen ) == 0 &&
info.tx_bufsize-info.tx_count >= 1 )
+                    cyg_io_write( tp->t_handle, &ppp_flag, &ppp_flag_len);
+            }
 	}

 	for (;;) {
Index: packages/net/ppp/current/src/sys-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/src/sys-ecos.c,v
retrieving revision 1.4
diff -u -r1.4 sys-ecos.c
--- packages/net/ppp/current/src/sys-ecos.c	6 May 2004 14:46:35 -0000	1.4
+++ packages/net/ppp/current/src/sys-ecos.c	18 Jun 2004 21:08:17 -0000
@@ -1827,7 +1827,7 @@

 //=====================================================================

-int gettimeofday(struct timeval *tv, struct timezone *tz)
+int cyg_ppp_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
     cyg_tick_count_t time = cyg_current_time();



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]