Subject: in-kernel PPPoE
To: None <tech-kern@NetBSD.ORG>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 04/10/2001 23:33:00
Hi!

In my famous naivity I tried to use an old 486 @ 50 MHZ as my DSL router.
Running the rp-pppoe pkg from pkgsrc this results in abysmal performance
(limiting download rate to something between 10 and 20 kByte/s instead of
the expected ~80kByte/s for my connection).

So I did an in-kernel implementation of PPPoE (RFC 2516). To get this
done as fast as possible I reused the in-kernel sppp implementation in
syssrc/net/if_spppsubr.c - slightly modified to not generate any framing.

This now basically works, but has 3 known bugs:

 - When LCP goes down, the PPPoE session is terminated, but somehow the
   state machine in if_spppsubr.c is not informed. A new LCP open will
   not create a new PPPoE session, but send the LCP packets as PPPoE
   discovery frames. Very bad thing, but easy to fix. (Couldn't fix it
   right now because my wife needed the DSL connection)

 - Tcpdump does not work. That is somewhat to be expected.

 - Ipnat does not work at all. Ipnat -l shows the right things, but
   it just does not work. I have no clue what's wrong here and would
   realy appreciate any hints.

Config is preliminary, but working. I use a script like this:

---8<---
#! /bin/sh

/sbin/ifconfig ne0 up

/usr/sbin/ispppcontrol -e ne0 pppoe0

/usr/sbin/ispppcontrol pppoe0 \
  myauthproto=pap \
  myauthname=XXXXXXXXXXXXXXXXXXXXXXXX\#0001@t-online.de \
  myauthsecret=XXXXXXXX \
  hisauthproto=none

/sbin/ifconfig pppoe0 0.0.0.0 0.0.0.1 up

route flush
route add -net default 0.0.0.1 -iface
--->8---

Note that "ispppcontrol" has a new link "pppoectl" (acording to the 
Makefile diffs in the archive). I'm open to sugestions for something better
(and for any ideas on the implementation of the "-d" option described in the
pppoectl man page, but not implemented yet.)

Please find the patches/new files at:

   ftp.netbsd.org:/pub/NetBSD/misc/martin/pppoe.tar.bz2

Comments, hints, spelling fixes ;-) welcome.


Martin