On my router I'd like to have a PPPoE connection out of the WAN port, and a 3G connection from a USB stick I've got.
If the PPPoE connection is up, it's ppp0. If I bring the 3G connection up, it kicks off the PPPoE connection and takes over ppp0. The only way I can get around this is to set the ifname to ppp1 for the 3G connection. With this, both connections can exist.
I was wondering though, if OpenWRT doesn't check to see if pppX exists before bringing up a connection to intelligently bump up the ifname to avoid conflicts, then what the hell is the scan_ppp() function for in /lib/network/ppp.sh?
scan_ppp() {
config_get ifname "$1" ifname
pppdev="${pppdev:-0}"
config_get unit "$1" unit
[ -z "$unit" ] && {
unit="$pppdev"
if [ "${ifname%%[0-9]*}" = ppp ]; then
unit="${ifname##ppp}"
[ "$pppdev" -le "$unit" ] && pppdev="$(($unit + 1))"
else
pppdev="$(($pppdev + 1))"
fi
config_set "$1" ifname "ppp$unit"
config_set "$1" unit "$unit"
}
}
What is the purpose of this function if it only results in setting the ifname of a PPP connection to whatever it originally read on line 1?
If there were a place to put code to increment the pppX devices, would this be it?
Thanks.