[arch-projects] [netcfg] [PATCH] Add PPPoE connection support
--- docs/examples/pppoe | 31 ++++++++++++++++++++ src/connections/pppoe | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 0 deletions(-) create mode 100644 docs/examples/pppoe create mode 100644 src/connections/pppoe diff --git a/docs/examples/pppoe b/docs/examples/pppoe new file mode 100644 index 0000000..2f50029 --- /dev/null +++ b/docs/examples/pppoe @@ -0,0 +1,31 @@ +CONNECTION='pppoe' +DESCRIPTION='Example PPPoE connection' +INTERFACE='eth0' +USER='example@yourprovider.com' +PASSWORD='very secret' + +# Always keep a connection established +CONNECTION_MODE='persist' +# Establish connection on demand +#CONNECTION_MODE='demand' +#IDLE_TIMEOUT=300 + +# Use default route provided by the peer (default: true) +#DEFAULTROUTE=1 +# Use DNS provided by the peer (default: true) +#USEPEERDNS=1 + +# Override default LCP parameters from /etc/ppp/options +#LCP_ECHO_INTERVAL=15 +#LCP_ECHO_FAILURE=10 + +# PPPoE options - experts only +# +# PPPoE service name +#PPPOE_SERVICE='' +# PPPoE access concentrator name +#PPPOE_AC='' +# Attach to existing session (sessid:macaddr) +#PPPOE_SESSION='' +# Only connect to specified MAC address +#PPPOE_MAC='' diff --git a/src/connections/pppoe b/src/connections/pppoe new file mode 100644 index 0000000..07eb9ae --- /dev/null +++ b/src/connections/pppoe @@ -0,0 +1,75 @@ +#! /bin/bash +. /usr/lib/network/network + +_quotestring() { + echo "\"${1/\"/\\\"}\"" +} + +pppoe_up() { + local cfg + load_profile "$1" + + mkdir -p "$STATE_DIR"/pppoe.eth0."$1"/ + chmod 700 "$STATE_DIR"/pppoe.eth0."$1"/ + cfg="$STATE_DIR"/pppoe.eth0."$1"/options + : > "${cfg}" + chmod 600 "${cfg}" + + echo "plugin rp-pppoe.so" >> "${cfg}" + echo "nic-${INTERFACE}" >> "${cfg}" + if checkyesno ${DEFAULTROUTE:-1}; then + echo "defaultroute" >> "${cfg}" + else + echo "nodefaultroute" >> "${cfg}" + fi + if checkyesno ${USEPEERDNS:-1}; then + echo "usepeerdns" >> "${cfg}" + fi + echo "linkname $(_quotestring "$1")" >> "${cfg}" + echo "maxfail 5" >> "${cfg}" + echo "updetach" >> "${cfg}" + if [[ ${CONNECTION_MODE} == demand ]]; then + echo "demand" >> "${cfg}" + echo "idle ${IDLE_TIMEOUT}" >> "${cfg}" + else + echo "persist" >> "${cfg}" + fi + echo "user $(_quotestring "${USER}")" >> "${cfg}" + echo "password $(_quotestring "${PASSWORD}")" >> "${cfg}" + [[ -n ${LCP_ECHO_INTERVAL} ]] && echo "lcp-echo-interval ${LCP_ECHO_INTERVAL}" >> "${cfg}" + [[ -n ${LCP_ECHO_FAILURE} ]] && echo "lcp-echo-failure ${LCP_ECHO_FAILURE}" >> "${cfg}" + [[ -n ${PPPOE_SERVICE} ]] && echo "rp_pppoe_service $(_quotestring "${PPPOE_SERVICE}")" >> "${cfg}" + [[ -n ${PPPOE_AC} ]] && echo "rp_pppoe_ac $(_quotestring "${PPPOE_AC}")" >> "${cfg}" + [[ -n ${PPPOE_SESSION} ]] && echo "rp_pppoe_sess $(_quotestring "${PPPOE_SESSION}")" >> "${cfg}" + [[ -n ${PPPOE_MAC} ]] && echo "pppoe-mac $(_quotestring "${PPPOE_MAC}")" >> "${cfg}" + + /sbin/ip link set dev ${INTERFACE} up + /usr/sbin/pppd file "${cfg}" + + if [[ $? -ne 0 ]]; then + rm "${cfg}" + rmdir "$STATE_DIR"/pppoe.eth0."$1"/ + report_fail "Couldn't make pppd connection." + return 1 + fi +} + +pppoe_down() { + load_profile "$1" + local cfg + cfg="$STATE_DIR"/pppoe.eth0."$1"/options + PIDFILE="/var/run/ppp-$1.pid" + + if [[ -e $PIDFILE ]]; then + PID=$(cat "$PIDFILE") + [[ -n "$PID" ]] && kill "$PID" + fi + + rm "${cfg}" + rmdir "$STATE_DIR"/pppoe.eth0."$1"/ +} + +pppoe_$1 "$2" +exit $? + +# vim: ft=sh ts=4 et sw=4: -- 1.7.8
Am 08.12.2011 23:28, schrieb Thomas Bächler:
--- docs/examples/pppoe | 31 ++++++++++++++++++++ src/connections/pppoe | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 0 deletions(-) create mode 100644 docs/examples/pppoe create mode 100644 src/connections/pppoe
Does anyone take care of netcfg? Does anyone handle patches?
It is orphaned, but Remy Oudompheng has a more or less active repo at http://projects.archlinux.org/users/remy/netcfg.git/ and is assigned to most of the netcfg bugs. On Sat, Dec 10, 2011 at 14:18, Thomas Bächler <thomas@archlinux.org> wrote:
Am 08.12.2011 23:28, schrieb Thomas Bächler:
--- docs/examples/pppoe | 31 ++++++++++++++++++++ src/connections/pppoe | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 0 deletions(-) create mode 100644 docs/examples/pppoe create mode 100644 src/connections/pppoe
Does anyone take care of netcfg? Does anyone handle patches?
On 2011/12/10 Thomas Bächler <thomas@archlinux.org> wrote:
Am 08.12.2011 23:28, schrieb Thomas Bächler:
--- docs/examples/pppoe | 31 ++++++++++++++++++++ src/connections/pppoe | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 0 deletions(-) create mode 100644 docs/examples/pppoe create mode 100644 src/connections/pppoe
Does anyone take care of netcfg? Does anyone handle patches?
Hello Thomas, Some months ago I said I could take care of merging patches and doing some releases and lately I have been lacking of time. I'd be glad if anybody would step up to take care correcly of it. A certain number of patches and problems are pending for some time. Rémy.
participants (3)
-
Jouke Witteveen
-
Rémy Oudompheng
-
Thomas Bächler