1
0

121-debian_adaptive_lcp_echo.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --- a/pppd/lcp.c
  2. +++ b/pppd/lcp.c
  3. @@ -73,6 +73,7 @@ static void lcp_delayed_up __P((void *))
  4. */
  5. int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
  6. int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
  7. +bool lcp_echo_adaptive = 0; /* request echo only if the link was idle */
  8. bool lax_recv = 0; /* accept control chars in asyncmap */
  9. bool noendpoint = 0; /* don't send/accept endpoint discriminator */
  10. @@ -151,6 +152,8 @@ static option_t lcp_option_list[] = {
  11. OPT_PRIO },
  12. { "lcp-echo-interval", o_int, &lcp_echo_interval,
  13. "Set time in seconds between LCP echo requests", OPT_PRIO },
  14. + { "lcp-echo-adaptive", o_bool, &lcp_echo_adaptive,
  15. + "Suppress LCP echo requests if traffic was received", 1 },
  16. { "lcp-restart", o_int, &lcp_fsm[0].timeouttime,
  17. "Set time in seconds between LCP retransmissions", OPT_PRIO },
  18. { "lcp-max-terminate", o_int, &lcp_fsm[0].maxtermtransmits,
  19. @@ -2331,6 +2334,22 @@ LcpSendEchoRequest (f)
  20. }
  21. }
  22. + /*
  23. + * If adaptive echos have been enabled, only send the echo request if
  24. + * no traffic was received since the last one.
  25. + */
  26. + if (lcp_echo_adaptive) {
  27. + static unsigned int last_pkts_in = 0;
  28. +
  29. + update_link_stats(f->unit);
  30. + link_stats_valid = 0;
  31. +
  32. + if (link_stats.pkts_in != last_pkts_in) {
  33. + last_pkts_in = link_stats.pkts_in;
  34. + return;
  35. + }
  36. + }
  37. +
  38. /*
  39. * Make and send the echo request frame.
  40. */
  41. --- a/pppd/pppd.8
  42. +++ b/pppd/pppd.8
  43. @@ -563,6 +563,11 @@ to 1) if the \fIproxyarp\fR option is us
  44. dynamic IP address option (i.e. set /proc/sys/net/ipv4/ip_dynaddr to
  45. 1) in demand mode if the local address changes.
  46. .TP
  47. +.B lcp\-echo\-adaptive
  48. +If this option is used with the \fIlcp\-echo\-failure\fR option then
  49. +pppd will send LCP echo\-request frames only if no traffic was received
  50. +from the peer since the last echo\-request was sent.
  51. +.TP
  52. .B lcp\-echo\-failure \fIn
  53. If this option is given, pppd will presume the peer to be dead
  54. if \fIn\fR LCP echo\-requests are sent without receiving a valid LCP