summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2014-02-27 13:58:57 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2014-02-27 13:58:57 +0100
commit3b77f8666f19ca2ed1fc242d05d88706b8261863 (patch)
treeb059d893ecabac98697fe3b79eeef567e5ce2c0c
parentf64a2f25d435edd3507e477a25cb4c4e15297794 (diff)
downloadnetctl-3b77f8666f19ca2ed1fc242d05d88706b8261863.tar.gz
netctl-3b77f8666f19ca2ed1fc242d05d88706b8261863.tar.xz
Introduce a new PPP connection type
This should at some point take care of most PPP use cases, but currently is just a frontend to pppoe. The main difference is that the new connection type keeps track of profiles by their 'dynamic' interface name. Hence it is not wise to use both pppoe and ppp profiles.
-rw-r--r--docs/netctl.profile.5.txt10
-rw-r--r--src/lib/connections/ppp28
2 files changed, 38 insertions, 0 deletions
diff --git a/docs/netctl.profile.5.txt b/docs/netctl.profile.5.txt
index 2cf0285..649520b 100644
--- a/docs/netctl.profile.5.txt
+++ b/docs/netctl.profile.5.txt
@@ -44,6 +44,8 @@ AVAILABLE CONNECTION TYPES
available.
+dummy+::
For dummy interfaces.
++ppp+::
+ For PPP connections (currently only PPPoE).
+pppoe+::
For PPPoE connections.
+mobile_ppp+::
@@ -312,6 +314,14 @@ The name of the dummy interface is sepcified in 'Interface'. Only the
*ip options* are understood for connections of the `dummy' type.
+OPTIONS FOR `ppp' CONNECTIONS
+-----------------------------
+This connection type is identical to the `pppoe' type below, with the
+ethernet interface specified in 'BindsToInterfaces'. The value of
+'Interface' must be of the form `ppp<++n++>', where ++n++ is passed on as
+the value of 'PPPUnit'.
+
+
OPTIONS FOR `pppoe' CONNECTIONS
-------------------------------
The interface to dial peer-to-peer over ethernet is specified in
diff --git a/src/lib/connections/ppp b/src/lib/connections/ppp
new file mode 100644
index 0000000..dfc7805
--- /dev/null
+++ b/src/lib/connections/ppp
@@ -0,0 +1,28 @@
+. "$SUBR_DIR/connections/pppoe"
+
+ppp_compatible() {
+ if [[ ${#BindsToInterfaces[@]} -ne 1 ]]; then
+ report_error "No unique port for PPP interface '$Interface' specified"
+ return 1
+ fi
+ if [[ ! $Interface =~ ppp([[:digit:]]+) ]]; then
+ report_error "Interface '$Interface' is not of the supported form 'ppp<n>'"
+ return 1
+ fi
+ PPPUnit=${BASH_REMATCH[1]}
+ echo "$BindsToInterfaces"
+}
+
+ppp_up() {
+ local interface
+ interface=$(ppp_compatible) || return 1
+
+ Interface=$interface pppoe_up
+}
+
+ppp_down() {
+ local interface
+ interface=$(ppp_compatible) || return 1
+
+ Interface=$interface pppoe_down
+}