Documentation for using SpeedTouch Driver with NetBSD PPPoE

Release 0.9.1

Intro

This documentation is dedicated to the SpeedTouch project and in special its implementation in NetBSD 2.0 . It is assumed that speedtouch 1.3.1 is installed and working.

The problem

The userppp implementation used by the SpeedTouch project as complement for the USB driver, has the following problems on the system:

For that reason we will use the native PPP of NetBSD.

What is needed

tap(4) device

Recently, a tap(4) device is available on pkgsrc (HEAD branch), and it can be built as an LKM for being loaded on NetBSD 2.0 and above. This device is available on NetBSD current, as well.

Building the device:

$ cd /usr/pkgsrc/net/netbsd-tap
# make install

Follow the instructions of the installation.

Populating /dev:

# /usr/pkg/sbin/tap_postinstall

Loading the module:

# modload /usr/pkg/lkm/tap.o

And it need to be activated on boot. Also, the modem_run program can be started from here (optionally).

(/etc/ifconfig.tap0)
create
up
! /usr/pkg/sbin/modem_run -f /usr/pkg/libdata/alcaudsl.sys -v 2

Patching pppoa2

The pppoa2 program must be patched, because bridging was available only since a few days ago. This is the patch. It needs to be added to the file pkgsrc/net/speedtouch/patches/patch-af (unexistent in the pkgsrc version speedtouch-1.3.1nb3).

--snip-->
--- src/pppoa2.c.orig   2004-09-29 16:56:31.000000000 -0400
+++ src/pppoa2.c        2005-02-15 22:01:19.000000000 -0300
@@ -27,7 +27,8 @@
 #ifndef _PPPOA2_C_
 #define _PPPOA2_C_
 
-#if defined (__FreeBSD__) || defined (__linux__) || defined (__OpenBSD__) || defined (__DragonFly__)
+#if defined (__FreeBSD__) || defined (__linux__) || defined (__OpenBSD__) || defined (__DragonFly__) \
+       || defined (__NetBSD__)
 #define BRIDGING_ENABLED
 #endif
 
@@ -575,7 +576,7 @@
        /* In Linux, pppd kill us with a term signal ! */
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
        /* ppp is supposed to send SIGHUP to its pty slave so trap SIGHUP */
-       signal(SIGHUP , sighandler);
+       /* signal(SIGHUP , sighandler); */
 #elif defined(__linux__)
        /* on linux it's supposed to be SIGTERM */
        signal(SIGTERM, sighandler);
@@ -1405,7 +1406,7 @@
 {
        int fd;
 
-#if defined (__FreeBSD__) || defined (__DragonFly__)
+#if defined (__FreeBSD__) || defined (__DragonFly__) || defined (__NetBSD__)
   int i;
   char devname[] = "/dev/tapXX";

<--snip--

In summary, the functions of the patch are:

According to the commentaries in the source code, the child process need to be killed with the purpose of releasing the usb port. The patch needs to be reviewed.

Then the checksum for the patch is made:

$ pwd
/usr/pkgsrc/net/speedtouch
$ make makepatchsum

Then, speedtouch is built:

$ pwd
/usr/pkgsrc/net/speedtouch
# make deinstall
# make install

Setting up PPPoE

The last thing to do is to configure the PPPoE device to be activated on boot:

(/etc/ifconfig.pppoe0)
create
#Comment Replace vpi and vci as needed.
! /usr/pkg/sbin/pppoa2 -vpi 8 -vci 32 -v 1 -b
#Comment Let pppoe0 use tap0 as its Ethernet interface
! /sbin/pppoectl -e tap0 pppoe0
#Comment Configure authentication
! /sbin/pppoectl pppoe0 myauthproto=pap 'myauthname=XXX' 'myauthsecret=YYY' hisauthproto=none
#Comment Configure the PPPoE interface itself. These addresses are magic
#Comment meaning we don't care about either address and let the remote
#Comment ppp choose them.
0.0.0.0 0.0.0.1 up
(/etc/ppp/ip-up)
#!/bin/sh
/sbin/route add default $5
/etc/rc.d/ipfilter reload
# anything needed to be activated at network start
(/etc/ppp/ip-down)
#!/bin/sh
/sbin/route delete default $5
(/etc/rc.conf)
net_interfaces="tap0 pppoe0" 	## add other interfaces as needed.
adsl=NO				# not needed
ifwatchd=YES			# look at pppoe0 and executes ip-up or ip-down

TODO

CONTACT

César Catrián C.
http://mioficina.cjc.cl/