Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 92:cb962b365cce, committed 2017-07-23
- Comitter:
- nixnax
- Date:
- Sun Jul 23 17:57:31 2017 +0000
- Parent:
- 91:5141ae9fba53
- Child:
- 93:9675adc36882
- Commit message:
- Works with pppd on linux after small IPCP change.; Linux pppd command line in comments.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Jul 23 06:50:57 2017 +0000
+++ b/main.cpp Sun Jul 23 17:57:31 2017 +0000
@@ -17,13 +17,18 @@
// Handy tools
// https://ttssh2.osdn.jp/index.html.en - Tera Term, a good terminal program to monitor the debug output from the second serial port with!
-// https://www.microsoft.com/en-us/download/details.aspx?id=4865 - Microsoft network monitor - real-time monitoring of PPP packets -
+// https://www.microsoft.com/en-us/download/details.aspx?id=4865 - Microsoft network monitor - real-time monitoring of PPP packets -
// http://pingtester.net/ - nice tool for high rate ping testing
// http://www.sunshine2k.de/coding/javascript/crc/crc_js.html - Correctly calculates the 16-bit FCS (crc) on our frames (Choose CRC16_CCITT_FALSE)
// https://technet.microsoft.com/en-us/sysinternals/pstools.aspx - psping for fast testing of ICMP ping function
// https://eternallybored.org/misc/netcat/ - use netcat -u 172.10.10.1 80 to send/receive UDP packets from PPP-Blinky
// Windows Powershell invoke-webrequest command - use it to stress test the webserver like this: while (1){ invoke-webrequest -uri 172.10.10.1/x }
+// Connecting PPP-Blinky to Linux
+// PPP-Blinky can be made to run on Linux - on Fedora, the following command, which uses pppd, works:
+// pppd /dev/ttyACM0 115200 debug dump local passive noccp novj updetach nocrtscts 172.10.10.1:172.10.10.2
+// in the above command 172.10.10.1 is the adapter IP, and 172.10.10.2 is the IP of PPP-Blinky.
+
#include "mbed.h"
// The #define below enables/disables a SECOND (optional) serial port that prints out interesting diagnostic messages.
@@ -265,21 +270,16 @@
void ipConfigRequestHandler()
{
- debug("IPCP Conf ");
- if ( ppp.pkt.buf[7] != 4 ) {
- debug("Rej\n"); // reject any options that are requested
- ppp.pkt.buf[4]=4;
- sendFrame();
- } else {
- debug("Ack\n");
- ppp.pkt.buf[4]=2; // ack the minimum
- sendFrame(); // acknowledge
- debug("IPCP Ask\n");
- // send our own request now
- ppp.pkt.buf[4]=1; // request no options
- ppp.pkt.buf[5]++; // next sequence
- sendFrame(); // this is our request
- }
+ debug("IPCP Conf Ack\n");
+ ppp.pkt.buf[4]=2; // change code to ack
+ sendFrame(); // blind acknowledge everything they ask for
+ debug("IPCP Ask\n");
+ // send our own request now
+ ppp.pkt.buf[4]=1; // change code to request
+ ppp.pkt.buf[5]++; // increment sequence number
+ ppp.pkt.buf[7]=4; // no options requested
+ sendFrame(); // this is our request
+ return;
}
void ipAckHandler()
@@ -661,7 +661,7 @@
int dataLen = 0; // most of our responses will have zero TCP data, only a header
int flagsOut = TCP_FLAG_ACK; // the default case is an ACK packet
int flagsTCP = ((flagbitstcp[0]&1)<<8)|flagbitstcp[1]; // the tcp flags we received
-
+
windowsizetcp[0]=3; // ignore window size negotiation
windowsizetcp[1]=0; // ignore winodw size negotiation