Hi, Nathan.
I'm looking at supporting Multilink PPP (using PPPoE) in OpenWrt and
LuCI.
I've experimented by adding a MLPPP protocol
to /usr/lib/lua/luci/model/network/proto_ppp.lua (and adding a copy of
proto_pppoe.lua to model/cbi/admin_network/proto_mlppp.lua).
Unfortunately the 320-custom_iface_names.patch PPP patch doesn't work
for Multilink PPP because mp_join_bundle() fails to find an IFNAME=pppX
when bringing up the second link.
So my MLPPP protocol as a virtual interface doesn't work because
virtual
interfaces have to be named $proto-$config (e.g. mlppp-wan).
Now I've tried setting MLPPP up so it's not virtual and specified ppp0
as the Custom Interface. But now I'm having trouble because my
proto_mlppp_setup() function in /lib/netifd/proto/ppp.sh doesn't seem
to
be getting called.
I suppose the best solution is to fix pppd so custom interface names
work with Multilink PPP, but for now where can I find the code that's
preventing my proto_mlppp_setup() from getting called? I'm guessing
it's because ppp0 doesn't exist (yet)?
Some time ago I've been building mlpppoe channel (its 4xpppoe over 18Mbps
adsl atm working for several months without noticeable problems). Attached
are patches I've used to get things working, network config from my ASUS
RT-N16 and /var/run/pppd2.tdb dump.
To get single pppoe-pppX bundled interface add config interface pppX to
your /etc/config/network for each link with option pppd_options multilink.
Then ifup your pppX interfaces and watch log - you should see first one
creating bundle and subsequent ones joining it.
Bear in mind patches provided won't make mlppp working for tty attached
links - only client-side mlppp with rp-pppoe or alike plugin.
Have nice day,
George
--- openwrt.orig/package/network/services/ppp/patches/404-multilink-fix-non-pppX-interface-naming.patch 1970-01-01 03:00:00.0 +0300
+++ openwrt/package/network/services/ppp/patches/404-multilink-fix-non-pppX-interface-naming.patch 2012-11-09 16:43:55.0 +0200
@@ -0,0 +1,146 @@
+From: George Kashperko geo...@znau.edu.ua
+
+Make mlppp support more generic interface naming other than pppX
+Signed-off-by: George Kashperko geo...@znau.edu.ua
+---
+ pppd/multilink.c | 55 +
+ pppd/sys-linux.c | 12 +
+ 2 files changed, 53 insertions(+), 14 deletions(-)
+--- ppp-2.4.5.orig/pppd/multilink.c 2009-11-17 00:26:07.0 +0200
ppp-2.4.5/pppd/multilink.c 2012-10-22 01:35:25.291630529 +0300
+@@ -56,7 +56,8 @@ static void iterate_bundle_links __P((vo
+
+ static int get_default_epdisc __P((struct epdisc *));
+ static int parse_num __P((char *str, const char *key, int *valp));
+-static int owns_unit __P((TDB_DATA pid, int unit));
++static int parse_str __P((char *str, const char *key, char *buf, int buflen));
++static int owns_link __P((TDB_DATA pid, char *ifname));
+
+ #define set_ip_epdisc(ep, addr) do { \
+ ep-length = 4; \
+@@ -197,35 +198,38 @@ mp_join_bundle()
+ key.dptr = bundle_id;
+ key.dsize = p - bundle_id;
+ pid = tdb_fetch(pppdb, key);
++
+ if (pid.dptr != NULL) {
++ char tmp[IFNAMSIZ];
++
+ /* bundle ID exists, see if the pppd record exists */
+ rec = tdb_fetch(pppdb, pid);
++
+ if (rec.dptr != NULL rec.dsize 0) {
+ /* make sure the string is null-terminated */
+ rec.dptr[rec.dsize-1] = 0;
+- /* parse the interface number */
+- parse_num(rec.dptr, IFNAME=ppp, unit);
++
+ /* check the pid value */
+ if (!parse_num(rec.dptr, PPPD_PID=, pppd_pid)
++ || !parse_str(rec.dptr, IFNAME=, tmp, sizeof(tmp))
++ || !parse_num(rec.dptr, IFUNIT=, unit)
+ || !process_exists(pppd_pid)
+- || !owns_unit(pid, unit))
++ || !owns_link(pid, tmp))
+ unit = -1;
+ free(rec.dptr);
+ }
+ free(pid.dptr);
+- }
+
+- if (unit = 0) {
+ /* attach to existing unit */
+- if (bundle_attach(unit)) {
++ if (unit = 0 bundle_attach(unit)) {
+ set_ifunit(0);
+ script_setenv(BUNDLE, bundle_id + 7, 0);
+ make_bundle_links(1);
+ unlock_db();
+- info(Link attached to %s, ifname);
++ info(Link attached to %s, tmp);
+ return 1;
++ /* attach failed because bundle doesn't exist */
+ }
+- /* attach failed because bundle doesn't exist */
+ }
+
+ /* we have to make a new bundle */
+@@ -408,22 +412,45 @@ parse_num(str, key, valp)
+ return 0;
+ }
+
++static int
++parse_str(str, key, buf, buflen)
++ char *str;
++ const char *key;
++ char *buf;
++ int buflen;
++{
++ char *p, *endp;
++ int i;
++
++ p = strstr(str, key);
++ if (p) {
++ p += strlen(key);
++ while (--buflen *p != 0 *p != ';')
++ *(buf++) = *(p++);
++ *buf = 0;
++ return 1;
++ }
++ return 0;
++}
++
+ /*
+- * Check whether the pppd identified by `key' still owns ppp unit `unit'.
++ * Check whether the pppd identified by `key' still owns ppp link `ifname'.
+ */
+ static int
+-owns_unit(key, unit)
++owns_link(key, ifname)
+ TDB_DATA key;
+- int unit;
++