]> 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 f57d9de3d0e31d95bd38ca25d835ad7388e3f559..31811f59a9fbf3af05d79ff94f698ed5d7a0d321 100644 (file)
 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"
+#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>
@@ -132,7 +137,7 @@ sendPADT(PPPoEConnection *conn, char const *msg)
        size_t elen = strlen(msg);
        err.type = htons(TAG_GENERIC_ERROR);
        err.length = htons(elen);
-       strcpy(err.payload, msg);
+       strcpy((char*) err.payload, msg);
        memcpy(cursor, &err, elen + TAG_HDR_SIZE);
        cursor += elen + TAG_HDR_SIZE;
        plen += elen + TAG_HDR_SIZE;
@@ -299,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 {