Merge pull request #1304 from simonduq/pr/fix-tunslip6

Fix tunslip6
This commit is contained in:
Simon Duquennoy 2015-10-23 09:37:01 +02:00
commit 9171ba17fc

View file

@ -238,21 +238,13 @@ serial_to_tun(FILE *inslip, int outfd)
slip_send(slipfd, SLIP_END); slip_send(slipfd, SLIP_END);
} }
#define DEBUG_LINE_MARKER '\r' #define DEBUG_LINE_MARKER '\r'
if(uip.inbuf[0] == DEBUG_LINE_MARKER || } else if(uip.inbuf[0] == DEBUG_LINE_MARKER) {
is_sensible_string(uip.inbuf, inbufptr)) { fwrite(uip.inbuf + 1, inbufptr - 1, 1, stdout);
unsigned char *out = uip.inbuf; } else if(is_sensible_string(uip.inbuf, inbufptr)) {
unsigned int len = inbufptr; if(verbose==1) { /* strings already echoed below for verbose>1 */
if(uip.inbuf[0] == DEBUG_LINE_MARKER) { if (timestamp) stamptime();
out++; fwrite(uip.inbuf, inbufptr, 1, stdout);
len--; }
}
fprintf(stderr, "\n***");
fwrite(out, len, 1, stderr);
fprintf(stderr, "***\n");
} else {
fprintf(stderr,
"serial_to_tun: drop packet len=%d\n", inbufptr);
}
} else { } else {
if(verbose>2) { if(verbose>2) {
if (timestamp) stamptime(); if (timestamp) stamptime();
@ -709,7 +701,7 @@ main(int argc, char **argv)
const char *port = NULL; const char *port = NULL;
const char *prog; const char *prog;
int baudrate = -2; int baudrate = -2;
int ipa_enable = 1; int ipa_enable = 0;
int tap = 0; int tap = 0;
slipfd = 0; slipfd = 0;
@ -743,8 +735,8 @@ main(int argc, char **argv)
break; break;
case 'I': case 'I':
ipa_enable = 0; ipa_enable = 1;
fprintf(stderr, "Will not inquire about IP address using IPA=\n"); fprintf(stderr, "Will inquire about IP address using IPA=\n");
break; break;
case 't': case 't':
@ -789,6 +781,7 @@ fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200 (default),230400,4
fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200 (default),230400\n"); fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200 (default),230400\n");
#endif #endif
fprintf(stderr," -H Hardware CTS/RTS flow control (default disabled)\n"); fprintf(stderr," -H Hardware CTS/RTS flow control (default disabled)\n");
fprintf(stderr," -I Inquire IP address\n");
fprintf(stderr," -L Log output format (adds time stamps)\n"); fprintf(stderr," -L Log output format (adds time stamps)\n");
fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n"); fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n");
fprintf(stderr," -T Make tap interface (default is tun interface)\n"); fprintf(stderr," -T Make tap interface (default is tun interface)\n");