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