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