Add IrDA support; patch from Dag Brattli <dagb@cs.uit.no>
authorPhil Blundell <philb@gnu.org>
Wed, 21 Apr 1999 08:59:55 +0000 (08:59 +0000)
committerPhil Blundell <philb@gnu.org>
Wed, 21 Apr 1999 08:59:55 +0000 (08:59 +0000)
README
TODO
config.in
lib/Makefile
lib/hw.c
lib/irda.c [new file with mode: 0644]

diff --git a/README b/README
index d8b2881..1a7c730 100644 (file)
--- a/README
+++ b/README
@@ -34,6 +34,8 @@ Contents:
 This is net-tools 1.52.  Notable changes since 1.51 include:
 
  - Jean-Michel Vansteene updated the French translation.
+ - Dag Brattli contributed support for IrDA
+ - some bugs have been fixed
 
 Notable changes since 1.50 include:
 
@@ -46,27 +48,20 @@ Notable changes since 1.50 include:
  - Ralf Bächle provided a translation to German
 
 You need kernel 2.0 or later to use these programs.  These programs
-should compile cleanly with both glibc (version 2.0 or 2.1) and libc5.
-The `iptunnel' and `ipmaddr' programs require kernel version 2.2 or
-later.
+should compile cleanly with both glibc (version 2.0 or 2.1) and libc5,
+though support for libc5 is not well tested.
 
 The NLS support was changed from catgets to GNU gettext by Arnaldo
 Carvalho de Melo <acme@conectiva.com.br> in June, 1998, to make the
 source more readable. Translations to brazilian portuguese (pt_BR),
 German (de) and French (fr) are available and others are welcome!
 
-ipfw has been removed from the distribution.  Use ipfwadm instead; get
-it at <ftp://ftp.xos.nl/pub/linux/ipfwadm/>.
-
 route/netstat -r do not yet support different address families
 cleanly.  IPX/DDP/AX25 people, please feel free to add the code.
 
 ifconfig now supports changing media types for interfaces.  This requires
 a version 2.2 kernel, and many devices do not support it yet.
 
-The documentation is slimmed down.  I think most of it was out of
-date.
-
 The tools now support the layout of the 2.2 kernel /proc files (Bernd
 Eckenfels).
 
diff --git a/TODO b/TODO
index 2931373..ec6aae8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,7 +9,6 @@ TODO for net-tools
 [ ] netstat -i: XOVR!=compressed
 [ ] nettools.8 man-page
 [ ] lib/ddp.c: /etc/atalk.names support
-[ ] share source between netstat/ifconfig (lib/if_info.c)
 [ ] ARPHRD_LOOPBACK in new kernels, ok? dont think so :-/
 [ ] ARPHRD_LOCALTLK and aarp?
 [ ] ARCNET support? linux/drivers/net/arcnet.c
@@ -22,7 +21,6 @@ TODO for net-tools
 [ ] net-features.h in all tools
 [ ] check netstat -o
 [ ] supply some informations about new features to HOWTOs
-[ ] Need to include Jos Vos ipfwadm <ftp.xos.nl>
 [ ] Config file only works with bash not ash.
 [ ] Token ring is almost totally untested.
 [ ] additional tools for IPX, AX.25 etc be bundled [ipxripd004, ipx_* tools 
index 7c88232..2327d83 100644 (file)
--- a/config.in
+++ b/config.in
@@ -76,6 +76,7 @@ bool 'FDDI (generic) support' HAVE_HWFDDI n
 bool 'HIPPI (generic) support' HAVE_HWHIPPI n
 bool 'Ash hardware support' HAVE_HWASH n
 bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
+bool 'IrDA support' HAVE_HWIRDA y
 *
 *
 *           Other Features.
index 9defd85..c49d3b9 100644 (file)
@@ -16,7 +16,7 @@
 #
 
 
-HWOBJS  = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o
+HWOBJS  = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o irda.o
 AFOBJS  = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o
 AFGROBJS = inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o
 AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o
index e0fd331..4d023e3 100644 (file)
--- a/lib/hw.c
+++ b/lib/hw.c
@@ -2,7 +2,7 @@
  * lib/hw.c   This file contains the top-level part of the hardware
  *              support functions module.
  *
- * Version:     $Id: hw.c,v 1.12 1999/04/18 20:28:43 philip Exp $
+ * Version:     $Id: hw.c,v 1.13 1999/04/21 09:00:02 philip Exp $
  *
  * Maintainer:  Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
  *
@@ -63,6 +63,8 @@ extern struct hwtype lapb_hwtype;
 
 extern struct hwtype sit_hwtype;
 
+extern struct hwtype irda_hwtype;
+
 static struct hwtype *hwtypes[] =
 {
 
@@ -119,6 +121,9 @@ static struct hwtype *hwtypes[] =
 #if HAVE_HWHIPPI
     &hippi_hwtype,
 #endif
+#if HAVE_HWIRDA
+    &irda_hwtype,
+#endif
     &unspec_hwtype,
     NULL
 };
@@ -177,6 +182,9 @@ void hwinit()
 #if HAVE_HWSIT
     sit_hwtype.title = _("IPv6-in-IPv4");
 #endif
+#if HAVE_HWIRDA
+    irda_hwtype.title = _("IrLAP");
+#endif
     sVhwinit = 1;
 }
 
diff --git a/lib/irda.c b/lib/irda.c
new file mode 100644 (file)
index 0000000..cebffb6
--- /dev/null
@@ -0,0 +1,88 @@
+/*********************************************************************
+ *                
+ * Filename:      irda.c
+ * Version:       0.1
+ * Description:   A first attempt to make ifconfig understand IrDA
+ * Status:        Experimental.
+ * Author:        Dag Brattli <dagb@cs.uit.no>
+ * Created at:    Wed Apr 21 09:03:09 1999
+ * Modified at:   Wed Apr 21 09:17:05 1999
+ * Modified by:   Dag Brattli <dagb@cs.uit.no>
+ * 
+ *     This program 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 this program; if not, write to the Free Software 
+ *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
+ *     MA 02111-1307 USA
+ *     
+ ********************************************************************/
+
+#include "config.h"
+
+#if HAVE_AFIRDA || HAVE_HWIRDA
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if_arp.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+#include "net-support.h"
+#include "pathnames.h"
+#include "intl.h"
+#include "util.h"
+
+/* Probably not a good idea to include <linux/if_arp.h> */
+#ifndef ARPHRD_IRDA
+#define ARPHRD_IRDA 783
+#endif
+
+/*
+ * Function irda_print (ptr)
+ *
+ *    Print hardware address of interface
+ *
+ */
+static char *irda_print(unsigned char *ptr)
+{
+    static char buff[8];
+
+    sprintf(&buff[strlen(buff)], "%02x:%02x:%02x:%02x", ptr[3], ptr[2], 
+           ptr[1], ptr[0]);
+
+    return (buff);
+}
+
+/*
+ * Function irda_sprint (sap)
+ *
+ *    Print IrDA socket address
+ *
+ */
+static char *irda_sprint(struct sockaddr *sap)
+{
+       /* NOP */
+       return NULL;
+}
+
+struct hwtype irda_hwtype =
+{
+     "irda", NULL, ARPHRD_IRDA, 2,
+     irda_print, irda_sprint, NULL, NULL
+};
+
+#endif                         /* HAVE_xxIRDA */