chiark / gitweb /
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 db26654958207ea507e5525e3b2a3d2b6a3b4285..8272b9097adcadc2875a957302be458a76b9a0d4 100644 (file)
@@ -1,3 +1,4 @@
 service
 automech.[ch]
 udptunnel-forwarder
+blowfishtest
index c2e3a7f0d727ff7eb46ac31d1484477c9530cc85..f1e63a4b9eaeacee5d4817c7ea941dcc77ebe562 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 a712a7345d34b6e5513a8004bc695a0e4c614fba..d89189a7dacdcde28ed4e7046c020787a1e39e3f 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 fd7f631a7b136f93bf6c238242dc08ffc393a5f9..6731c8e6dd2b4f183c5f9f4b76512d603563a7e8 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 af02c074aee03d9578d190a1b7683d0b02001357..70cce7fcce97591a3cab762d216712afca6f8514 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 aaaf62264de7d04096c8e0f2febc9a5b8bc312fe..ece4e7da911b802586b8b5ac6b459e5209decaf8 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 5b2fe57a20a93d75d791795981219fcb26627d2f..c4c8252502ef35acc657cfea0e471cfdc382fbf7 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 d3a0f0fc24804bd882b00789dedd0e9ac700f26a..f901f78deb4eb38d0f3840d497a07c06123f0674 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 08eee56ed4c96276942bd9b0a557172760cd71a2..a9b88b643c3d4102e98715e53cd3d75c490e9e65 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 dc0c749124c3fc761f4f68f217a6dcd4b3cc615b..37cb75b25c49cc5d0e7c040dd951968ce582ec6f 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 5bce442483ff0f587f4a095d581cc56df5ee81f9..236fafac50e7bcf010bc508f555e3fb28a53da2e 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 65e3311cec21bea7f0b05baf0bf3f3114d6d4faa..b1cb19222ef245780c81803aa841e984ff419529 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 8ff117ccb02253f518abcb2522c02023764e68c4..fccb7d70fef6a1e45ac013ed0a7eda612b986cf8 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 df4d91843b38e18cf57b7d4e5f91ab6022ea71fb..f03787b059a7bbbce0bfa878cb29f5ea80a488f7 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 2090b37dd9b264ebb570e3868bb83aafb48e6c3e..76c8c833bf9c6c279ff66b694930130a36586058 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 226f23f830d135a204fef14f4c110c4b054e3847..93d30e66183bedb1ca17475978178ee0859fe2ce 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 97ff4309359e15f5860c8fad2043ed526bc4a53e..dadee709156190b10e327223cca98bda27267484 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>