]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/pppoe/common.c
pppd.8: Document netmask option
[ppp.git] / pppd / plugins / pppoe / common.c
index 8b0e636acb800ab923a6b6c6d2cb3053448189f2..31811f59a9fbf3af05d79ff94f698ed5d7a0d321 100644 (file)
@@ -17,17 +17,18 @@ static char const RCSID[] =
 "$Id: common.c,v 1.3 2008/06/09 08:34:23 paulus Exp $";
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
 #endif
 
 #define _GNU_SOURCE 1
 #include "pppoe.h"
-#include "pppd/pppd.h"
+#include <pppd/pppd.h>
 
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <syslog.h>    /* for LOG_DEBUG */
+#include <ctype.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -303,6 +304,15 @@ void pppoe_printpkt(PPPoEPacket *packet,
            printer(arg, "unknown tag 0x%x", tag);
        }
        if (tlen) {
+           /* If it is supposed to be text, make sure it's all printing chars */
+           if (text) {
+               for (j = 0; j < tlen; ++j) {
+                   if (!isprint(packet->payload[i+j])) {
+                       text = 0;
+                       break;
+                   }
+               }
+           }
            if (text)
                printer(arg, " %.*s", tlen, &packet->payload[i]);
            else {