Browse Source

make pppoe over atm usable on ag241

- bridging nas0 and eth0 although works fine

need to add pre-up scripts to automate..
Waldemar Brodkorb 15 years ago
parent
commit
163e7965f0

+ 4 - 0
mk/modules.mk

@@ -90,6 +90,10 @@ $(eval $(call KMOD_template,ATM,atm,\
 	$(MODULES_DIR)/kernel/net/atm/atm \
 ,50))
 
+$(eval $(call KMOD_template,ATM_BR2684,atm-br2684,\
+	$(MODULES_DIR)/kernel/net/atm/br2684 \
+,51))
+
 $(eval $(call KMOD_template,BRIDGE,bridge,\
 	$(MODULES_DIR)/kernel/net/llc/llc \
 	$(MODULES_DIR)/kernel/net/802/stp \

+ 1 - 0
package/linux-atm/Config.in

@@ -8,6 +8,7 @@ config ADK_PACKAGE_BR2684CTL
 	tristate
 	default n
 	select ADK_PACKAGE_LIBATM
+	select ADK_KPACKAGE_KMOD_ATM_BR2684
 	select ADK_COMPILE_LINUX_ATM
 	depends on !ADK_HOST_FREEBSD
 	help

+ 12 - 5
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

+ 0 - 23
package/ppp/files/etc/ppp/filter

@@ -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

+ 0 - 17
package/ppp/files/etc/ppp/ip-up.d/if-rename

@@ -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

+ 0 - 12
package/ppp/files/etc/ppp/peers/dsl

@@ -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"

+ 5 - 0
package/ppp/files/etc/ppp/templates/pppoa

@@ -0,0 +1,5 @@
+plugin pppoatm.so 
+#VPI#.#VCI#
+#ENCAPS#
+user #USERNAME#
+password #PASSWORD#

+ 0 - 0
package/ppp/files/etc/ppp/templates/dsl → package/ppp/files/etc/ppp/templates/pppoe


+ 12 - 14
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

+ 0 - 6
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

+ 119 - 0
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

+ 10 - 0
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>

+ 0 - 51
package/ppp/utils/pfc.c

@@ -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;
-}

+ 6 - 0
target/linux/config/Config.in.network

@@ -58,6 +58,12 @@ config ADK_KPACKAGE_KMOD_ATM
 	 of ATM.  See the file <file:Documentation/networking/atm.txt> for
 	 further details.
 
+config ADK_KPACKAGE_KMOD_ATM_BR2684
+	prompt "kmod-atm-br2684................... BR2684 ATM module"
+	tristate
+	default n
+	help
+
 config ADK_KPACKAGE_KMOD_BRIDGE
 	prompt "kmod-net-bridge................... 802.1d Ethernet Bridging"
 	tristate