Something I forgot to send you is Md's patch for PPPoA support.
See below.

Eduard.


----- Forwarded message from Marco d'Itri <[EMAIL PROTECTED]> -----

Date: Sat, 26 Mar 2005 16:32:52 +0100
From: Marco d'Itri <[EMAIL PROTECTED]>
Subject: PPPoA support for pppoeconf
To: Eduard Bloch <[EMAIL PROTECTED]>

This proof of concept patch implements the hard parts of PPPoA support.
The current code needs some refactoring before PPPoA support can be
properly added. I could do it, but I suppose you have your own idea
about how the code should be organized.

It does not support the eciadsl user space driver, but this should not
be a big deal considering that no new Globespan-based modems will be
produced.

-- 
ciao,
Marco

--- pppoeconf.orig      2005-03-26 13:30:23.000000000 +0100
+++ pppoeconf   2005-03-26 16:18:41.000000000 +0100
@@ -46,6 +46,97 @@
 
 # EOF SUID wrapper
 
+umask 177
+# make a secure directory
+TMP="`mktemp -d -p /etc/ppp`"
+export TMP
+sectempfile="`mktemp -p $TMP`"
+export sectempfile
+trap "rm -rf '$TMP'" 0 HUP INT TRAP TERM
+
+# check if a modem is present
+find_usb_modem() {
+  local drivers found
+
+  drivers="cxacru speedtch UNICORN"
+  for driver in $drivers; do
+    if test -f /proc/net/atm/$driver:0 ; then
+      found="/proc/net/atm/$driver:0"
+    fi
+  done
+  test "$found" || return 1
+
+  if egrep -q '(^Line up|modem state SHOWTIME)' $found; then
+    return 0 # modem found
+  fi
+
+  title=$(gettext 'LINE NOT UP')
+  text=$(gettext 'The modem driver reported that the DSL connection is not up. 
Please check your cabling and then run this program again.')
+  $DIALOG --title "$title" --clear --msgbox "$text" 10 60
+  exit 0
+}
+
+configure_br2684() {
+  local iface vpi_vci
+  iface=$1
+  vpi_vci=$2
+
+  if grep -q "^iface[[:space:]]$iface[[:space:]]" /etc/network/interfaces; then
+    return 0
+  fi
+  cat <<EOM >> /etc/network/interfaces
+
+auto $iface
+iface $iface inet manual
+       pre-up modprobe br2684
+       pre-up br2684ctl -b -c \${IFACE#nas} -a $vpi_vci
+       pre-up ip link set up \$IFACE
+       post-down kill \$(cat /var/run/\$IFACE.pid)
+EOM
+  ifup $iface
+}
+
+if find_usb_modem ; then
+  while : ; do
+    atmaddr="8.35"
+    title=$(gettext 'ENTER VPI/VCI')
+    text=$(gettext 'Please enter the VP and VC identifiers used by your ISP in 
the input box below, in the format VP.VCI. If you wish to see the help screen, 
delete the default and press OK.')
+    $DIALOG --nocancel --title "$title" --clear \
+      --inputbox "$text" 15 60 $atmaddr 2> "$sectempfile"
+    atmaddr=`cat "$sectempfile"`
+    if test $? != 0 ; then
+      rm -rf "$TMP"
+      exit 1
+    fi
+    if test -z "$atmaddr" ; then
+      # FIXME print a table of VP/VC used in different countries
+      $DIALOG --scrolltext --textbox "$TMP/atmaddrhelp.txt" 17 75
+    else
+      VPI_VCI=$atmaddr
+      break
+    fi
+  done
+
+  # Add the default ATM interface number
+  if echo "$VPI_VCI" | egrep -q '^[0-9]+\.[0-9]+$'; then
+    VPI_VCI="0.$VPI_VCI"
+  fi
+
+  # FIXME PPPoA assumes VCmux and PPPoE assumes LLC. But this usually works.
+  title=$(gettext 'USE PPPoE')
+  text=$(eval_gettext 'An USB modem has been detected. PPP over ATM is the 
best protocol to use with this kind of modems, but some ISPs only support PPP 
over Ethernet.
+
+Do you want to use PPP over Ethernet?')
+  $DIALOG --title "$title" --clear --defaultno --yesno "$text" 22 70
+  if test "$?" = "0" ; then
+    BR2684_INTERFACE="nas0"
+    configure_br2684 $BR2684_INTERFACE $VPI_VCI
+  else
+    kernel_pppoa=1
+  fi
+fi
+
+if test -z "$kernel_pppoa" ; then
 modprobe -q pppoe
 # recent ppp packages have a PPPoE discovery helper program
 if test -x /usr/sbin/pppoe-discovery && test -e /proc/net/pppoe ; then
@@ -54,7 +145,7 @@
 else
   DISCOVERY_PROGRAM=pppoe
 fi
-export DISCOVERY_PROGRAM
+fi
 
 # create a default peers file if there is none
 if ! test -r $OPTSFILE ; then
@@ -81,14 +172,6 @@
    printf '\niface dsl-provider inet ppp\n     provider dsl-provider\n' >> 
$INTFILE
 fi
    
-umask 177
-# make a secure directory
-TMP="`mktemp -d -p /etc/ppp`"
-export TMP
-sectempfile="`mktemp -p $TMP`"
-export sectempfile
-trap "rm -rf '$TMP'" 0 HUP INT TRAP TERM
-
 gettext '
 Most providers send the needed login information per mail. Some providers 
describe it in odd ways, assuming the user to input the data in their 
"user-friendly" setup programs. But in fact, these applications generate usuall 
PPP user names and passwords from the entered data. You can find the real names 
too and input the correct data in the dialog box.
 
@@ -138,7 +221,10 @@
   complete username: sdt/11111111111
 ' > $TMP/namehelp.txt
 
-if test "$*" ; then 
+if test "$BR2684_INTERFACE" ; then
+   list="$BR2684_INTERFACE"
+   force_manual=1
+elif test "$*" ; then 
    list="$*"
    force_manual=1
 else
@@ -146,6 +232,7 @@
 fi
 
 if test "$list" ; then
+  # FIXME PPPoA does not support probing
    test "$DIALOG" = "whiptail" && escmsg=$(gettext 'Or press ESC to abort 
here.')
   number=`echo $list | wc -w| tr -d " "`
   text=$(eval_ngettext \
@@ -223,7 +310,13 @@
    $DIALOG --title "$title" --clear --yesno "$text" 15 60
 
    if test "$?" = "0"; then
-      if [ "$kernel_pppoe" ]; then
+      if [ "$kernel_pppoa" ]; then
+       # install the default line
+       grep -q '^.*plugin.*pppoatm.so' $OPTSFILE || echo "plugin pppoatm.so" 
>> $OPTSFILE
+
+       # set the interface
+       sed -i -e "s,^plugin.\+pppoatm.so[[:space:]]\+[[:digit:]\.]*,plugin 
pppoatm.so $VPI_VCI," $OPTSFILE
+      elif [ "$kernel_pppoe" ]; then
         # sanity check first
        grep -q "^plugin.*rp-pppoe.so" $OPTSFILE || echo "plugin rp-pppoe.so 
$iface" >> $OPTSFILE
        # disable the pppoe tunnel command
@@ -335,6 +428,7 @@
      ;;
   esac
   
+  # FIXME: usually not needed when using PPPoA
   # ask about MSS limitation
   title=$(gettext 'LIMITED MSS PROBLEM')
   text=$(gettext "Many providers have routers that do not support TCP packets 
with a MSS higher than 1460. Usually, outgoing packets have this MSS when they 
go through one real Ethernet link with the default MTU size (1500). 
Unfortunately, if you are forwarding packets from other hosts (i.e. doing 
masquerading) the MSS may be increased depending on the packet size and the 
route to the client hosts, so your client machines won't be able to connect to 
some sites. There is a solution: the maximum MSS can be limited by pppoe. You 
can find more details about this issue in the pppoe documentation.


----- End forwarded message -----

-- 
<asuffield> we should have a button on every computer marked "?", and
  connected to twenty pounds of semtex, and then let evolution take its
  course                                    // quote from #debian-devel


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to