User (uci) options related to pppd have no effect (cmdline ovverided by file)

I'm still learning, so be pls be gentle. There is a lot of information around and is scattered so much that I'm probably wrong.

Some pppd user settings are loaded and passed as arguments to pppd (/lib/netifd/proto/ppp.sh script, ppp_generic_setup function) but other settings are read from /etc/ppp/options.

My router: TD-W8970 v1
My /etc/ppp/options (noipv6 added by me since I do not use IPv6):

#debug
logfile /dev/null
noipdefault
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 5
lcp-echo-interval 1
noipv6

As exemple, maxfail value is set to 1 (cmdline) and it does not make sense since my pppd goes up after ~14 attempts, and that's is possible since maxfail is set to 0 ("unlimited attempts") inside /etc/ppp/options (and that is whats actually should always be, since if the connection fails I want my router to try to connect again).

I've disabled the peerdns request by removing usepeerdns from the script (pppd cmdline arguments), and let the ${peerdns:+set PEERDNS=$peerdns} (another argument).... but set is not a possible argument of pppd, PEERDNS should be USEPEERDNS and used as environment variable and not as argument (right?). I've exported both (just to be sure) USEPEERDNS=0 and PEERDNS=0 variables inside the pppd.sh script right before launching pppd and now /etc/ppp/resolv.conf is not created anymore (as expected).

Also:

  • Why pppd settings are scattered around multiple files?
  • Why "pppd settings related" logic is half inside /lib/netifd/proto/ppp.sh and half inside other netifd scripts?
  • Why /etc/ppp/options exist if is not modified by the user?
  • Why /lib/netifd/proto/ppp.sh reference /etc/ppp/options.pptp (almost at the end of the file), that does not exist?
  • Why eve maxfail is set to 1? (even if ignored later)
  • Why luci shows unset variable for LCP echo failure threshold, LCP echo interval and Inactivity timeout (not maxfail but related to it, see pppd script, should be persist) unset while they have a value inside /etc/ppp/options?
  • Why /etc/ppp/options first string is #debug? Is related only to the whole file or only logfile /dev/null?
  • Why /lib/netifd/proto/ppp.sh decide that maxfail should be 1? Even if ignored, for an home router, it does not really makes sense...
  • Why if I set LCP echo failure threshold = 0 (ignore failure) and LCP echo interval = 60 (1 echo request every minute) with luci, the values will not be set (like if I've never typed)? /etc/ppp/options was left the same.
  • Is there a way to get the full list of options (and their values of course) of a running pppd instance? so I know which value is kept and which is ignored?

Historical reasons mostly

ppp.sh deals with pppd specific logic while the netifd scripts deal with common logic applicable to all protocol backends

Because some users and some software configurations opt to execute pppd manually, in which case this file is needed.

This file is most likely shipped along with the optional ppp-mod-pptp

We want pppd to exit after one attempt if there's connection problem so that netifd notices the service termination and conditionally restarts the ppp service. We do not want pppd itself to keep retrying as netifd follows a different reconnect strategy and also requires deeper knowledge of the connection state to notify upper software layers.

This is a bug that has been recently addressed, see https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=555c592304023a0d24216a6d8ed9d525602ae218, https://git.openwrt.org/?p=project/luci.git;a=commitdiff;h=1b2065d0be7f74cb93fac7f208ee4f28666d3f69 and the related tickets.

If you uncomment "debug", pppd starts in debug mode and will write - among other things - the effective option set to the syslog

See explanation of maxfail above. We do not want pppd to keep retrying itself. We want it to die so that we can restart it ourself

See bug explanation above.

See debug explanation above

2 Likes

Ty for all the answer! But if thats true why is set to 0 inside /etc/ppp/options (whic override cmdline argument value)? And btw how it will behave with my situation if set to 1? Since I get around 15 failed connection before pppd start

Commandline values will always override configuration file values.

Ty sorry I read the wrong documentation (another pppd program).

Btw... what about the whole PEERDNS stuff?

It works as designed. Yes, pppd is always started with usepeerdns but the resulting data is conditionally used depending on whether usepeerdns is enabled or not.

How to properly remove "usepeerdns" from pppd's cmd-line ?

As written above, usepeerdns is unconditionally passed to pppd and the resulting information is sent to netifd which will decide whether to use or not use the received NS information.

There currently is no way to disable it from configuration. If you really need to remove it, you can get rid of it by editing /lib/netifd/proto/ppp.sh and rebooting the router.

Thank you very much for confirmation. I was afraid of this answer :slight_smile:

Is there any particular reason why you need that? Is the inclusion of usepeerdns causing troubles with your PPP peer? If so it might make sense to conditionally handle it in ppp.sh.

If you simply want to suppress the DNS servers, use option peerdns 0 in the corresponding config interface section.

1 Like

Seems to work:
....
/usr/sbin/pppd nodetach ipparam wwan ifname 3g-wwan set PEERDNS=0 nodefaultroute usepeerdns maxfail 0