aboutsummaryrefslogtreecommitdiffstats
path: root/package/ppp
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-07-30 03:09:09 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-07-30 03:09:09 +0000
commitd3a6fe9915875cb78ca3d22f8330a0380dcd58a0 (patch)
tree3a7ec356cf8ec9ada9d0ddbf6ccbd1cbb9aae869 /package/ppp
parentd5aeb2645530079ac89ed72e2eee91fbcbc38e84 (diff)
downloadupstream-d3a6fe9915875cb78ca3d22f8330a0380dcd58a0.tar.gz
upstream-d3a6fe9915875cb78ca3d22f8330a0380dcd58a0.tar.bz2
upstream-d3a6fe9915875cb78ca3d22f8330a0380dcd58a0.zip
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')
-rw-r--r--package/ppp/Makefile10
-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
7 files changed, 77 insertions, 85 deletions
diff --git a/package/ppp/Makefile b/package/ppp/Makefile
index 85d52d0542..e49b610c36 100644
--- a/package/ppp/Makefile
+++ b/package/ppp/Makefile
@@ -95,6 +95,8 @@ define Build/Compile
endef
define Package/ppp/install
+ install -d -m0755 $(1)/lib/network
+ install -m0755 ./files/ppp.sh $(1)/lib/network/
install -d -m0755 $(1)/etc/ppp
install -m0600 ./files/etc/ppp/chap-secrets $(1)/etc/ppp/
install -m0644 ./files/etc/ppp/filter $(1)/etc/ppp/
@@ -110,19 +112,19 @@ define Package/ppp/install
endef
define Package/ppp-mod-pppoa/install
+ install -d -m0755 $(1)/lib/network
+ install -m0755 ./files/pppoa.sh $(1)/lib/network/
install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \
$(1)/usr/lib/pppd/$(PKG_VERSION)/
- install -d -m0755 $(1)/sbin
- install -m0755 ./files/ifup.pppoa $(1)/sbin/
endef
define Package/ppp-mod-pppoe/install
+ install -d -m0755 $(1)/lib/network
+ install -m0755 ./files/pppoe.sh $(1)/lib/network/
install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \
$(1)/usr/lib/pppd/$(PKG_VERSION)/
- install -d -m0755 $(1)/sbin
- install -m0755 ./files/ifup.pppoe $(1)/sbin/
endef
define Package/ppp-mod-radius/install
diff --git a/package/ppp/files/ifup.pppoa b/package/ppp/files/ifup.pppoa
deleted file mode 100644
index f78a162ce5..0000000000
--- 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 c7019fc398..0000000000
--- 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 0000000000..0bb77b8284
--- /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 0000000000..e6530b073e
--- /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 0000000000..f263caaeef
--- /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 0000000000..7b33ac1ff7
--- /dev/null
+++ b/package/ppp/files/pptp.sh
@@ -0,0 +1,3 @@
+scan_pptp() {
+ scan_ppp "$@"
+}