Update copyright notices.
authorian <ian>
Wed, 31 May 2000 01:16:11 +0000 (01:16 +0000)
committerian <ian>
Wed, 31 May 2000 01:16:11 +0000 (01:16 +0000)
17 files changed:
ipif/.cvsignore
ipif/Makefile
ipif/automechgen.sh
ipif/blowfish.c
ipif/blowfish.h
ipif/blowfishspeed.c
ipif/blowfishtest.c
ipif/forwarder.c
ipif/forwarder.h
ipif/hex.c
ipif/hex.h
ipif/mech-blowfish.c
ipif/mech-null.c
ipif/mech-pkcs5.c
ipif/mech-sequence.c
ipif/mech-timestamp.c
ipif/utils.c

index db26654..8272b90 100644 (file)
@@ -1,3 +1,4 @@
 service
 automech.[ch]
 udptunnel-forwarder
+blowfishtest
index c2e3a7f..f1e63a4 100644 (file)
@@ -1,4 +1,6 @@
-# Copyright (C) 1999 Ian Jackson
+# Makefile for ipif/udptunnel stuff
+
+# Copyright (C) 1999-2000 Ian Jackson
 #
 # This is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -30,7 +32,8 @@ libuserv=     $(libdir)/userv
 etcuserv=      $(etcdir)/userv
 services=      $(etcuserv)/services.d
 
-TARGETS=       service udptunnel-forwarder blowfishtest
+PROGRAMS=      udptunnel udptunnel-forwarder
+TARGETS=       service blowfishtest $(PROGRAMS)
 
 MECHFILES=     null pkcs5 timestamp sequence blowfish
 MECHOBJS=      $(foreach m, $(MECHFILES), mech-$m.o)
@@ -44,7 +47,7 @@ install:      all
                mkdir -p $(libuserv) $(services)
                cp -b service $(libuserv)/ipif
                cp ipif $(services)/ipif:new
-               cp -b udptunnel $(bindir)/.
+               cp -b $(PROGRAMS) $(bindir)/.
                set -e; cd $(services); test -f ipif || mv ipif:new ipif
 
 udptunnel-forwarder:   $(OBJS_FORWARD)
index a712a73..d89189a 100755 (executable)
@@ -1,4 +1,22 @@
 #!/bin/sh
+# generates automech.h and automech.c
+
+# Copyright (C) 2000 Ian Jackson
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with userv-utils; if not, write to the Free Software
+# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 exec >automech.c.new
 exec 3>automech.h.new
 
index fd7f631..6731c8e 100644 (file)
@@ -4,7 +4,23 @@
  * Algorithm by Bruce Schneier 1995
  * This implementation adapted from a public domain version by Bruce
  * Schneier (1995) by Ian Jackson in 1997.
- * Copyright (C)1997 Ian Jackson.
+ */
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 /* TODO: test with zero length key */
index af02c07..70cce7f 100644 (file)
@@ -1,4 +1,20 @@
-/**/
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #ifndef BLOWFISH__H_INCLUDED
 #define BLOWFISH__H_INCLUDED
index aaaf622..ece4e7d 100644 (file)
@@ -1,4 +1,20 @@
-/**/
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include <stdio.h>
 #include <assert.h>
index 5b2fe57..c4c8252 100644 (file)
@@ -1,4 +1,23 @@
-/**/
+/*
+ * test program for blowfish; very hard to use (sorry!)
+ */
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
 
 #include <stdio.h>
 #include <string.h>
