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