From beac990354337d62650a940eae66b25d5956eabf Mon Sep 17 00:00:00 2001 From: Mike Baker Date: Mon, 12 Jul 2004 03:36:25 +0000 Subject: [PATCH] pppoe support c/o below0 SVN-Revision: 88 --- obsolete-buildroot/README.pppoe | 103 ++++++++++++++++++ obsolete-buildroot/make/pppoecd.mk | 73 +++++++++++++ .../sources/pppoecd-pathnames.patch | 66 +++++++++++ obsolete-buildroot/sources/pppoecd.conffiles | 1 + obsolete-buildroot/sources/pppoecd.control | 10 ++ obsolete-buildroot/sources/pppoecd.ip-up | 5 + obsolete-buildroot/sources/pppoecd.patch | 27 +++++ obsolete-buildroot/sources/pppoecd.postrm | 4 + obsolete-buildroot/sources/pppoecd.prerm | 5 + 9 files changed, 294 insertions(+) create mode 100644 obsolete-buildroot/README.pppoe create mode 100644 obsolete-buildroot/make/pppoecd.mk create mode 100644 obsolete-buildroot/sources/pppoecd-pathnames.patch create mode 100644 obsolete-buildroot/sources/pppoecd.conffiles create mode 100644 obsolete-buildroot/sources/pppoecd.control create mode 100644 obsolete-buildroot/sources/pppoecd.ip-up create mode 100644 obsolete-buildroot/sources/pppoecd.patch create mode 100644 obsolete-buildroot/sources/pppoecd.postrm create mode 100644 obsolete-buildroot/sources/pppoecd.prerm diff --git a/obsolete-buildroot/README.pppoe b/obsolete-buildroot/README.pppoe new file mode 100644 index 0000000000..4c87d29af7 --- /dev/null +++ b/obsolete-buildroot/README.pppoe @@ -0,0 +1,103 @@ +OPENWRT PPPOECD NOTES +===================== + +1. GENERAL +---------- + +This package is used to estabilish basic connection to the +Internet via DSL/ADSL modems. This is also known as the +PPPoE or PPP-over-Ethernet connection. + +The PPPOECD program included in the OpenWrt distribution is a +modified version of the PPPOECD that is present in the original +Linksys firmware. + +This modified version is directly supported by the OpenWrt +startup scripts. + +2. BUILDING +----------- + +If you have a pre-compiled PPPOECD package, skip this section. + +PPPOECD can be built in two ways. As an integrated part +of the OpenWrt FLASH image or as an .ipk package that can +be installed separately. + +To build PPPOECD as an embedded component, add "pppoecd" to the +TARGETS variable in the main OpenWrt Makefile before the +"openwrt-bin" value. + +To build as a standalone package, add "pppoecd" to the +PACKAGES variable in the main OpenWrt Makefile. + +3. NVRAM variables +------------------ + +In order for the PPPoE link to be established by the networking +scripts the following NVRAM variables must be present: + +wan_ifname Should be set to: ppp0 + +wan_proto Should be set to: pppoe + +pppoe_ifname Set it to the WAN interface on which the PPPoE + is to function. On a 2.0 or a GS model it is + usually vlan1. The 1.0 and 1.1 models used vlan2. + +ppp_username User name for your PPPoE connection. + +ppp_passwd Password for the connection. + +ppp_redialperiod Time between reconnect attempts. + Usualy set to 30. + +ppp_idletime Time the link has to stay dead before reconnecting. + Usually set to 5. + +wan_mtu The Maxumum Transfer Unit for the PPPoE connection. + Typically 1492. + +Please consult the OpenWrt WIKI or the forum for more +information on NVRAM variables. + + +4. STARTUP / SHUTDOWN +--------------------- + +OpenWrt will attempt to connect using PPPOECD when starting up. +The script responsible for that is /etc/init.d/S40network. + +You can also manually start the PPPOECD by doing: + + . /etc/functions.sh; ifup wan + +Similarly you can shutdown the PPPOECD by doing: + + . /etc/functions.sh; ifdown wan + + +5. CONFIGURATION +---------------- + +PPPoE firewall configuration is the standard OpenWrt configuration +in /etc/init.d/S45firewall that applies to all the other types +of connections to the Internet. + +Additional actions can be performed when connecting or disconnecting +by modifying "ip-up" and "ip-down" scripts in the /etc/ppp directory. + +When connecting, PPPOECD creates /tmp/resolv.conf file that contains +DNS server entries as supplied by the ISP. The standard ip-up +script will also add a default route leading via the PPPoE link. + +6. DIFFERENCES FROM THE ORIGINAL PPPOECD +---------------------------------------- + +The main difference is the location of files. Original Linksys +PPPOECD operated almost exclusively in the /tmp/ppp directory. This +however prevents any persistent configuration of the program via +ip-up or ip-down scripts. Also the program itself was located in +/usr/sbin whereas OpenWrt scripts expect it to be in /sbin directory. + + diff --git a/obsolete-buildroot/make/pppoecd.mk b/obsolete-buildroot/make/pppoecd.mk new file mode 100644 index 0000000000..48ebbb8a36 --- /dev/null +++ b/obsolete-buildroot/make/pppoecd.mk @@ -0,0 +1,73 @@ +# build the Linksys pppoecd + +# Note that this patches the linksys pppd before patching pppoecd. +# The pppd patch changes the pathnames that pppoecd will use. +# In an attempt to avoid conflicts the marker file is called +# .patched-pppoecd in the pppd directory. + +PPPD_DIR=$(BUILD_DIR)/WRT54GS/release/src/router/ppp/pppd +PPPD_PATCH=$(SOURCE_DIR)/pppoecd-pathnames.patch + +PPPOECD_DIR=$(BUILD_DIR)/WRT54GS/release/src/router/ppp/pppoecd +PPPOECD_PATCH=$(SOURCE_DIR)/pppoecd.patch +PPPOECD_BIN=$(TARGET_DIR)/sbin/pppoecd + +PPPOECD_IPK_DIR=$(BUILD_DIR)/pppoecd-1.0 +PPPOECD_PACKAGE=$(BUILD_DIR)/pppoecd_1.0_mipsel.ipk +PPPOECD_IPK_BIN=$(PPPOECD_IPK_DIR)/sbin/pppoecd + +# patch pppd for the openwrt compatible path names +$(PPPD_DIR)/.patched-pppoecd: $(BUILD_DIR)/WRT54GS/.source + cat $(PPPD_PATCH) | patch -d $(PPPD_DIR) + touch $(PPPD_DIR)/.patched-pppoecd + +# patch the pppoecd itself for GCC3.x compatibility and to move pppoecd to /sbin +$(PPPOECD_DIR)/.patched: $(PPPD_DIR)/.patched-pppoecd + cat $(PPPOECD_PATCH) | patch -d $(PPPOECD_DIR) + touch $(PPPOECD_DIR)/.patched + +# build the pppoecd binary for the ipk version +$(PPPOECD_IPK_BIN): $(PPPOECD_DIR)/.patched + mkdir -p $(PPPOECD_IPK_DIR)/etc/ppp + cp $(SOURCE_DIR)/pppoecd.ip-up $(PPPOECD_IPK_DIR)/etc/ppp/ip-up + chmod a+x $(PPPOECD_IPK_DIR)/etc/ppp/ip-up + $(MAKE) -C $(PPPOECD_DIR) CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(PPPOECD_IPK_DIR) LIBDIR=$(UCLIBC_DIR)/lib \ + STRIP="$(STRIP)" \ + install + +# setup ipkg control files +$(PPPOECD_IPK_DIR)/CONTROL/control: + mkdir -p $(PPPOECD_IPK_DIR)/CONTROL + cp $(SOURCE_DIR)/pppoecd.prerm $(PPPOECD_IPK_DIR)/CONTROL/prerm + chmod a+x $(PPPOECD_IPK_DIR)/CONTROL/prerm + cp $(SOURCE_DIR)/pppoecd.postrm $(PPPOECD_IPK_DIR)/CONTROL/postrm + chmod a+x $(PPPOECD_IPK_DIR)/CONTROL/postrm + cp $(SOURCE_DIR)/pppoecd.conffiles $(PPPOECD_IPK_DIR)/CONTROL/conffiles + cp $(SOURCE_DIR)/pppoecd.control $(PPPOECD_IPK_DIR)/CONTROL/control + +# build the ipk package +$(PPPOECD_PACKAGE): $(PPPOECD_IPK_BIN) $(PPPOECD_IPK_DIR)/CONTROL/control + cd $(BUILD_DIR); $(STAGING_DIR)/bin/ipkg-build -c -o root -g root pppoecd-1.0 + +# main target for building the ipk version +pppoecd-ipk: $(PPPOECD_PACKAGE) + +# the embedded binary +$(PPPOECD_BIN): $(PPPOECD_DIR)/.patched + mkdir $(TARGET_DIR)/etc/ppp + cp $(SOURCE_DIR)/pppoecd.ip-up $(TARGET_DIR)/etc/ppp/ip-up + chmod a+x $(TARGET_DIR)/etc/ppp/ip-up + $(MAKE) -C $(PPPOECD_DIR) CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld \ + SRCBASE=$(OPENWRT_SRCBASE) INSTALLDIR=$(TARGET_DIR) LIBDIR=$(UCLIBC_DIR)/lib \ + STRIP="$(STRIP)" \ + install + +# main target for building the embedded version +pppoecd: $(PPPOECD_BIN) + +pppoecd-clean: + -$(MAKE) -C $(PPPOECD_DIR) clean + rm -f $(TARGET_DIR)/usr/sbin/pppoecd + rm -rf $(PPPOECD_IPK_DIR) + rm -f $(PPPOECD_PACKAGE) diff --git a/obsolete-buildroot/sources/pppoecd-pathnames.patch b/obsolete-buildroot/sources/pppoecd-pathnames.patch new file mode 100644 index 0000000000..e6c1099674 --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd-pathnames.patch @@ -0,0 +1,66 @@ +--- pathnames.h.orig Tue Oct 14 03:09:53 2003 ++++ pathnames.h Sat Jul 10 21:04:34 2004 +@@ -9,37 +9,37 @@ + + #else /* HAVE_PATHS_H */ + #ifndef _PATH_VARRUN +-#define _PATH_VARRUN "/tmp/ppp/" ++#define _PATH_VARRUN "/var/run" + #endif + #define _PATH_DEVNULL "/dev/null" + #endif /* HAVE_PATHS_H */ + + #ifndef _ROOT_PATH +-#define _ROOT_PATH ++#define _ROOT_PATH "/etc" + #endif + +-#define _PATH_UPAPFILE _ROOT_PATH "/tmp/ppp/pap-secrets" +-#define _PATH_CHAPFILE _ROOT_PATH "/tmp/ppp/chap-secrets" +-#define _PATH_SYSOPTIONS _ROOT_PATH "/tmp/ppp/options" +-#define _PATH_IPUP _ROOT_PATH "/tmp/ppp/ip-up" +-#define _PATH_IPDOWN _ROOT_PATH "/tmp/ppp/ip-down" +-#define _PATH_AUTHUP _ROOT_PATH "/tmp/ppp/auth-up" +-#define _PATH_AUTHDOWN _ROOT_PATH "/tmp/ppp/auth-down" +-#define _PATH_TTYOPT _ROOT_PATH "/tmp/ppp/options." +-#define _PATH_CONNERRS _ROOT_PATH "/tmp/ppp/connect-errors" +-#define _PATH_PEERFILES _ROOT_PATH "/tmp/ppp/peers/" +-#define _PATH_RESOLV _ROOT_PATH "/tmp/ppp/resolv.conf" ++#define _PATH_UPAPFILE _ROOT_PATH "/ppp/pap-secrets" ++#define _PATH_CHAPFILE _ROOT_PATH "/ppp/chap-secrets" ++#define _PATH_SYSOPTIONS _ROOT_PATH "/ppp/options" ++#define _PATH_IPUP _ROOT_PATH "/ppp/ip-up" ++#define _PATH_IPDOWN _ROOT_PATH "/ppp/ip-down" ++#define _PATH_AUTHUP _ROOT_PATH "/ppp/auth-up" ++#define _PATH_AUTHDOWN _ROOT_PATH "/ppp/auth-down" ++#define _PATH_TTYOPT _ROOT_PATH "/ppp/options." ++#define _PATH_CONNERRS "/tmp/connect-errors" ++#define _PATH_PEERFILES _ROOT_PATH "/ppp/peers/" ++#define _PATH_RESOLV "/tmp/resolv.conf" + + #define _PATH_USEROPT ".ppprc" + + #ifdef INET6 +-#define _PATH_IPV6UP _ROOT_PATH "/tmp/ppp/ipv6-up" +-#define _PATH_IPV6DOWN _ROOT_PATH "/tmp/ppp/ipv6-down" ++#define _PATH_IPV6UP _ROOT_PATH "/ppp/ipv6-up" ++#define _PATH_IPV6DOWN _ROOT_PATH "/ppp/ipv6-down" + #endif + + #ifdef IPX_CHANGE +-#define _PATH_IPXUP _ROOT_PATH "/tmp/ppp/ipx-up" +-#define _PATH_IPXDOWN _ROOT_PATH "/tmp/ppp/ipx-down" ++#define _PATH_IPXUP _ROOT_PATH "/ppp/ipx-up" ++#define _PATH_IPXDOWN _ROOT_PATH "/ppp/ipx-down" + #endif /* IPX_CHANGE */ + + #ifdef __STDC__ +@@ -48,7 +48,7 @@ + #ifdef HAVE_PATHS_H + #define _PATH_PPPDB "/var/run/pppd.tdb" + #else +-#define _PATH_PPPDB "/tmp/ppp/pppd.tdb" ++#define _PATH_PPPDB "/tmp/pppd.tdb" + #endif + #endif /* __STDC__ */ + diff --git a/obsolete-buildroot/sources/pppoecd.conffiles b/obsolete-buildroot/sources/pppoecd.conffiles new file mode 100644 index 0000000000..7ebe1156e0 --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.conffiles @@ -0,0 +1 @@ +/etc/ppp/ip-up diff --git a/obsolete-buildroot/sources/pppoecd.control b/obsolete-buildroot/sources/pppoecd.control new file mode 100644 index 0000000000..6996b8ecab --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.control @@ -0,0 +1,10 @@ +Package: pppoecd +Priority: optional +Version: 1.0 +Architecture: mipsel +Maintainer: below0 +Section: net +Source: Embedded in the main openwrt tarball +Description: Linksys PPPoE daemon for access to internet using DSL modems + + diff --git a/obsolete-buildroot/sources/pppoecd.ip-up b/obsolete-buildroot/sources/pppoecd.ip-up new file mode 100644 index 0000000000..da432949e7 --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.ip-up @@ -0,0 +1,5 @@ +#!/bin/sh + +# set default route +/sbin/route add default gw $IPREMOTE + diff --git a/obsolete-buildroot/sources/pppoecd.patch b/obsolete-buildroot/sources/pppoecd.patch new file mode 100644 index 0000000000..4fa4afc254 --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.patch @@ -0,0 +1,27 @@ +--- pppoe.c.orig Sat Jul 10 20:55:38 2004 ++++ pppoe.c Sat Jul 10 20:55:55 2004 +@@ -131,8 +131,7 @@ + + if (pppoe_srv_name !=NULL) { + if (strlen (pppoe_srv_name) > 255) { +- poe_error (ses," Service name too long +- (maximum allowed 256 chars)"); ++ poe_error (ses," Service name too long (maximum allowed 256 chars)"); + poe_die(-1); + } + ses->filt->stag = make_filter_tag(PTT_SRV_NAME, +--- Makefile.orig Sun Jul 11 03:26:49 2004 ++++ Makefile Sun Jul 11 03:27:18 2004 +@@ -68,9 +68,9 @@ + all: pppoecd + + install: all +- install -d $(INSTALLDIR)/usr/sbin +- install -m 755 pppoecd $(INSTALLDIR)/usr/sbin +- $(STRIP) $(INSTALLDIR)/usr/sbin/pppoecd ++ install -d $(INSTALLDIR)/sbin ++ install -m 755 pppoecd $(INSTALLDIR)/sbin ++ $(STRIP) $(INSTALLDIR)/sbin/pppoecd + + pppoecd: $(OBJS) + $(LD) -r -o .$@ $^ $(LIBCRYPT) diff --git a/obsolete-buildroot/sources/pppoecd.postrm b/obsolete-buildroot/sources/pppoecd.postrm new file mode 100644 index 0000000000..0d53d99f0f --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.postrm @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -rf /etc/ppp + diff --git a/obsolete-buildroot/sources/pppoecd.prerm b/obsolete-buildroot/sources/pppoecd.prerm new file mode 100644 index 0000000000..092bf00640 --- /dev/null +++ b/obsolete-buildroot/sources/pppoecd.prerm @@ -0,0 +1,5 @@ +#!/bin/sh + +killall pppoecd +sleep 3 +killall -9 pppoecd \ No newline at end of file -- 2.30.2