index d3a0f0f..f901f78 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Encrypting tunnel for userv-ipif tunnels, actual implementation
- *
+ */
+/*
  * usage:
  *  udptunnel-forwarder <optchars>
  *                      <public-local-fd> <private-in-fd> <private-out-fd>
  *      12     usage error
  *      16     bad trouble
  */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -191,7 +209,9 @@ static void inbound(void) {
   for (i=n_mechs-1; i>=0; i--) {
     emsg= mechs[i]->decode(md_in[i],&buf_in);
     if (emsg) {
-      fprintf(stderr, "%s: bad packet: %s: %s\n", programid, mechs[i]->name, emsg);
+      if (*emsg)
+       fprintf(stderr, "%s: bad packet: %s: %s\n",
+               programid, mechs[i]->name, emsg);
       return;
     }
     cdebugbuf(i, "decode", &buf_in, 3,0);
index 08eee56..a9b88b6 100644 (file)
@@ -1,4 +1,22 @@
 /*
+ * Encrypting tunnel for userv-ipif tunnels, header file
+ */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 #ifndef MECHS_H
@@ -39,7 +57,8 @@ extern const struct mechanism *const mechanismlists[];
  * 
  * setup_in function may increase maxprefix and maxsuffix
  * code functions modify buffer in place
- * decode function returns message to print
+ * decode function returns 0 meaning packet decoded ok,
+ *  "" meaning discard it quietly, or message to print for verbose discard
  */
   
 const char *getarg_string(void);
index dc0c749..37cb75b 100644 (file)
@@ -1,4 +1,20 @@
-/**/
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
index 5bce442..236fafa 100644 (file)
@@ -1,4 +1,20 @@
-/**/
+/*
+ * Copyright (C) 1997,2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #ifndef HEX__H_INCLUDED
 #define HEX__H_INCLUDED
index 65e3311..b1cb192 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Blowfish
+ * Blowfish mechanism for udp tunnel
  *
  * arguments: key size in bits (must be multiple of 8)
  *
@@ -8,6 +8,23 @@
  * encoding:         do CBC encryption overwriting message
  * encoding for MAC: do CBC and prepend last ciphertext block
  */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include "forwarder.h"
 #include "blowfish.h"
index 8ff117c..fccb7d7 100644 (file)
@@ -1,4 +1,22 @@
 /*
+ * Null mechanism for udp tunnel (for testing purposes only)
+ */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 #include "forwarder.h"
index df4d918..f03787b 100644 (file)
@@ -1,11 +1,28 @@
 /*
- * PKCS#5 padding
+ * PKCS#5 padding mechanism for udp tunnel
  *
  * arguments: block size to pad to, must be power of 2
  *
  * encoding: append between 1 and n bytes, all of the same value being
  *           the number of bytes appended
  */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include "forwarder.h"
 
index 2090b37..76c8c83 100644 (file)
@@ -1,11 +1,28 @@
 /*
- * Sequence number / nonce mechanism
+ * Sequence number / nonce mechanism for udp tunnel
  *
  * arguments: none
  *
  * encoding: prepend 4 bytes of sequence arithmetic serial number
  * decoding: check increasingness, or ignore
  */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include <netinet/in.h>
 
index 226f23f..93d30e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Timestamp mechanism
+ * Timestamp mechanism for udp tunnel
  *
  * arguments: <max-skew> <max-age>
  *
  * accept a packet (or 0 for any future age).
  *
  */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #include <stdint.h>
 #include <netinet/in.h>
 
 #include "forwarder.h"
 
+#define WARN_EVERY 30
+
 struct mechdata {
   time_t max_skew, max_age;
+  time_t next_warn;
 };
 
 static void mds_timestamp(struct mechdata **md_r) {
@@ -27,6 +47,7 @@ static void mds_timestamp(struct mechdata **md_r) {
   
   md->max_skew= getarg_ulong();
   md->max_age= getarg_ulong();
+  md->next_warn= now();
   *md_r= md;
 }
 
@@ -42,27 +63,27 @@ static void menc_timestamp(struct mechdata *md, struct buffer *buf) {
 static const char *mdec_timestamp(struct mechdata *md, struct buffer *buf) {
   static char cbuf[40];
   
-  uint32_t *tp, timestamp, tnow;
+  uint32_t *tp, timestamp;
+  time_t tnow;
   long age;
 
   BUF_UNPREPEND(tp,buf,4);
   timestamp= ntohl(*tp);
 
   tnow= now();
-  age= timestamp - tnow;
+  age= timestamp - (uint32_t)tnow;
   if (age > 0) {
-    if (md->max_age && age > md->max_age) {
-      sprintf(cbuf,"packet too old (%lds)",age);
-      return cbuf;
-    }
+    if (!md->max_age || age <= md->max_age) return 0;
+    sprintf(cbuf,"packet too old (%lds)",age);
   } else if (age < 0) {
-    if (md->max_skew && age < -md->max_skew) {
-      sprintf(cbuf,"too much skew (%lds)",-age);
-      return cbuf;
-    }
+    if (!md->max_skew || age >= -md->max_skew) return 0;
+    sprintf(cbuf,"too much skew (%lds)",-age);
   }
 
-  return 0;
+  if (tnow < md->next_warn) return "";
+
+  md->next_warn= tnow+WARN_EVERY;
+  return cbuf;
 }
 
 STANDARD_MECHANISMLIST("timestamp",timestamp);
index 97ff430..dadee70 100644 (file)
@@ -1,4 +1,22 @@
 /*
+ * General utility functions for udp tunnel
+ */
+/*
+ * Copyright (C) 2000 Ian Jackson
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with userv-utils; if not, write to the Free Software
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 #include <string.h>