diff options
Diffstat (limited to 'package/ppp')
-rw-r--r-- | package/ppp/Makefile | 17 | ||||
-rw-r--r-- | package/ppp/files/etc/ppp/filter | 23 | ||||
-rwxr-xr-x | package/ppp/files/etc/ppp/ip-up.d/if-rename | 17 | ||||
-rw-r--r-- | package/ppp/files/etc/ppp/peers/dsl | 12 | ||||
-rw-r--r-- | package/ppp/files/etc/ppp/templates/pppoa | 5 | ||||
-rw-r--r-- | package/ppp/files/etc/ppp/templates/pppoe (renamed from package/ppp/files/etc/ppp/templates/dsl) | 0 | ||||
-rwxr-xr-x | package/ppp/files/poff | 26 | ||||
-rwxr-xr-x | package/ppp/files/pon | 6 | ||||
-rwxr-xr-x | package/ppp/files/ppp.pre-up | 119 | ||||
-rw-r--r-- | package/ppp/patches/patch-pppd_ipv6cp_c | 10 | ||||
-rw-r--r-- | package/ppp/utils/pfc.c | 51 |
11 files changed, 158 insertions, 128 deletions
diff --git a/package/ppp/Makefile b/package/ppp/Makefile index 350095cb6..322812d9c 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -5,9 +5,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ppp PKG_VERSION:= 2.4.4 -PKG_RELEASE:= 17 +PKG_RELEASE:= 18 PKG_MD5SUM:= 183800762e266132218b204dfb428d29 -PKG_DESCR:= a PPP (Point-to-Point Protocol) software (with MPPE/MPPC support) +PKG_DESCR:= Point-to-Point Protocol software PKG_SECTION:= net PKG_DEPENDS:= kmod-ppp PKG_URL:= http://ppp.samba.org @@ -57,7 +57,6 @@ post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ${INSTALL_FILTER} ${INSTALL_BIN} ./files/etc/ppp/ip-up ${IDIR_PPP}/etc/ppp/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/ip-up.d - ${INSTALL_BIN} ./files/etc/ppp/ip-up.d/if-rename ${IDIR_PPP}/etc/ppp/ip-up.d/ ${INSTALL_BIN} ./files/etc/ppp/ip-down ${IDIR_PPP}/etc/ppp/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/ip-down.d ${INSTALL_DIR} ${IDIR_PPP}/usr/sbin @@ -66,8 +65,10 @@ post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ${INSTALL_BIN} ./files/pon ${IDIR_PPP}/usr/sbin/ ${INSTALL_BIN} ./files/poff ${IDIR_PPP}/usr/sbin/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/peers - ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/templates - ${INSTALL_DATA} ./files/etc/ppp/templates/dsl ${IDIR_PPP}/etc/ppp/templates/ + $(INSTALL_DIR) ${IDIR_PPP}/etc/network/if-pre-up.d + $(INSTALL_BIN) ./files/ppp.pre-up \ + ${IDIR_PPP}/etc/network/if-pre-up.d/ppp + mod-radius-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_RADIUS}/etc/radiusclient @@ -81,11 +82,17 @@ mod-pppoe-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPOE}/usr/lib/pppd/$(PKG_VERSION) ${INSTALL_BIN} $(WRKINST)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \ ${IDIR_PPP_MOD_PPPOE}/usr/lib/pppd/$(PKG_VERSION) + ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPOE}/etc/ppp/templates + ${INSTALL_DATA} ./files/etc/ppp/templates/pppoe \ + ${IDIR_PPP_MOD_PPPOE}/etc/ppp/templates/ mod-pppoa-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPOA}/usr/lib/pppd/$(PKG_VERSION) ${INSTALL_BIN} $(WRKINST)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \ ${IDIR_PPP_MOD_PPPOA}/usr/lib/pppd/$(PKG_VERSION) + ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPOA}/etc/ppp/templates + ${INSTALL_DATA} ./files/etc/ppp/templates/pppoa \ + ${IDIR_PPP_MOD_PPPOA}/etc/ppp/templates/ mod-chat-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_CHAT}/usr/sbin diff --git a/package/ppp/files/etc/ppp/filter b/package/ppp/files/etc/ppp/filter deleted file mode 100644 index ec72a81a0..000000000 --- a/package/ppp/files/etc/ppp/filter +++ /dev/null @@ -1,23 +0,0 @@ -# -# Expression: outbound and not icmp[0] != 8 and not tcp[13] & 4 != 0 -# -19 -48 0 0 0 -21 0 16 1 -40 0 0 2 -21 0 13 33 -48 0 0 13 -21 0 5 1 -40 0 0 10 -69 9 0 8191 -177 0 0 4 -80 0 0 4 -21 6 7 8 -21 0 5 6 -40 0 0 10 -69 3 0 8191 -177 0 0 4 -80 0 0 17 -69 1 0 4 -6 0 0 4 -6 0 0 0 diff --git a/package/ppp/files/etc/ppp/ip-up.d/if-rename b/package/ppp/files/etc/ppp/ip-up.d/if-rename deleted file mode 100755 index 061fd8861..000000000 --- a/package/ppp/files/etc/ppp/ip-up.d/if-rename +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -exit 0 # This script breaks ppp accounting - -[ "$LINKNAME" ] || exit 0 - -PATH=/bin:/usr/sbin:$PATH -if ip link show dev $LINKNAME >/dev/null;then - logger "$0: interface '$LINKNAME' already exists, cannot rename '$IFNAME'." - exit 0 -fi - -if ip route | grep -qE "^default.*dev $IFNAME *$"; then DEFAULT_ROUTE=1; fi - -ip link set $IFNAME down -ip link set $IFNAME name $LINKNAME -ip link set $LINKNAME up -if [ -n "$DEFAULT_ROUTE" ]; then ip route add default via $IPREMOTE; fi diff --git a/package/ppp/files/etc/ppp/peers/dsl b/package/ppp/files/etc/ppp/peers/dsl deleted file mode 100644 index 7ffc38082..000000000 --- a/package/ppp/files/etc/ppp/peers/dsl +++ /dev/null @@ -1,12 +0,0 @@ -plugin rp-pppoe.so -ipcp-accept-remote -ipcp-accept-local -usepeerdns -defaultroute -lcp-echo-interval 10 -lcp-echo-failure 3 -persist -maxfail 0 - -user "user@t-online.de" -password "secret" diff --git a/package/ppp/files/etc/ppp/templates/pppoa b/package/ppp/files/etc/ppp/templates/pppoa new file mode 100644 index 000000000..f3a142791 --- /dev/null +++ b/package/ppp/files/etc/ppp/templates/pppoa @@ -0,0 +1,5 @@ +plugin pppoatm.so +#VPI#.#VCI# +#ENCAPS# +user #USERNAME# +password #PASSWORD# diff --git a/package/ppp/files/etc/ppp/templates/dsl b/package/ppp/files/etc/ppp/templates/pppoe index 2ad285ede..2ad285ede 100644 --- a/package/ppp/files/etc/ppp/templates/dsl +++ b/package/ppp/files/etc/ppp/templates/pppoe diff --git a/package/ppp/files/poff b/package/ppp/files/poff index 955cebe8c..d81dcac2e 100755 --- a/package/ppp/files/poff +++ b/package/ppp/files/poff @@ -1,14 +1,12 @@ -#!/bin/mksh -(busybox ps ww | grep "[ /]pppd call $1\( .*\)*\$") |& -found=0 -rv=0 -while read thepid rest; do - if ! kill $thepid; then - print -u2 "$0: kill $thepid failed" - rv=1 - fi - found=1 -done -[[ $found = 1 ]] && exit $rv -print -u2 "$0: I could not find a pppd process for provider '$1'." -exit 1 +#!/bin/sh +PID=`ps w | grep "[ /]pppd call $1\( .*\)*\$" | awk '{print $1}'` +if test -n "$PID" ; then + kill $PID || { + echo "$0: kill failed." + exit 1 + } +else + echo "$0: I could not find a pppd process for provider '$1'." + exit 1 +fi +exit 0 diff --git a/package/ppp/files/pon b/package/ppp/files/pon index 1c2e5c50c..831730d19 100755 --- a/package/ppp/files/pon +++ b/package/ppp/files/pon @@ -1,8 +1,2 @@ #!/bin/sh -insmod slhc.o 2>/dev/null -insmod ppp_generic.o 2>/dev/null -insmod pppox.o 2>/dev/null -insmod pppoe.o 2>/dev/null -insmod ppp_async.o 2>/dev/null - exec /usr/sbin/pppd call $@ >/dev/null 2>&1 diff --git a/package/ppp/files/ppp.pre-up b/package/ppp/files/ppp.pre-up index e69de29bb..ec6cc5a31 100755 --- a/package/ppp/files/ppp.pre-up +++ b/package/ppp/files/ppp.pre-up @@ -0,0 +1,119 @@ +#!/bin/sh + +[ "$METHOD" == "ppp" ] || exit 0 +[ "$IF_USE_TEMPLATE" ] || exit 0 + +[ -d /var/lock ] || mkdir /var/lock + +[ -f "/etc/ppp/templates/$IF_USE_TEMPLATE" ] || { + logger "$0: requested template '/etc/ppp/templates/$IF_USE_TEMPLATE' not found." + exit 1 +} + +IDLEOPTIONS="persist\nmaxfail 0" +if [ "$IF_PPP_IDLETIME" -gt 0 ]; then + IDLEOTPIONS="idletime $IF_PPP_IDLETIME" +fi + +if [ "$IF_PPP_MTU" -gt 0 ] ; then + NETWORKOPTIONS="mtu $IF_PPP_MTU\nmru $IF_PPP_MTU" +fi + +REPLACE=" + s,#IDLEOPTIONS#,$IDLEOPTIONS, + s,#ENCAPS#,$IF_PPP_ENCAPS, + s,#VPI#,$IF_PPP_VPI, + s,#VCI#,$IF_PPP_VCI, + s,#USERNAME#,$IF_PPP_USERNAME, + s,#PASSWORD#,$IF_PPP_PASSWORD, + s,#DEVICE#,$IF_PPP_DEVICE, + s,#MODEMIP#,$IF_PPP_MODEMIP, + s,#NETWORKOPTIONS#,$NETWORKOPTIONS, +" + +sed "$REPLACE" < /etc/ppp/templates/$IF_USE_TEMPLATE > /etc/ppp/peers/$IF_PROVIDER + +[ "$IF_PPP_ENCAPS" ] || encap=0 +[ "$IF_PPP_PAYLOAD" ] || payload=1 +[ "$IF_PPP_VPI" ] || $IF_PPP_VPI=1 +[ "$IF_PPP_PAYLOAD" ] || $IF_PPP_VCI=32 + +case "$IF_PPP_PAYLOAD" in +bridged) + payload=1 + ;; +routed) + payload=0 + ;; +*) + echo "Wrong payload, use either bridged or routed" + exit 1 + ;; +esac + +case "$IF_PPP_ENCAPS" in +llc) + encap=0 + ;; +vc) + encap=1 + ;; +*) + echo "Wrong Encapsulation use either llc or vc" + exit 1 + ;; +esac + +case "$IF_PPP_DEVICE" in +nas*) + count=$(echo $IF_PPP_DEVICE|sed -e "s/nas//") + br2684ctl -b -c $count -e $encap -p $payload -a $IF_PPP_VPI.$IF_PPP_VCI + ip link set up dev $IF_PPP_DEVICE + ;; +esac + +case "$IF_USE_TEMPLATE" in +umts) + # set UMTS-LED to green (bit 3) + LED=$(cat /proc/sys/diag) + echo $((LED | 8)) > /proc/sys/diag + + # wait for card to initialize + COUNT=0 + while [ $((COUNT++)) -lt 20 ]; do + [ -c "$IF_PPP_DEVICE" ] && break + [ $COUNT -eq 20 ] && { + logger "$0: '$IF_PPP_DEVICE' not found" + exit 1 + } + sleep 1 + done + + # wait till the SIM is ready + comgt -s /etc/comgt/waitready.comgt -d $IF_PPP_DEVICE || exit 1 + + # set pincode + if [ "$IF_UMTS_PINCODE" ]; then + COMGTPIN="$IF_UMTS_PINCODE" comgt PIN -d $IF_PPP_DEVICE || ERROR=1 + fi + + # set APN + COMGTAPN="$IF_UMTS_APN" comgt APN -d $IF_PPP_DEVICE || ERROR=1 + + # set umts/gprs mode if available (Option cards only) + case "$IF_UMTS_MODE" in + gprs_only) comgt 2G -d $IF_PPP_DEVICE ;; + umts_only) comgt 3G -d $IF_PPP_DEVICE ;; + umts_first) comgt 3G2G -d $IF_PPP_DEVICE ;; + "") ;; + *) echo "unknown umts-mode, exiting" + ERROR=1 + ;; + esac + + if [ "$ERROR" == "1" ]; then + echo "$LED" > /proc/sys/diag + exit 1 + fi + ;; +esac diff --git a/package/ppp/patches/patch-pppd_ipv6cp_c b/package/ppp/patches/patch-pppd_ipv6cp_c new file mode 100644 index 000000000..1d4123776 --- /dev/null +++ b/package/ppp/patches/patch-pppd_ipv6cp_c @@ -0,0 +1,10 @@ +--- ppp-2.4.4.orig/pppd/ipv6cp.c 2005-08-26 01:59:34.000000000 +0200 ++++ ppp-2.4.4/pppd/ipv6cp.c 2009-12-18 09:06:00.333449663 +0100 +@@ -151,6 +151,7 @@ + */ + + #include <stdio.h> ++#include <stdlib.h> + #include <string.h> + #include <unistd.h> + #include <netdb.h> diff --git a/package/ppp/utils/pfc.c b/package/ppp/utils/pfc.c deleted file mode 100644 index 2344d56ed..000000000 --- a/package/ppp/utils/pfc.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Taken from fli4l 3.0 - * Make sure you compile it against the same libpcap version used in OpenADK - */ - -#include <stdlib.h> -#include <sys/types.h> -#include <sys/time.h> -#include <string.h> - -#include <linux/types.h> -#include <linux/ppp_defs.h> - -#include <pcap.h> -#include <pcap-bpf.h> - -int main (int argc, char ** argv) -{ - pcap_t *pc; /* Fake struct pcap so we can compile expr */ - struct bpf_program filter; /* Filter program for link-active pkts */ - u_int32_t netmask=0; - - int dflag = 3; - if (argc == 4) - { - if (!strcmp (argv[1], "-d")) - { - dflag = atoi (argv[2]); - argv += 2; - argc -=2; - } - } - if (argc != 2) - { - printf ("usage; %s [ -d <debug_level> ] expression\n", argv[0]); - return 1; - } - - pc = pcap_open_dead(DLT_PPP_PPPD, PPP_HDRLEN); - if (pcap_compile(pc, &filter, argv[1], 1, netmask) == 0) - { - printf ("#\n# Expression: %s\n#\n", argv[1]); - bpf_dump (&filter, dflag); - return 0; - } - else - { - printf("error in active-filter expression: %s\n", pcap_geterr(pc)); - } - return 1; -} |