1. pl_shibby
  2. tomato-arm
  3. Issues


Issue #29 closed

MultiWAN code bugs

nikk gitanes
created an issue

Hi, I played around with new M-WAN code and found it's far from ideal with current implementation.

It have issues with DHCP routes and PPP options in case of PPPoE, PPTP, L2TP WAN conections:

a) udhcpc needs keys to receive those options: https://bitbucket.org/tsynik/tomato-arm/diff/release/src-rt-6.x.4708/router/rc/dhcp.c?diff2=58a037050425&at=shibby-arm https://bitbucket.org/tsynik/tomato-arm/diff/release/src-rt-6.x.4708/router/rc/dhcp.c?diff2=39d55a13d6bc&at=shibby-arm

classless routes, which received by DHCP on MAN interface not exist in routing table at all, but they present in wan(x)_routes1 variable:


b) xl2tpd can't find it's configuration in /etc/xl2tpd.conf (now it's located at /etc/{wanX-xl2tpd.conf) so won't start (for L2TP WAN). xl2tpd.conf can have one global section, and one ore 2 - 3 - 4 lacs which describes all L2TP WAN interfaces.

c) ip-up scripts, executed on PPP WAN connections, wrongly passed variables (prefix) in to start_wan_done () function, when PPTP/L2TP WAN with DHCP MAN used (scripts got wan4 by on dhcp routines)

Comments (12)

  1. nikk gitanes reporter

    ip-up / down fooled by this function in ppp.c:

    void ppp_prefix(char *wan_device, char *prefix)
        if(!strcmp(wan_device, nvram_safe_get("wan_ifnameX"))) strcpy(prefix, "wan");
        if(!strcmp(wan_device, nvram_safe_get("wan2_ifnameX"))) strcpy(prefix, "wan2");
        if(!strcmp(wan_device, nvram_safe_get("wan3_ifnameX"))) strcpy(prefix, "wan3");
        if(!strcmp(wan_device, nvram_safe_get("wan4_ifnameX"))) strcpy(prefix, "wan4");

    it returns "wan4" if wan_device is empty (PPTP/L2TP WAN).

    Also, in case of 3G Modem on WAN, fw passes /dev/ttyUSB0 as device to it, for example.

  2. pl_shibby repo owner

    thank you. I watch your repo from few days and cherry-picked almost all your commit. Good Job.

    All your fixes already have in my local repo. I will push my changes to git probably tomorrow. Best Regards.

  3. nikk gitanes reporter

    Thanks for update, Shibby. Now it works almost good ;-) I've updated wan.c to generate shared xl2tpd.conf with different LACs, and fixed some mistakes in ppp.c (ppp+ interface must not be removed for mwanroute code). Also fixed wan led off code. The only issue I have now is: in case L2TP WAN - it works as single connection, but in case of two (2nd as 3G, DHCP etc) connection dropped after ~1 minute. I think it's routing problem, related to xl2tpd must have route to l2tp server via MAN interface, but it's not populated? In case PPTP there is no such problem surprisedly. Also, for some strange reason DNS list also empty in /etc/resolv.dnsmasq if I setup few WANs, so only IP as a server for PPTP/L2TP works.

    Here is some code which tweaks IPs for PPP connections, which used in mwan routing code:


    it's not enough, but it works for PPTP/PPPoE + DHCP MWANs perfectly.

  4. Tony Arnold

    It looks like some of the QoS schedulers are missing too: the codel variants (including fq_codel which is what I was using) is gone. Enabling QoS under 134 seems to stop any communication outside my network.

  5. nikk gitanes reporter
  6. Log in to comment