[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2252: dip doesn't support (C)SLIP6 &c

Package: netstd
Version: 1.25-1

The `dip' program in 1.25-1 doesn't support the SLIP6 (base64-encoded
SLIP protocol which is supported by slattach and by the Linux kernel);
nor does it support CSLIP6 (= SLIP6 with VJ header compression).

Below is a patch that adds CSLIP6 support, but not SLIP6 support.
>From the patch it should be obvious how to do SLIP6 too, but it seems
unlikely that anyone would want to use it since I get the impression
that the whole 64-bit SLIP thing is a Linux invention anyway ...

While creating this patch I noticed a number of things that made me
unhappy with the author of the code:

* There is a table of protocols, and each entry in the table *contains
a field which is the index of the entry* !  This is clearly very bad
programming practice.  My first attempt at making this modification
failed because I didn't understand that these magic numbers had to be
consecutive ...  Unfortunately the index into the table appears
sometimes to be a parameter passed into the dip program.

* There appears to be little scope for code re-use when adding new
SLIP encapsulations, for example.  I had to copy a whole function,
containing calls to all the ioctls &c.

* Various external functions are declared in the files that use them,
rather than in a header file included in the files that define them as
well as those that use them.  This prevents GCC from checking that the
types agree.  Using -Wmissing-prototypes would spot all these missing

Peter, I'd be grateful if you could forward these comments to the
upstream authors in a way that is perhaps less inflammatory than this
bug report; I'll leave this to your discretion.

It would be nice if at least CSLIP6 were supported in the next netstd.


Only in dip-3.3.7n: attach.o
Only in dip-3.3.7n: command.o
diff -ru dip-3.3.7n.orig/config.c dip-3.3.7n/config.c
--- dip-3.3.7n.orig/config.c	Thu Apr 20 18:59:46 1995
+++ dip-3.3.7n/config.c	Mon Jan 29 01:48:08 1996
@@ -36,6 +36,9 @@
 extern void do_cslip(struct dip *dip);
+extern void do_cslip6(struct dip *dip);
 extern void do_ppp(struct dip *dip);
@@ -56,6 +59,9 @@
   { "TERM",		4,	do_termp	},
+  { "CSLIP6",		5,	do_cslip6	},
   { (char *)NULL,	0,	NULL		}
Only in dip-3.3.7n: config.c~
Only in dip-3.3.7n: config.o
Only in dip-3.3.7n: daemon.o
Only in dip-3.3.7n: dip
Only in dip-3.3.7n: login.o
Only in dip-3.3.7n: main.o
Only in dip-3.3.7n: modem.o
Only in dip-3.3.7n: ppp.o
Only in dip-3.3.7n: protocols.a
Only in dip-3.3.7n/skey: key
Only in dip-3.3.7n/skey: keyinit
Only in dip-3.3.7n/skey: keysh
Only in dip-3.3.7n/skey: libskey.a
Only in dip-3.3.7n/skey: md4.o
Only in dip-3.3.7n/skey: put.o
Only in dip-3.3.7n/skey: skeylogin.o
Only in dip-3.3.7n/skey: skeysubr.o
diff -ru dip-3.3.7n.orig/slip.c dip-3.3.7n/slip.c
--- dip-3.3.7n.orig/slip.c	Wed Jan 18 18:56:49 1995
+++ dip-3.3.7n/slip.c	Mon Jan 29 01:42:24 1996
@@ -98,3 +98,42 @@
   /* Add the route to that host. */
   (void) attach(dip);
+do_cslip6(struct dip *dip)
+  (void) strcpy((char *) dip->protocol, "CSLIP6");
+  /* Put line in SLIP discipline. */
+  if (tty_set_disc(N_SLIP) < 0) {
+    syslog(LOG_ERR, "SETD(N_SLIP): %m");
+    return;
+  }
+  if (opt_v == 1)
+    syslog(LOG_INFO, "cslip: set_disc N_SLIP (%d)", N_SLIP);
+  /* Enable VJ Header Compression. */
+  if (tty_set_encap(0x0003) < 0) {
+    syslog(LOG_ERR, "SET_ENCAP(VJ_COMP=1,SLIP6=2): %m");
+    return;
+  }
+  if (opt_v == 1)
+    syslog(LOG_INFO, "cslip: set_encap(0x0003)");
+  /* Ask the kernel for the name of our interface. */
+  if (tty_get_name(dip->ifname) < 0) {
+    syslog(LOG_ERR, "GIFNAME: %m");
+    (void) tty_set_disc(-1);
+    return;
+  }
+  if (opt_v == 1) {
+      printf("cslip: interface %s\n", dip->ifname);
+  }
+  /* Add the route to that host. */
+  (void) attach(dip);
Only in dip-3.3.7n: slip.c~
Only in dip-3.3.7n: slip.o
Only in dip-3.3.7n: term.o
Only in dip-3.3.7n: termp.o
Only in dip-3.3.7n: tty.o

Reply to: