rp-pppoe: Add back from oldpackages with build fixes and enhanced packaging 2701/head
authorDaniel Dickinson <lede@daniel.thecshore.com>
Sun, 22 May 2016 00:35:10 +0000 (20:35 -0400)
committerDaniel Dickinson <lede@daniel.thecshore.com>
Mon, 23 May 2016 08:19:19 +0000 (04:19 -0400)
Add back from oldpackages with fixes for build errors and UCIfication
(for LuCI app submitted in a related PR (against LuCI repo)).

NOTE: Untested packages have been marked with @BROKEN.  This can
be undone of others report success with the sniffer

Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
13 files changed:
net/rp-pppoe/Makefile [new file with mode: 0644]
net/rp-pppoe/files/ppp/options [new file with mode: 0644]
net/rp-pppoe/files/ppp/pap-secrets [new file with mode: 0644]
net/rp-pppoe/files/ppp/pppoe-server-options [new file with mode: 0644]
net/rp-pppoe/files/ppp_defs.h [new file with mode: 0644]
net/rp-pppoe/files/pppoe-relay.default [new file with mode: 0644]
net/rp-pppoe/files/pppoe-relay.init [new file with mode: 0755]
net/rp-pppoe/files/pppoe-server.default [new file with mode: 0644]
net/rp-pppoe/files/pppoe-server.init [new file with mode: 0755]
net/rp-pppoe/files/pppoe.config [new file with mode: 0644]
net/rp-pppoe/patches/100-configure.patch [new file with mode: 0644]
net/rp-pppoe/patches/110-Makefile.patch [new file with mode: 0644]
net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch [new file with mode: 0644]

diff --git a/net/rp-pppoe/Makefile b/net/rp-pppoe/Makefile
new file mode 100644 (file)
index 0000000..f4a30c5
--- /dev/null
@@ -0,0 +1,147 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rp-pppoe
+PKG_VERSION:=3.11
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Daniel Dickinson <lede@daniel.thecshore.com>
+PKG_LICENSE:=LGPL-2.0+
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://roaringpenguin.com/files/download
+PKG_MD5SUM:=13b5900c56bd602df6cc526e5e520722
+
+PKG_BUILD_DEPENDS:=ppp
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rp-pppoe/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=PPPoE (PPP over Ethernet)
+  URL:=http://roaringpenguin.com/products/pppoe
+  SUBMENU:=dial-in/up
+endef
+
+define Package/rp-pppoe/Default/description
+  Dubbed RP-PPPoE, this open-source product is ideal for Linux users with
+  a DSL "modem" whose Internet service provider uses PPPoE.
+endef
+
+define Package/rp-pppoe-common
+  $(call Package/rp-pppoe/Default)
+  TITLE+= common
+  DEPENDS:=+ppp
+endef
+
+define Package/rp-pppoe-common/description
+$(call Package/rp-pppoe/Default/description)
+
+ This package contains files common to server and relay.
+endef
+
+define Package/rp-pppoe-common/conffiles
+/etc/config/pppoe
+endef
+
+define Package/rp-pppoe-relay
+  $(call Package/rp-pppoe/Default)
+  DEPENDS:=+rp-pppoe-common
+  TITLE+= relay
+  DEFAULT:=n
+endef
+
+define Package/rp-pppoe-relay/description
+$(call Package/rp-pppoe/Default/description)
+
+ This package contains pppoe-relay.
+endef
+
+define Package/rp-pppoe-relay/conffiles
+/etc/default/pppoe-relay
+endef
+
+define Package/rp-pppoe-server
+  $(call Package/rp-pppoe/Default)
+  DEPENDS:=+rp-pppoe-common
+  TITLE+= server
+endef
+
+define Package/rp-pppoe-server/conffiles
+/etc/ppp/pppoe-server-options
+/etc/ppp/options
+/etc/ppp/pap-secrets
+/etc/ppp/chap-secrets
+/etc/default/pppoe-server
+endef
+
+define Package/rp-pppoe-server/description
+$(call Package/rp-pppoe/Default/description)
+
+ This package contains pppoe-server.
+endef
+
+define Package/rp-pppoe-sniff
+  $(call Package/rp-pppoe/Default)
+  DEPENDS:=+ppp @BROKEN
+  TITLE+= sniffer
+endef
+
+define Package/rp-pppoe-sniff/description
+$(call Package/rp-pppoe/Default/description)
+
+ This package contains pppoe-sniff.
+endef
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/src/libevent -isystem $(PKG_BUILD_DIR)/missing-headers
+CONFIGURE_PATH := ./src
+CONFIGURE_ARGS += ac_cv_path_PPPD=/usr/sbin/pppd --enable-plugin=$(STAGING_DIR)/usr/include/
+MAKE_FLAGS := DESTDIR="$(PKG_INSTALL_DIR)" install
+MAKE_PATH := ./src
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)/missing-headers/net
+       $(CP) ./files/ppp_defs.h $(PKG_BUILD_DIR)/missing-headers/net/
+       $(call Build/Prepare/Default,$(1),$(2),$(3))
+endef
+
+define Package/rp-pppoe-common/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/pppoe.config $(1)/etc/config/pppoe
+endef
+
+define Package/rp-pppoe-relay/install
+       $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/pppoe-relay.init $(1)/etc/init.d/pppoe-relay
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-relay $(1)/usr/sbin/
+       $(INSTALL_DATA) ./files/pppoe-relay.default $(1)/etc/uci-defaults/
+endef
+
+define Package/rp-pppoe-server/install
+       $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/pppoe-server.init $(1)/etc/init.d/pppoe-server
+       $(INSTALL_DIR) $(1)/etc/ppp
+       $(INSTALL_CONF) ./files/ppp/{options,pap-secrets,pppoe-server-options} $(1)/etc/ppp/
+       $(INSTALL_DIR) $(1)/etc/ppp/plugins
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-server $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/etc/ppp/plugins/rp-pppoe.so $(1)/etc/ppp/plugins/
+       $(INSTALL_DATA) ./files/pppoe-server.default $(1)/etc/uci-defaults/
+endef
+
+define Package/rp-pppoe-sniff/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-sniff $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,rp-pppoe-common))
+$(eval $(call BuildPackage,rp-pppoe-relay))
+$(eval $(call BuildPackage,rp-pppoe-server))
+$(eval $(call BuildPackage,rp-pppoe-sniff))
diff --git a/net/rp-pppoe/files/ppp/options b/net/rp-pppoe/files/ppp/options
new file mode 100644 (file)
index 0000000..6b93f7b
--- /dev/null
@@ -0,0 +1,10 @@
+#debug
+logfile /dev/null
+noipdefault
+noaccomp
+nopcomp
+nocrtscts
+lock
+maxfail 0
+lcp-echo-failure 5
+lcp-echo-interval 1
diff --git a/net/rp-pppoe/files/ppp/pap-secrets b/net/rp-pppoe/files/ppp/pap-secrets
new file mode 100644 (file)
index 0000000..14b11d1
--- /dev/null
@@ -0,0 +1,2 @@
+# client       server          secret          IP addresses
+*              *               *               *
diff --git a/net/rp-pppoe/files/ppp/pppoe-server-options b/net/rp-pppoe/files/ppp/pppoe-server-options
new file mode 100644 (file)
index 0000000..a4b1da4
--- /dev/null
@@ -0,0 +1,9 @@
+# PPP options for the PPPoE server
+# LIC: GPL
+require-pap
+login
+lcp-echo-interval 10
+lcp-echo-failure 2
+mru 1492
+mtu 1492
+
diff --git a/net/rp-pppoe/files/ppp_defs.h b/net/rp-pppoe/files/ppp_defs.h
new file mode 100644 (file)
index 0000000..3a1e758
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef _NET_PPP_DEFS_H
+#define _NET_PPP_DEFS_H
+
+#define __need_time_t
+#include <time.h>
+
+#include <asm/types.h>
+#include <linux/ppp_defs.h>
+
+#endif
+
diff --git a/net/rp-pppoe/files/pppoe-relay.default b/net/rp-pppoe/files/pppoe-relay.default
new file mode 100644 (file)
index 0000000..c7a286a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -e /etc/default/pppoe-relay ]; then
+       if [ -z "$(uci get pppoe.@pppoe_relay[-1] 2>/dev/null)" ]; then
+               uci add pppoe pppoe_relay
+       fi
+       uci set pppoe.@pppoe-relay[-1].use_non_uci_config=1
+       uci commit pppoe
+fi
+
diff --git a/net/rp-pppoe/files/pppoe-relay.init b/net/rp-pppoe/files/pppoe-relay.init
new file mode 100755 (executable)
index 0000000..4aeeee8
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+USE_PROCD=1
+
+pppoe_triggers() {
+    local cfg="$1"
+    local interface server_interfaces client_interfaces both_interfaces
+    config_get server_interfaces "$cfg" server_interface
+    config_get client_interfaces "$cfg" client_interface
+    config_get both_interfaces "$cfg" both_interfaces
+    for interface in $server_interfaces; do
+       append interfaces "$interface" "|"
+    done
+    for interface in $client_interfaces; do
+       append interfaces "$interface" "|"
+    done
+    for interface in $both_interfaces; do
+       append interfaces "$interface" "|"
+    done
+}
+
+pppoe_relay_instance() {
+    local cfg="$1"
+    local interface server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS
+    config_get server_interfaces "$cfg" server_interface
+    config_get client_interfaces "$cfg" client_interface
+    config_get both_interfaces "$cfg" both_interfaces
+    config_get maxsessions "$cfg" maxsesssions
+    config_get timeout "$cfg" timeout
+    config_get_bool use_non_uci_config "$cfg" use_non_uci_config 0
+
+    if [ "$use_non_uci_config" -gt 0 ]; then
+       . /etc/default/pppoe-relay
+    else
+       [ -z "${server_interfaces}${client_interfaces}${both_interfaces}" ] && return 1
+       for interface in $server_interfaces; do
+           append OPTIONS "-S $interface"
+       done
+       for interface in $client_interfaces; do
+           append OPTIONS "-C $interface"
+        done
+       for interface in $both_interfaces; do
+           append OPTIONS "-B $interface"
+       done
+       [ -n "$maxsesssions" ] && append OPTIONS "-n $maxsesssions"
+       [ -n "$timeout" ] && append OPTIONS "-i $timeout"
+    fi
+
+    procd_open_instance
+    procd_set_param command /usr/sbin/pppoe-relay -F
+    procd_append_param command $OPTIONS
+    procd_close_instance
+}
+
+start_service() {
+       local use_non_uci_config
+
+       config_load pppoe
+       config_foreach pppoe_relay_instance pppoe_relay
+}
+
+reload_triggers() {
+       local interfaces
+
+       config_load pppoe
+       config_foreach pppoe_triggers pppoe_relay
+
+       procd_add_reload_trigger "pppoe"
+       procd_add_interface_trigger "$interfaces"
+}
diff --git a/net/rp-pppoe/files/pppoe-server.default b/net/rp-pppoe/files/pppoe-server.default
new file mode 100644 (file)
index 0000000..36c9b5a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -e /etc/default/pppoe-server ]; then
+       if [ -z "$(uci get pppoe.@pppoe_server[-1] 2>/dev/null)" ]; then
+               uci add pppoe pppoe_server_
+       fi
+       uci set pppoe.@pppoe-server[-1].use_non_uci_config=1
+       uci commit pppoe
+fi
+
diff --git a/net/rp-pppoe/files/pppoe-server.init b/net/rp-pppoe/files/pppoe-server.init
new file mode 100755 (executable)
index 0000000..dd2568e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+USE_PROCD=1
+
+pppoe_triggers() {
+       local cfg="$1"
+       local interface
+       config_get interface "$cfg" interface
+}
+
+pppoe_instance() {
+       local cfg="$1"
+       local interface ac_name service_names service_name maxsessionsperpeer localip firstremoteip maxsessions optionsfiles randomsession unit offset timeout mss sync OPTIONS
+       config_get interface "$cfg" interface
+       config_get ac_name "$cfg" ac_name
+       config_get service_names "$cfg" service_name
+       config_get maxsessionsperpeer "$cfg" maxsesssionsperpeer
+       config_get localip "$cfg" localip
+       config_get firstremoteip "$cfg" firstremoteip
+       config_get maxsessions "$cfg" maxsessions
+       config_get optionsfile "$cfg" optionsfile
+       config_get_bool randomsession "$cfg" randomsession 1
+       config_get_bool unit "$cfg" unit 0
+       config_get offset "$cfg" offset
+       config_get timeout "$cfg" timeout
+       config_get mss "$cfg" mss
+       config_get_bool sync "$cfg" sync 0
+       config_get use_non_uci_config "$cfg" use_non_uci_config 0
+
+       if [ "$use_non_uci_config" -gt 0 ]; then
+           . /etc/default/pppoe-server
+        else
+           [ -z "$interface" ] && return 1
+           [ -n "$ac_name" ] && append OPTIONS "-C $ac_name"
+           for service_name in $service_names; do
+               append OPTIONS "-S $service_name"
+           done
+           append OPTIONS "-I $interface"
+           [ -n "$maxsesssionsperpeer" ] && append OPTIONS "-x $maxsesssionsperpeer"
+           [ -n "$localip" ] && append OPTIONS "-L $localip"
+           [ -n "$firstremoteip" ] && append OPTIONS "-R $firstremoteip"
+           [ -n "maxsessions" ] && append OPTIONS "-N $maxsessions"
+           [ -n "optionsfile" ] && append OPTIONS "-O $optionsfile"
+           [ "$randomsession" = "1" ] && append OPTIONS "-r"
+           [ "$unit" = "1" ] && append OPTIONS "-u"
+           [ -n "$offset" ] && append OPTIONS "-o $offset"
+           [ -n "$timeout" ] && append OPTIONS "-T $timeout"
+           [ -n "$mss" ] && append OPTIONS "-m $mss"
+           [ "$sync" = "1" ] && append OPTIONS "-s"
+       fi
+
+       procd_open_instance
+       procd_set_param command /usr/sbin/pppoe-server -F
+       procd_append_param command $OPTIONS
+       procd_set_param file /etc/ppp/options
+       procd_append_param file /etc/ppp/pppoe-server-options
+       procd_close_instance
+}
+
+start_service() {
+       config_load pppoe
+       config_foreach pppoe_instance pppoe_server
+}
+
+service_triggers() {
+       local interface
+       config_load pppoe
+       config_foreach pppoe_triggers pppoe_server
+
+       procd_add_reload_trigger "pppoe"
+       procd_add_interface_trigger "$interface"
+}
diff --git a/net/rp-pppoe/files/pppoe.config b/net/rp-pppoe/files/pppoe.config
new file mode 100644 (file)
index 0000000..e5d1a38
--- /dev/null
@@ -0,0 +1,23 @@
+#config pppoe_server
+#      option interface eth1
+#      option ac_name access-concentrator-name
+#      list service_name service-name1
+#      list service_name service-name2
+#      option maxsessionsperpeer 0
+#      option localip 192.168.2.1
+#      option firsremoteip 192.168.2.2
+#      option maxsessions 64
+#      option optionsfile /etc/ppp/pppoe-server-options
+#      option randomsessions 1
+#      option unit 0
+#      option offset 0
+#      option timeout 60
+#      option mss 1468
+#      option sync 0
+
+#config pppoe_relay
+#      list server_interface eth1
+#      list client_interface eth0
+#      list both_interface eth2
+#      option maxsessions 64
+#      option timeout 60
diff --git a/net/rp-pppoe/patches/100-configure.patch b/net/rp-pppoe/patches/100-configure.patch
new file mode 100644 (file)
index 0000000..d45593a
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/src/configure
++++ b/src/configure
+@@ -3661,7 +3661,7 @@ done
+ for ac_header in linux/if.h
+ do :
+-  ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include<sys/socket.h>
++  ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include <sys/socket.h>
+ "
+ if test "x$ac_cv_header_linux_if_h" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+@@ -3675,10 +3675,11 @@ done
+ for ac_header in linux/if_pppox.h
+ do :
+   ac_fn_c_check_header_compile "$LINENO" "linux/if_pppox.h" "ac_cv_header_linux_if_pppox_h" "
+-#include<sys/socket.h>
+-#include<net/ethernet.h>
+-#include<linux/if.h>
+-#include<linux/in.h>
++#include <sys/socket.h>
++#include <net/ethernet.h>
++#include <linux/if.h>
++#include <linux/in.h>
++#include <linux/in6.h>
+ "
+ if test "x$ac_cv_header_linux_if_pppox_h" = x""yes; then :
+@@ -4611,7 +4612,7 @@ esac
+ $as_echo_n "checking packing order of bit fields... " >&6; }
+ if test "${rpppoe_cv_pack_bitfields+set}" != set ; then
+ if test "$cross_compiling" = yes; then :
+-  $ECHO "no defaults for cross-compiling"; exit 0
++  rpppoe_cv_pack_bitfields="$ac_cv_pack_bitfields"
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/net/rp-pppoe/patches/110-Makefile.patch b/net/rp-pppoe/patches/110-Makefile.patch
new file mode 100644 (file)
index 0000000..9dc1c72
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -71,7 +71,7 @@ pppoe-sniff: pppoe-sniff.o if.o common.o
+       @CC@ -o $@ $^ $(LDFLAGS)
+ pppoe-server: pppoe-server.o if.o debug.o common.o md5.o libevent/libevent.a @PPPOE_SERVER_DEPS@
+-      @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS) -Llibevent -levent
++      @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS)
+ pppoe: pppoe.o if.o debug.o common.o ppp.o discovery.o
+       @CC@ -o $@ $^ $(LDFLAGS)
diff --git a/net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch b/net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch
new file mode 100644 (file)
index 0000000..c9a5f69
--- /dev/null
@@ -0,0 +1,40 @@
+Index: rp-pppoe-3.11/src/configure
+===================================================================
+--- rp-pppoe-3.11.orig/src/configure   2016-05-21 23:42:58.142423086 -0400
++++ rp-pppoe-3.11/src/configure        2016-05-21 23:42:58.178423086 -0400
+@@ -3646,7 +3646,7 @@
+ done
+-for ac_header in fcntl.h sys/dlpi.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h netinet/if_ether.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h net/ethernet.h asm/types.h linux/if_packet.h linux/if_ether.h sys/socket.h sys/cdefs.h net/if.h net/if_dl.h net/if_ether.h net/if_types.h netinet/if_ether.h net/if_types.h net/if_dl.h
++for ac_header in fcntl.h sys/dlpi.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h asm/types.h linux/if_packet.h linux/if_ether.h sys/socket.h sys/cdefs.h net/if.h net/if_dl.h net/if_types.h net/if_types.h net/if_dl.h
+ do :
+   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+Index: rp-pppoe-3.11/src/if.c
+===================================================================
+--- rp-pppoe-3.11.orig/src/if.c        2012-08-17 14:31:25.000000000 -0400
++++ rp-pppoe-3.11/src/if.c     2016-05-21 23:45:13.546423086 -0400
+@@ -30,10 +30,6 @@
+ #include <linux/if_packet.h>
+ #endif
+-#ifdef HAVE_NET_ETHERNET_H
+-#include <net/ethernet.h>
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include <asm/types.h>
+ #endif
+Index: rp-pppoe-3.11/src/plugin.c
+===================================================================
+--- rp-pppoe-3.11.orig/src/plugin.c    2012-08-17 14:31:25.000000000 -0400
++++ rp-pppoe-3.11/src/plugin.c 2016-05-21 23:43:55.314423086 -0400
+@@ -49,7 +49,6 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#include <net/ethernet.h>
+ #include <net/if_arp.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_pppox.h>