summaryrefslogtreecommitdiff
path: root/net/pptp/patches/patch-ad
diff options
context:
space:
mode:
Diffstat (limited to 'net/pptp/patches/patch-ad')
-rw-r--r--net/pptp/patches/patch-ad75
1 files changed, 75 insertions, 0 deletions
diff --git a/net/pptp/patches/patch-ad b/net/pptp/patches/patch-ad
new file mode 100644
index 00000000000..70a485ff2d9
--- /dev/null
+++ b/net/pptp/patches/patch-ad
@@ -0,0 +1,75 @@
+$NetBSD: patch-ad,v 1.1.1.1 2000/04/10 01:14:02 jtk Exp $
+
+Index: pptp_gre.c
+--- pptp_gre.c.orig 1998/09/02 14:40:54
++++ pptp_gre.c 1999/02/12 14:23:29
+@@ -5,10 +5,10 @@
+ * $Id: patch-ad,v 1.1.1.1 2000/04/10 01:14:02 jtk Exp $
+ */
+
++#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <sys/socket.h>
+-#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/time.h>
+ #include <unistd.h>
+@@ -34,12 +34,12 @@
+
+ #if 1
+ #include <stdio.h>
+-void print_packet(int fd, void *pack, unsigned len) {
++void print_packet(int fd, void *pack, unsigned len, const char *msg) {
+ unsigned char *b = (unsigned char *)pack;
+ unsigned i,j;
+ FILE *out = fdopen(fd, "w");
+
+- fprintf(out,"-- begin packet (%u) --\n", len);
++ fprintf(out,"-- begin %s packet (%u) --\n", msg, len);
+ for (i=0; i<len; i+=16) {
+ for (j=0; j<8; j++)
+ if (i+2*j+1<len)
+@@ -119,6 +119,8 @@
+ /* this is the only blocking read we will allow */
+ if (start>=end) {
+ if ((status=read(fd,buffer,sizeof(buffer)))<0) return status;
++ if (status == 0)
++ return -1; /* FD is closed */
+ end = status; start = 0;
+ }
+
+@@ -198,6 +200,7 @@
+ ip_len = (buffer[0]&0xF)*4;
+ header = (struct pptp_gre_header *)(buffer+ip_len);
+
++/* print_packet(2, buffer, status, "in");*/
+ /* verify packet (else discard) */
+ if (((ntoh8(header->ver)&0x7F)!=PPTP_GRE_VER) || /* version should be 1 */
+ (ntoh16(header->protocol)!=PPTP_GRE_PROTO)|| /* GRE protocol for PPTP */
+@@ -258,7 +261,7 @@
+ u.header.call_id = hton16(pptp_gre_call_id);
+
+ /* special case ACK with no payload */
+- if (pack==NULL)
++ if (pack==NULL) {
+ if (ack_sent != seq_recv) {
+ u.header.ver |= hton8(PPTP_GRE_FLAG_A);
+ u.header.payload_len = hton16(0);
+@@ -266,6 +269,7 @@
+ ack_sent = seq_recv;
+ return write(fd, &u.header, sizeof(u.header)-sizeof(u.header.seq));
+ } else return 0; /* we don't need to send ACK */
++ }
+ /* send packet with payload */
+ u.header.flags |= hton8(PPTP_GRE_FLAG_S);
+ u.header.seq = hton32(seq);
+@@ -283,7 +287,7 @@
+ /* record and increment sequence numbers */
+ seq_sent = seq; seq++;
+ /* write this baby out to the net */
+- /* print_packet(2, u.buffer, header_len+len); */
++/* print_packet(2, u.buffer, header_len+len, "out");*/
+ return write(fd, u.buffer, header_len+len);
+ }
+