207-ppp_reconnect.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. Index: ppp-2.4.3/pppd/auth.c
  2. ===================================================================
  3. --- ppp-2.4.3.orig/pppd/auth.c 2007-06-04 13:22:07.941647968 +0200
  4. +++ ppp-2.4.3/pppd/auth.c 2007-06-04 13:22:13.340827168 +0200
  5. @@ -532,6 +532,12 @@
  6. link_required(unit)
  7. int unit;
  8. {
  9. +}
  10. +
  11. +void
  12. +start_link(unit)
  13. + int unit;
  14. +{
  15. new_phase(PHASE_SERIALCONN);
  16. devfd = the_channel->connect();
  17. @@ -984,10 +990,12 @@
  18. int unit, protocol, prot_flavor;
  19. {
  20. int bit;
  21. + const char *prot = "";
  22. switch (protocol) {
  23. case PPP_CHAP:
  24. bit = CHAP_WITHPEER;
  25. + prot = "CHAP";
  26. switch (prot_flavor) {
  27. case CHAP_MD5:
  28. bit |= CHAP_MD5_WITHPEER;
  29. @@ -1006,15 +1014,19 @@
  30. if (passwd_from_file)
  31. BZERO(passwd, MAXSECRETLEN);
  32. bit = PAP_WITHPEER;
  33. + prot = "PAP";
  34. break;
  35. case PPP_EAP:
  36. bit = EAP_WITHPEER;
  37. + prot = "EAP";
  38. break;
  39. default:
  40. warn("auth_withpeer_success: unknown protocol %x", protocol);
  41. bit = 0;
  42. }
  43. + notice("%s authentication succeeded", prot);
  44. +
  45. /* Save the authentication method for later. */
  46. auth_done[unit] |= bit;
  47. @@ -1648,6 +1660,7 @@
  48. static void
  49. plogout()
  50. {
  51. + char *tty;
  52. #ifdef USE_PAM
  53. int pam_error;
  54. @@ -1658,14 +1671,12 @@
  55. }
  56. /* Apparently the pam stuff does closelog(). */
  57. reopen_log();
  58. -#else /* ! USE_PAM */
  59. - char *tty;
  60. +#endif /* USE_PAM */
  61. tty = devnam;
  62. if (strncmp(tty, "/dev/", 5) == 0)
  63. tty += 5;
  64. logwtmp(tty, "", ""); /* Wipe out utmp logout entry */
  65. -#endif /* ! USE_PAM */
  66. logged_in = 0;
  67. }
  68. Index: ppp-2.4.3/pppd/main.c
  69. ===================================================================
  70. --- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:10.548251704 +0200
  71. +++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:13.340827168 +0200
  72. @@ -537,6 +537,7 @@
  73. script_unsetenv("BYTES_RCVD");
  74. lcp_open(0); /* Start protocol */
  75. + start_link(0);
  76. while (phase != PHASE_DEAD) {
  77. handle_events();
  78. get_input();
  79. Index: ppp-2.4.3/pppd/pppd.h
  80. ===================================================================
  81. --- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:11.615089520 +0200
  82. +++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:13.341827016 +0200
  83. @@ -526,6 +526,7 @@
  84. /* Procedures exported from auth.c */
  85. void link_required __P((int)); /* we are starting to use the link */
  86. +void start_link __P((int)); /* bring the link up now */
  87. void link_terminated __P((int)); /* we are finished with the link */
  88. void link_down __P((int)); /* the LCP layer has left the Opened state */
  89. void upper_layers_down __P((int));/* take all NCPs down */
  90. Index: ppp-2.4.3/pppd/tty.c
  91. ===================================================================
  92. --- ppp-2.4.3.orig/pppd/tty.c 2007-06-04 13:22:07.960645080 +0200
  93. +++ ppp-2.4.3/pppd/tty.c 2007-06-04 13:22:13.341827016 +0200
  94. @@ -755,14 +755,6 @@
  95. close(pty_master);
  96. pty_master = -1;
  97. }
  98. - if (pty_slave >= 0) {
  99. - close(pty_slave);
  100. - pty_slave = -1;
  101. - }
  102. - if (real_ttyfd >= 0) {
  103. - close(real_ttyfd);
  104. - real_ttyfd = -1;
  105. - }
  106. ttyfd = -1;
  107. if (got_sigterm)
  108. asked_to_quit = 1;
  109. @@ -781,6 +773,7 @@
  110. } else {
  111. info("Serial link disconnected.");
  112. }
  113. + stop_charshunt(NULL, 0);
  114. }
  115. void tty_close_fds()
  116. @@ -944,7 +937,6 @@
  117. exit(0);
  118. }
  119. charshunt_pid = cpid;
  120. - add_notifier(&sigreceived, stop_charshunt, 0);
  121. record_child(cpid, "pppd (charshunt)", charshunt_done, NULL);
  122. return 1;
  123. }