SHA256
1
0
forked from pool/rp-pppoe
rp-pppoe/nonrfc-modems.diff

64 lines
2.2 KiB
Diff
Raw Normal View History

--- scripts/pppoe-setup.in
+++ scripts/pppoe-setup.in
@@ -110,6 +110,42 @@
fi
$ECHO ""
+ $ECHO "MODEM TYPE"
+ $ECHO ""
+ $ECHO "We will try to detect if your modem is compliant with RFC 2516"
+ $ECHO "or not. 3COM's 3CP4130 is *NOT* compliant, for instance."
+ $ECHO ""
+ $ECHO "Searching for a modem at interface $E..."
+ $PPPOE -A -I $E > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ # not found
+ # try 3COM's
+ $ECHO ""
+ $ECHO "Not found, trying with 3COM's code..."
+ result=`$PPPOE -A -I $E -f 3c12:3c13 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ $ECHO "Non-RFC2516 compliant modem found! Probably 3CP4130..."
+ $ECHO "Probing for service name..."
+ service=`echo "$result" | grep Service-Name | grep -v "3Com DL Manager" | cut -d : -f 2`
+ if [ -n "$service" ]; then
+ $ECHO "Found service name = $service"
+ PPPOE_EXTRA="-f 3c12:3c13 -S $service"
+ else
+ $ECHO "Couldn't find a service name, proceeding without one..."
+ PPPOE_EXTRA="-f 3c12:3c13"
+ fi
+ else
+ $ECHO ""
+ $ECHO "Didn't find a modem at interface $E, you can continue but"
+ $ECHO "things might not work as you expect... :("
+ $ECHO "You might want to re-run this script and try a different interface."
+ fi
+ else
+ $ECHO "Found a RFC 2516 compliant modem, congratulations! :)"
+ PPPOE_EXTRA=""
+ fi
+
+ $ECHO ""
$ECHO "Do you want the link to come up on demand, or stay up continuously?"
$ECHO "If you want it to come up on demand, enter the idle time in seconds"
$ECHO "after which the link should be dropped. If you want the link to"
@@ -221,6 +257,9 @@
$ECHO "** Summary of what you entered **"
$ECHO ""
$ECHO "Ethernet Interface: $E"
+ if [ -n "$PPPOE_EXTRA" ]; then
+ $ECHO "Extra parameters for modem (autodetected): \"$PPPOE_EXTRA\""
+ fi
$ECHO "User name: $U"
if [ "$D" = "no" ] ; then
$ECHO "Activate-on-demand: No"
@@ -297,6 +336,7 @@
-e "s/^DNS1=.*/DNS1=$DNS1/" \
-e "s/^DNS2=.*/DNS2=$DNS2/" \
-e "s/^PEERDNS=.*/PEERDNS=$PEERDNS/" \
+ -e "s/^PPPOE_EXTRA=.*/PPPOE_EXTRA=\"$PPPOE_EXTRA\"/" \
< $CONFIG-bak > $CONFIG
if [ $? != 0 ] ; then