1 |
diff -ru diald-1.0.orig/proxy_slip.c diald-1.0/proxy_slip.c |
2 |
--- diald-1.0.orig/proxy_slip.c 2001-06-16 15:51:39.000000000 -0400 |
3 |
+++ diald-1.0/proxy_slip.c 2005-10-04 10:39:41.951883000 -0400 |
4 |
@@ -51,7 +51,11 @@ |
5 |
proxy_slip_send(proxy_t *proxy, |
6 |
unsigned short wprot, unsigned char *p, size_t len) |
7 |
{ |
8 |
- /* send an initial END character to flush out any data that may |
9 |
+ /* ignore the wprot param. |
10 |
+ * As this is a SLIP link then ETH_P_IP is implied and will be prepended at |
11 |
+ * remote end. |
12 |
+ * |
13 |
+ * send an initial END character to flush out any data that may |
14 |
* have accumulated in the receiver due to line noise |
15 |
*/ |
16 |
putc(END,proxy_mfp); |
17 |
@@ -91,7 +95,10 @@ |
18 |
*/ |
19 |
putc(END,proxy_mfp); |
20 |
|
21 |
- return 0; |
22 |
+ /* Ensure the packet goes now. |
23 |
+ * Return EOF if failed, 0 otherwise. |
24 |
+ */ |
25 |
+ return fflush(proxy_mfp); |
26 |
} |
27 |
|
28 |
|
29 |
@@ -108,6 +115,10 @@ |
30 |
int c; |
31 |
int received = 0; |
32 |
|
33 |
+ /* Insert the protocol at the beginning of the buffer. |
34 |
+ * If real data is received, the buffer length is adjusted just before |
35 |
+ * returning |
36 |
+ */ |
37 |
*(unsigned short *)p = htons(ETH_P_IP); |
38 |
p += sizeof(unsigned short); |
39 |
len -= sizeof(unsigned short); |
40 |
@@ -138,7 +149,7 @@ |
41 |
* turn sent to try to detect line noise. |
42 |
*/ |
43 |
if(received) |
44 |
- return received; |
45 |
+ return received + sizeof(unsigned short); |
46 |
else |
47 |
break; |
48 |
|