summaryrefslogtreecommitdiffstats
path: root/package/ppp/files
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-07-30 03:09:09 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-07-30 03:09:09 +0000
commitc4f3575368c5aeef4134d82125df2814d688cc2a (patch)
tree3a7ec356cf8ec9ada9d0ddbf6ccbd1cbb9aae869 /package/ppp/files
parent31d94a76a79ef8c973fb75ee17713593bfb7ebbd (diff)
rewrite of the network scripts and configuration
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4323 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/ppp/files')
-rw-r--r--package/ppp/files/ifup.pppoa38
-rw-r--r--package/ppp/files/ifup.pppoe43
-rw-r--r--package/ppp/files/ppp.sh27
-rw-r--r--package/ppp/files/pppoa.sh20
-rw-r--r--package/ppp/files/pppoe.sh21
-rw-r--r--package/ppp/files/pptp.sh3
6 files changed, 71 insertions, 81 deletions
diff --git a/package/ppp/files/ifup.pppoa b/package/ppp/files/ifup.pppoa
deleted file mode 100644
index f78a162ce..000000000
--- a/package/ppp/files/ifup.pppoa
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-[ $# = 0 ] && { echo " $0 <group>"; exit; }
-. /etc/config/network
-type=$1
-
-eval "proto=\"\${${type}_proto}\""
-[ "$proto" = "pppoa" ] || {
- echo "$0: ${type}_proto isn't pppoa"
- exit
-}
-
-mkdir -p /var/lock
-
-for module in slhc ppp_generic pppoatm; do
- /sbin/insmod $module 2>&- >&-
-done
-
-KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5}
-case "$ppp_demand" in
- on|1|enabled)
- DEMAND=${ppp_idletime:+demand idle $ppp_idletime}
- [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
- ;;
- *) DEMAND="persist";;
-esac
-MTU=${ppp_mtu:-1500}
-
-/usr/sbin/pppd \
- plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \
- usepeerdns \
- defaultroute \
- linkname $type \
- ipparam $type \
- user "$ppp_username" \
- password "$ppp_passwd" \
- mtu $MTU mru $MTU \
- $DEMAND \
- $KEEPALIVE
diff --git a/package/ppp/files/ifup.pppoe b/package/ppp/files/ifup.pppoe
deleted file mode 100644
index c7019fc39..000000000
--- a/package/ppp/files/ifup.pppoe
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-[ $# = 0 ] && { echo " $0 <group>"; exit; }
-. /etc/config/network
-type=$1
-
-eval "proto=\"\${${type}_proto}\""
-[ "$proto" = "pppoe" ] || {
- echo "$0: ${type}_proto isn't pppoe"
- exit
-}
-
-mkdir -p /var/lock
-
-for module in slhc ppp_generic pppox pppoe; do
- /sbin/insmod $module 2>&- >&-
-done
-
-eval "IFNAME=\"\${${type}_device}\""
-KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5}
-case "$ppp_demand" in
- on|1|enabled)
- DEMAND=${ppp_idletime:+demand idle $ppp_idletime}
- [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
- ;;
- *) DEMAND="persist";;
-esac
-MTU=${ppp_mtu:-1492}
-
-ifconfig $IFNAME up
-/usr/sbin/pppd \
- plugin rp-pppoe.so \
- connect /bin/true \
- usepeerdns \
- defaultroute \
- linkname $type \
- ipparam $type \
- user "$ppp_username" \
- password "$ppp_passwd" \
- mtu $MTU mru $MTU \
- $DEMAND \
- $KEEPALIVE \
- nic-$IFNAME
-
diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh
new file mode 100644
index 000000000..0bb77b828
--- /dev/null
+++ b/package/ppp/files/ppp.sh
@@ -0,0 +1,27 @@
+scan_ppp() {
+ config_get ifname "$1" ifname
+ pppdev="${pppdev:-0}"
+ config_set "$1" device "$ifname"
+ config_set "$1" ifname "ppp$pppdev"
+ config_set "$1" unit "$pppdev"
+}
+
+start_pppd() {
+ local cfg="$1"; shift
+ config_get device "$cfg" device
+ config_get unit "$cfg" unit
+ config_get username "$cfg" username
+ config_get password "$cfg" password
+ config_get keepalive "$cfg" keepalive
+ config_get demand "$cfg" demand
+ [ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp/resolv.conf
+ /usr/sbin/pppd "$@" \
+ ${keepalive:+lcp-echo-interval 5 lcp-echo-failure $keepalive} \
+ ${demand:+precompiled-active-filter /etc/ppp/filter demand idle }${demand:-persist} \
+ usepeerdns \
+ defaultroute \
+ replacedefaultroute \
+ ${username:+username "$username" password "$password"} \
+ linkname "$cfg" \
+ ipparam "$cfg"
+}
diff --git a/package/ppp/files/pppoa.sh b/package/ppp/files/pppoa.sh
new file mode 100644
index 000000000..e6530b073
--- /dev/null
+++ b/package/ppp/files/pppoa.sh
@@ -0,0 +1,20 @@
+scan_pppoa() {
+ scan_ppp "$@"
+}
+
+setup_interface_pppoa() {
+ local iface="$1"
+ local config="$2"
+
+ config_get device "$config" device
+
+ for module in slhc ppp_generic pppoatm; do
+ /sbin/insmod $module 2>&- >&-
+ done
+
+ config_get mtu "$cfg" mtu
+ mtu=${mtu:-1492}
+ start_pppd "$config" \
+ plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \
+ mtu $mtu mru $mtu
+}
diff --git a/package/ppp/files/pppoe.sh b/package/ppp/files/pppoe.sh
new file mode 100644
index 000000000..f263caaee
--- /dev/null
+++ b/package/ppp/files/pppoe.sh
@@ -0,0 +1,21 @@
+scan_pppoe() {
+ scan_ppp "$@"
+}
+
+setup_interface_pppoe() {
+ local iface="$1"
+ local config="$2"
+
+ config_get device "$config" device
+
+ for module in slhc ppp_generic pppox pppoe; do
+ /sbin/insmod $module 2>&- >&-
+ done
+
+ config_get mtu "$cfg" mtu
+ mtu=${mtu:-1480}
+ start_pppd "$config" \
+ plugin rp-pppoe.so \
+ mtu $mtu mru $mtu \
+ "nic-$device"
+}
diff --git a/package/ppp/files/pptp.sh b/package/ppp/files/pptp.sh
new file mode 100644
index 000000000..7b33ac1ff
--- /dev/null
+++ b/package/ppp/files/pptp.sh
@@ -0,0 +1,3 @@
+scan_pptp() {
+ scan_ppp "$@"
+}