Changeset aee474b in rtems
- Timestamp:
- 10/12/01 13:43:05 (22 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- cedf9296
- Parents:
- ba71076
- Files:
-
- 2 added
- 7 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libnetworking/ChangeLog
rba71076 raee474b 1 2001-10-12 Mike Siers <mikes@poliac.com> 2 3 * Update to stable working state. Congratulations Mike! :) 4 * modem_example: Directory removed. 5 * modem_example/16550.h, modem_example/README, modem_example/modem.c, 6 modem_example/modem.h, modem_example/ppp.c, modem_example/ppp.h, 7 modem_example/pppcompress.c: Files removed. 8 * pppd/example/pppd.options: New file. 9 * pppd/README, pppd/STATUS, pppd/cbcp.c, pppd/cbcp.h, pppd/chat.c, 10 pppd/pppd.h, pppd/rtemsmain.c: Updated. 11 1 12 2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 13 -
c/src/libnetworking/ChangeLog
rba71076 raee474b 1 2001-10-12 Mike Siers <mikes@poliac.com> 2 3 * Update to stable working state. Congratulations Mike! :) 4 * modem_example: Directory removed. 5 * modem_example/16550.h, modem_example/README, modem_example/modem.c, 6 modem_example/modem.h, modem_example/ppp.c, modem_example/ppp.h, 7 modem_example/pppcompress.c: Files removed. 8 * pppd/example/pppd.options: New file. 9 * pppd/README, pppd/STATUS, pppd/cbcp.c, pppd/cbcp.h, pppd/chat.c, 10 pppd/pppd.h, pppd/rtemsmain.c: Updated. 11 1 12 2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 13 -
c/src/libnetworking/pppd/README
rba71076 raee474b 17 17 The port was updated to 2.3.11 by Mike Siers <mikes@poliac.com> 18 18 who added an example test. 19 20 Updated the chat program to return the correct errors and support 21 the ABORT commands. Removed some dead code and did a lot of 22 testing on a new Coldfire BSP. Version seems to be very stable. 19 23 ================================================================= 20 24 -
c/src/libnetworking/pppd/STATUS
rba71076 raee474b 3 3 # 4 4 5 The pppd application seems to very stable. It has been tested using 6 the example application with the i386/pc586 and m68k/sbc5206e BSPs. 7 The tests were executed using a null modem serial cable to connect 8 with a UNIX box running either the ppp or pppd application and with 9 an external modem to dial up a local ISP. 5 10 6 Notes from Mike Siers <mikes@poliac.com> 7 ======================================== 11 If you have problems getting your target to make consistent connections 12 with an ISP, the problem is most likely with the ppp options. First 13 try using the "novj" and "noaccomp" options. If you have questions 14 about what other option values are available for the rtems_pppd_set_option 15 function, please look at the pppd.8 man page file or the the source code. 16 The majority of options that are documented in man page should work 17 with this function call. 8 18 9 I know that several users have tried out this version of 10 pppd under RTEMS. It has been successfully used as both 11 a client and server. Below are the only issues that I 12 know of. 19 The pppd application requires the BSP termios driver support task 20 driven I/O. Below is a list of known issues that need to be resolved: 13 21 14 1) Large packet ping causes RTEMS box to lock up 15 If you ping the RTEMS box over the ppp link with a packet 16 size greater than 1500, the RTEMS box locks up. I think 17 the problem is in the pppd ethernet driver. 22 - pppd locks up when it receives large packet pings (> 1500 bytes) 23 - pppd occasionaly locks up with mbuf allocation error 24 (problem is rare and may be BSP related) 18 25 19 2) Upgrade the libnetworking/modem files 20 This upgrade did not modify the ppp ethernet driver files 21 in the libnetworking/modem directory. Would like to 22 upgrade these files. Hopefully, it will fix the large 23 packet ping problem. 26 If you find any other problems or fix some problems, please post your 27 changes to the RTEMS mailing list. 24 28 25 3) The files cbcp.c and cbcp.h provide a callback feature 26 that I have not tried to compile or use. The files in 27 this directory are identical to the 2.3.11 versions. 28 for completeness. 29 30 31 JOEL: Are the modifications to the original pppd such that the 32 real maintainers will accept them? 33 34 No. The pppd 2.3.11 branch is an old branch. The current 35 version is 2.4.x and it contains alot of extra items that 36 just did not make sense to have in an embedded environment. 37 I could make the RTEMS changes compatible with the standard 38 2.3.11 release by using compilation flags. I have not 39 contacted the maintainers to see if they are interested. 40 29 Good Luck -
c/src/libnetworking/pppd/cbcp.c
rba71076 raee474b 1 /* 2 * cbcp - Call Back Configuration Protocol. 3 * 4 * Copyright (c) 1995 Pedro Roque Marques 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms are permitted 8 * provided that the above copyright notice and this paragraph are 9 * duplicated in all such forms and that any documentation, 10 * advertising materials, and other materials related to such 11 * distribution and use acknowledge that the software was developed 12 * by Pedro Roque Marques. The name of the author may not be used to 13 * endorse or promote products derived from this software without 14 * specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 */ 20 21 #define RCSID "$Id$" 22 23 #include <stdio.h> 24 #include <string.h> 25 #include <sys/types.h> 26 #include <sys/time.h> 27 28 #include "pppd.h" 29 #include "cbcp.h" 30 #include "fsm.h" 31 #include "lcp.h" 32 33 static const char rcsid[] = RCSID; 34 35 /* 36 * Options. 37 */ 38 static int setcbcp __P((char **)); 39 40 static option_t cbcp_option_list[] = { 41 { "callback", o_special, setcbcp, 42 "Ask for callback" }, 43 { NULL } 44 }; 45 46 /* 47 * Protocol entry points. 48 */ 49 static void cbcp_init __P((int unit)); 50 static void cbcp_open __P((int unit)); 51 static void cbcp_lowerup __P((int unit)); 52 static void cbcp_input __P((int unit, u_char *pkt, int len)); 53 static void cbcp_protrej __P((int unit)); 54 static int cbcp_printpkt __P((u_char *pkt, int len, 55 void (*printer) __P((void *, char *, ...)), 56 void *arg)); 57 58 struct protent cbcp_protent = { 59 PPP_CBCP, 60 cbcp_init, 61 cbcp_input, 62 cbcp_protrej, 63 cbcp_lowerup, 64 NULL, 65 cbcp_open, 66 NULL, 67 cbcp_printpkt, 68 NULL, 69 0, 70 "CBCP", 71 NULL, 72 cbcp_option_list, 73 NULL, 74 NULL, 75 NULL 76 }; 77 78 cbcp_state cbcp[NUM_PPP]; 79 80 /* internal prototypes */ 81 82 static void cbcp_recvreq __P((cbcp_state *us, char *pckt, int len)); 83 static void cbcp_resp __P((cbcp_state *us)); 84 static void cbcp_up __P((cbcp_state *us)); 85 static void cbcp_recvack __P((cbcp_state *us, char *pckt, int len)); 86 static void cbcp_send __P((cbcp_state *us, u_char code, u_char *buf, int len)); 87 88 /* option processing */ 89 static int 90 setcbcp(argv) 91 char **argv; 92 { 93 lcp_wantoptions[0].neg_cbcp = 1; 94 cbcp_protent.enabled_flag = 1; 95 cbcp[0].us_number = strdup(*argv); 96 if (cbcp[0].us_number == 0) 97 novm("callback number"); 98 cbcp[0].us_type |= (1 << CB_CONF_USER); 99 cbcp[0].us_type |= (1 << CB_CONF_ADMIN); 100 return (1); 101 } 102 103 /* init state */ 104 static void 105 cbcp_init(iface) 106 int iface; 107 { 108 cbcp_state *us; 109 110 us = &cbcp[iface]; 111 memset(us, 0, sizeof(cbcp_state)); 112 us->us_unit = iface; 113 us->us_type |= (1 << CB_CONF_NO); 114 } 115 116 /* lower layer is up */ 117 static void 118 cbcp_lowerup(iface) 119 int iface; 120 { 121 cbcp_state *us = &cbcp[iface]; 122 123 dbglog("cbcp_lowerup"); 124 dbglog("want: %d", us->us_type); 125 126 if (us->us_type == CB_CONF_USER) 127 dbglog("phone no: %s", us->us_number); 128 } 129 130 static void 131 cbcp_open(unit) 132 int unit; 133 { 134 dbglog("cbcp_open"); 135 } 136 137 /* process an incomming packet */ 138 static void 139 cbcp_input(unit, inpacket, pktlen) 140 int unit; 141 u_char *inpacket; 142 int pktlen; 143 { 144 u_char *inp; 145 u_char code, id; 146 u_short len; 147 148 cbcp_state *us = &cbcp[unit]; 149 150 inp = inpacket; 151 152 if (pktlen < CBCP_MINLEN) { 153 error("CBCP packet is too small"); 154 return; 155 } 156 157 GETCHAR(code, inp); 158 GETCHAR(id, inp); 159 GETSHORT(len, inp); 160 161 #if 0 162 if (len > pktlen) { 163 error("CBCP packet: invalid length"); 164 return; 165 } 166 #endif 167 168 len -= CBCP_MINLEN; 169 170 switch(code) { 171 case CBCP_REQ: 172 us->us_id = id; 173 cbcp_recvreq(us, inp, len); 174 break; 175 176 case CBCP_RESP: 177 dbglog("CBCP_RESP received"); 178 break; 179 180 case CBCP_ACK: 181 if (id != us->us_id) 182 dbglog("id doesn't match: expected %d recv %d", 183 us->us_id, id); 184 185 cbcp_recvack(us, inp, len); 186 break; 187 188 default: 189 break; 190 } 191 } 192 193 /* protocol was rejected by foe */ 194 void cbcp_protrej(int iface) 195 { 196 } 197 198 char *cbcp_codenames[] = { 199 "Request", "Response", "Ack" 200 }; 201 202 char *cbcp_optionnames[] = { 203 "NoCallback", 204 "UserDefined", 205 "AdminDefined", 206 "List" 207 }; 208 209 /* pretty print a packet */ 210 static int 211 cbcp_printpkt(p, plen, printer, arg) 212 u_char *p; 213 int plen; 214 void (*printer) __P((void *, char *, ...)); 215 void *arg; 216 { 217 int code, opt, id, len, olen, delay; 218 u_char *pstart; 219 220 if (plen < HEADERLEN) 221 return 0; 222 pstart = p; 223 GETCHAR(code, p); 224 GETCHAR(id, p); 225 GETSHORT(len, p); 226 if (len < HEADERLEN || len > plen) 227 return 0; 228 229 if (code >= 1 && code <= sizeof(cbcp_codenames) / sizeof(char *)) 230 printer(arg, " %s", cbcp_codenames[code-1]); 231 else 232 printer(arg, " code=0x%x", code); 233 234 printer(arg, " id=0x%x", id); 235 len -= HEADERLEN; 236 237 switch (code) { 238 case CBCP_REQ: 239 case CBCP_RESP: 240 case CBCP_ACK: 241 while(len >= 2) { 242 GETCHAR(opt, p); 243 GETCHAR(olen, p); 244 245 if (olen < 2 || olen > len) { 246 break; 247 } 248 249 printer(arg, " <"); 250 len -= olen; 251 252 if (opt >= 1 && opt <= sizeof(cbcp_optionnames) / sizeof(char *)) 253 printer(arg, " %s", cbcp_optionnames[opt-1]); 254 else 255 printer(arg, " option=0x%x", opt); 256 257 if (olen > 2) { 258 GETCHAR(delay, p); 259 printer(arg, " delay = %d", delay); 260 } 261 262 if (olen > 3) { 263 int addrt; 264 char str[256]; 265 266 GETCHAR(addrt, p); 267 memcpy(str, p, olen - 4); 268 str[olen - 4] = 0; 269 printer(arg, " number = %s", str); 270 } 271 printer(arg, ">"); 272 break; 273 } 274 275 default: 276 break; 277 } 278 279 for (; len > 0; --len) { 280 GETCHAR(code, p); 281 printer(arg, " %.2x", code); 282 } 283 284 return p - pstart; 285 } 286 287 /* received CBCP request */ 288 static void 289 cbcp_recvreq(us, pckt, pcktlen) 290 cbcp_state *us; 291 char *pckt; 292 int pcktlen; 293 { 294 u_char type, opt_len, delay, addr_type; 295 char address[256]; 296 int len = pcktlen; 297 298 address[0] = 0; 299 300 while (len) { 301 dbglog("length: %d", len); 302 303 GETCHAR(type, pckt); 304 GETCHAR(opt_len, pckt); 305 306 if (opt_len > 2) 307 GETCHAR(delay, pckt); 308 309 us->us_allowed |= (1 << type); 310 311 switch(type) { 312 case CB_CONF_NO: 313 dbglog("no callback allowed"); 314 break; 315 316 case CB_CONF_USER: 317 dbglog("user callback allowed"); 318 if (opt_len > 4) { 319 GETCHAR(addr_type, pckt); 320 memcpy(address, pckt, opt_len - 4); 321 address[opt_len - 4] = 0; 322 if (address[0]) 323 dbglog("address: %s", address); 324 } 325 break; 326 327 case CB_CONF_ADMIN: 328 dbglog("user admin defined allowed"); 329 break; 330 331 case CB_CONF_LIST: 332 break; 333 } 334 len -= opt_len; 335 } 336 337 cbcp_resp(us); 338 } 339 340 static void 341 cbcp_resp(us) 342 cbcp_state *us; 343 { 344 u_char cb_type; 345 u_char buf[256]; 346 u_char *bufp = buf; 347 int len = 0; 348 349 cb_type = us->us_allowed & us->us_type; 350 dbglog("cbcp_resp cb_type=%d", cb_type); 351 352 #if 0 353 if (!cb_type) 354 lcp_down(us->us_unit); 355 #endif 356 357 if (cb_type & ( 1 << CB_CONF_USER ) ) { 358 dbglog("cbcp_resp CONF_USER"); 359 PUTCHAR(CB_CONF_USER, bufp); 360 len = 3 + 1 + strlen(us->us_number) + 1; 361 PUTCHAR(len , bufp); 362 PUTCHAR(5, bufp); /* delay */ 363 PUTCHAR(1, bufp); 364 BCOPY(us->us_number, bufp, strlen(us->us_number) + 1); 365 cbcp_send(us, CBCP_RESP, buf, len); 366 return; 367 } 368 369 if (cb_type & ( 1 << CB_CONF_ADMIN ) ) { 370 dbglog("cbcp_resp CONF_ADMIN"); 371 PUTCHAR(CB_CONF_ADMIN, bufp); 372 len = 3; 373 PUTCHAR(len, bufp); 374 PUTCHAR(5, bufp); /* delay */ 375 cbcp_send(us, CBCP_RESP, buf, len); 376 return; 377 } 378 379 if (cb_type & ( 1 << CB_CONF_NO ) ) { 380 dbglog("cbcp_resp CONF_NO"); 381 PUTCHAR(CB_CONF_NO, bufp); 382 len = 3; 383 PUTCHAR(len , bufp); 384 PUTCHAR(0, bufp); 385 cbcp_send(us, CBCP_RESP, buf, len); 386 start_networks(); 387 return; 388 } 389 } 390 391 static void 392 cbcp_send(us, code, buf, len) 393 cbcp_state *us; 394 u_char code; 395 u_char *buf; 396 int len; 397 { 398 u_char *outp; 399 int outlen; 400 401 outp = outpacket_buf; 402 403 outlen = 4 + len; 404 405 MAKEHEADER(outp, PPP_CBCP); 406 407 PUTCHAR(code, outp); 408 PUTCHAR(us->us_id, outp); 409 PUTSHORT(outlen, outp); 410 411 if (len) 412 BCOPY(buf, outp, len); 413 414 output(us->us_unit, outpacket_buf, outlen + PPP_HDRLEN); 415 } 416 417 static void 418 cbcp_recvack(us, pckt, len) 419 cbcp_state *us; 420 char *pckt; 421 int len; 422 { 423 u_char type, delay, addr_type; 424 int opt_len; 425 char address[256]; 426 427 if (len) { 428 GETCHAR(type, pckt); 429 GETCHAR(opt_len, pckt); 430 431 if (opt_len > 2) 432 GETCHAR(delay, pckt); 433 434 if (opt_len > 4) { 435 GETCHAR(addr_type, pckt); 436 memcpy(address, pckt, opt_len - 4); 437 address[opt_len - 4] = 0; 438 if (address[0]) 439 dbglog("peer will call: %s", address); 440 } 441 if (type == CB_CONF_NO) 442 return; 443 } 444 445 cbcp_up(us); 446 } 447 448 /* ok peer will do callback */ 449 static void 450 cbcp_up(us) 451 cbcp_state *us; 452 { 453 persist = 0; 454 lcp_close(0, "Call me back, please"); 455 status = EXIT_CALLBACK; 456 } -
c/src/libnetworking/pppd/cbcp.h
rba71076 raee474b 1 #ifndef CBCP_H 2 #define CBCP_H 3 4 typedef struct cbcp_state { 5 int us_unit; /* Interface unit number */ 6 u_char us_id; /* Current id */ 7 u_char us_allowed; 8 int us_type; 9 char *us_number; /* Telefone Number */ 10 } cbcp_state; 11 12 extern cbcp_state cbcp[]; 13 14 extern struct protent cbcp_protent; 15 16 #define CBCP_MINLEN 4 17 18 #define CBCP_REQ 1 19 #define CBCP_RESP 2 20 #define CBCP_ACK 3 21 22 #define CB_CONF_NO 1 23 #define CB_CONF_USER 2 24 #define CB_CONF_ADMIN 3 25 #define CB_CONF_LIST 4 26 #endif -
c/src/libnetworking/pppd/chat.c
rba71076 raee474b 15 15 * 16 16 * ----------------- 17 * 22-May-99 added environment substitutuion, enabled with -E switch. 18 * Andreas Arens <andras@cityweb.de>. 19 * 20 * 12-May-99 added a feature to read data to be sent from a file, 21 * if the send string starts with @. Idea from gpk <gpk@onramp.net>. 22 * 17 23 * added -T and -U option and \T and \U substitution to pass a phone 18 24 * number into chat script. Two are needed for some ISDN TA applications. … … 75 81 * (614)451-1883 76 82 * 77 * 78 */ 79 80 #ifndef lint 81 /* static char rcsid[] = ""; */ 82 #endif 83 */ 83 84 84 85 #include <stdio.h> … … 86 87 #include <time.h> 87 88 #include <fcntl.h> 88 #include <signal.h>89 89 #include <errno.h> 90 90 #include <string.h> … … 94 94 #include <sys/stat.h> 95 95 #include <syslog.h> 96 #include <termios.h> 97 #include "pppd.h" 96 98 97 99 #undef TERMIOS 98 100 #define TERMIOS 99 101 100 101 #include <termios.h>102 102 103 103 #define STR_LEN 1024 … … 143 143 char *program_name; 144 144 145 #define MAX_ABORTS 5146 #define MAX_REPORTS 5145 #define MAX_ABORTS 16 146 #define MAX_REPORTS 16 147 147 #define DEFAULT_CHAT_TIMEOUT 45 148 #define fcntl(a, b,c ) 0 149 #define MAX_TIMEOUTS 10 150 151 int echo = 0; 152 int verbose = 0; 153 int to_log = 1; 154 int to_stderr = 0; 155 int Verbose = 0; 156 int quiet = 0; 157 int report = 0; 158 int exit_code = 0; 159 char *report_file = (char *) 0; 160 char *chat_file = (char *) 0; 161 char *phone_num = (char *) 0; 162 char *phone_num2 = (char *) 0; 163 int chat_timeout = DEFAULT_CHAT_TIMEOUT; 164 static int timeout = DEFAULT_CHAT_TIMEOUT; 165 int have_tty_parameters = 0; 148 #define MAX_TIMEOUTS 10 149 150 int echo = 0; 151 int quiet = 0; 152 int report = 0; 153 int use_env = 0; 154 int exit_code = 0; 155 char *report_file = (char *) 0; 156 char *chat_file = (char *) 0; 157 char *phone_num = (char *) 0; 158 char *phone_num2 = (char *) 0; 159 static int timeout = DEFAULT_CHAT_TIMEOUT; 166 160 167 161 #ifdef TERMIOS 168 162 #define term_parms struct termios 169 #define get_term_param(param) tcgetattr( ttyfd, param)170 #define set_term_param(param) tcsetattr( ttyfd, TCSANOW, param)163 #define get_term_param(param) tcgetattr(0, param) 164 #define set_term_param(param) tcsetattr(0, TCSANOW, param) 171 165 struct termios saved_tty_parameters; 172 166 #endif 173 167 174 char *abort_string[MAX_ABORTS]={"BUSY","NO DIALTONE","NO CARRIER","NO ASWER","RINGING\r\n\r\nRINGING"}; 175 char *fail_reason = (char *)0, 176 fail_buffer[50]; 177 int n_aborts = MAX_ABORTS, abort_next = 0, timeout_next = 0, echo_next = 0; 168 char *fail_reason = (char *)0; 169 char fail_buffer[50]; 170 char *abort_string[MAX_ABORTS]={"BUSY","NO DIALTONE","NO CARRIER","NO ANSWER","RING\r\nRING"}; 171 int n_aborts = 5; 172 int abort_next = 0, timeout_next = 0, echo_next = 0; 178 173 int clear_abort_next = 0; 179 174 … … 187 182 void *dup_mem __P((void *b, size_t c)); 188 183 void *copy_of __P((char *s)); 189 /*190 SIGTYPE sigalrm __P((int signo));191 SIGTYPE sigint __P((int signo));192 SIGTYPE sigterm __P((int signo));193 SIGTYPE sighup __P((int signo));194 */195 void unalarm __P((void));196 void init __P((void));197 void set_tty_parameters __P((void));198 void echo_stderr __P((int));199 184 void break_sequence __P((void)); 200 void terminate __P((int status));201 void do_file __P((char *chat_file));202 185 int get_string __P((register char *string)); 203 186 int put_string __P((register char *s)); … … 209 192 void chat_expect __P((register char *s)); 210 193 char *clean __P((register char *s, int sending)); 211 void break_sequence __P((void));212 void terminate __P((int status));213 void pack_array __P((char **array, int end));214 194 char *expect_strtok __P((char *, char *)); 215 int vfmtmsg __P((char *, int, const char *, va_list)); /* vsprintf++ */ 216 217 #if 0 218 int usleep( long usec ); /* returns 0 if ok, else -1 */ 219 #endif 220 221 extern int input_fd,output_fd; 222 223 int main __P((int, char *[])); 195 int chatmain __P((char *)); 196 224 197 225 198 void *dup_mem(b, c) … … 229 202 void *ans = malloc (c); 230 203 if (!ans) 231 232 233 memcpy 204 return NULL; 205 206 memcpy(ans, b, c); 234 207 return ans; 235 208 } … … 238 211 char *s; 239 212 { 240 return dup_mem (s, strlen (s) + 1); 241 } 242 243 /* 244 * chat [ -v ] [-T number] [-U number] [ -t timeout ] [ -f chat-file ] \ 245 * [ -r report-file ] \ 246 * [...[[expect[-say[-expect...]] say expect[-say[-expect]] ...]]] 247 * 248 * Perform a UUCP-dialer-like chat script on stdin and stdout. 249 */ 213 return dup_mem(s, strlen (s) + 1); 214 } 215 250 216 char *getnextcommand(char **string) 251 217 { 252 218 char *buf=*string,*res; 253 res=strchr(buf,' @');219 res=strchr(buf,'|'); 254 220 if (res==NULL) 255 221 return NULL; … … 259 225 } 260 226 261 262 extern int ttyfd;263 227 int chatmain(argv) 264 228 char *argv; … … 269 233 exit_code = 0; 270 234 271 printf("chat_main: %s\n", argv); 235 if ( debug ) { 236 dbglog("chat_main: %s\n", argv); 237 } 272 238 273 239 /* get first expect string */ 274 240 arg = getnextcommand(&argv); 275 while ( arg != NULL) {241 while (( arg != NULL ) && ( exit_code == 0 )) { 276 242 /* process the expect string */ 277 243 chat_expect(arg); 278 279 /* get the next send string */ 280 arg = getnextcommand(&argv); 281 if ( arg != NULL ) { 282 /* process the send string */ 283 chat_send(arg); 284 285 /* get the next expect string */ 244 if ( exit_code == 0 ) { 245 /* get the next send string */ 286 246 arg = getnextcommand(&argv); 247 if ( arg != NULL ) { 248 /* process the send string */ 249 chat_send(arg); 250 251 /* get the next expect string */ 252 arg = getnextcommand(&argv); 253 } 287 254 } 288 255 } 289 256 290 return 0; 291 } 292 293 294 295 /* 296 * Print an error message and terminate. 297 */ 298 299 void init() 300 { 301 set_tty_parameters(); 302 } 303 304 void set_tty_parameters() 305 { 306 term_parms t; 307 308 if (get_term_param (&t) < 0) 309 syslog(LOG_NOTICE,"Can't get terminal parameters:") 310 ; 311 312 saved_tty_parameters = t; 313 have_tty_parameters = 1; 314 t.c_iflag |= IGNBRK | ISTRIP | IGNPAR; 315 t.c_oflag = 0; 316 t.c_lflag = 0; 317 t.c_cc[VERASE] = 318 t.c_cc[VKILL] = 0; 319 t.c_cc[VMIN] = 0; 320 t.c_cc[VTIME] = 1; 321 if (set_term_param (&t) < 0) 322 syslog(LOG_NOTICE,"Can't set terminal parameters:") 323 ; 257 if ( exit_code ) { 258 exit_code = -exit_code; 259 } 260 261 return ( exit_code ); 324 262 } 325 263 326 264 void break_sequence() 327 265 { 328 329 /* tcsendbreak (0, 0);*/ 330 } 331 332 /*void terminate(status) 333 int status; 334 { 335 echo_stderr(-1); 336 337 if (have_tty_parameters) { 338 if (set_term_param (&saved_tty_parameters) < 0) 339 fatal(2, "Can't restore terminal parameters: %m"); 340 } 341 } 342 */ 266 tcsendbreak(ttyfd, 0); 267 } 268 343 269 /* 344 270 * 'Clean up' this string. … … 348 274 int sending; /* set to 1 when sending (putting) this string. */ 349 275 { 350 char temp[STR_LEN], cur_chr;276 char temp[STR_LEN], env_str[STR_LEN], cur_chr; 351 277 register char *s1, *phchar; 352 278 int add_return = sending; 353 #define isoctal(chr) (((chr) >= '0') && ((chr) <= '7')) 279 #define isoctal(chr) (((chr) >= '0') && ((chr) <= '7')) 280 #define isalnumx(chr) ((((chr) >= '0') && ((chr) <= '9')) \ 281 || (((chr) >= 'a') && ((chr) <= 'z')) \ 282 || (((chr) >= 'A') && ((chr) <= 'Z')) \ 283 || (chr) == '_') 354 284 355 285 s1 = temp; … … 368 298 continue; 369 299 } 300 301 if (use_env && cur_chr == '$') { /* ARI */ 302 phchar = env_str; 303 while (isalnumx(*s)) 304 *phchar++ = *s++; 305 *phchar = '\0'; 306 phchar = getenv(env_str); 307 if (phchar) 308 while (*phchar) 309 *s1++ = *phchar++; 310 continue; 311 } 370 312 371 313 if (cur_chr != '\\') { … … 401 343 if (sending) 402 344 *s1++ = '\\'; 403 404 345 *s1++ = cur_chr; 405 346 break; … … 407 348 case 'T': 408 349 if (sending && phone_num) { 409 for ( 350 for (phchar = phone_num; *phchar != '\0'; phchar++) 410 351 *s1++ = *phchar; 411 352 } … … 418 359 case 'U': 419 360 if (sending && phone_num2) { 420 for ( 361 for (phchar = phone_num2; *phchar != '\0'; phchar++) 421 362 *s1++ = *phchar; 422 363 } … … 456 397 break; 457 398 399 case '$': /* ARI */ 400 if (use_env) { 401 *s1++ = cur_chr; 402 break; 403 } 404 /* FALL THROUGH */ 405 458 406 default: 459 407 if (isoctal (cur_chr)) { … … 494 442 * A modified version of 'strtok'. This version skips \ sequences. 495 443 */ 496 497 444 char *expect_strtok (s, term) 498 445 char *s, *term; … … 549 496 * Process the expect string 550 497 */ 551 552 void chat_expect (s) 498 void chat_expect (s) 553 499 char *s; 554 500 { … … 558 504 if (strcmp(s, "HANGUP") == 0) { 559 505 ++hup_next; 560 return 506 return; 561 507 } 562 508 563 509 if (strcmp(s, "ABORT") == 0) { 564 510 ++abort_next; 565 return 511 return; 566 512 } 567 513 568 514 if (strcmp(s, "CLR_ABORT") == 0) { 569 515 ++clear_abort_next; 570 return 516 return; 571 517 } 572 518 573 519 if (strcmp(s, "REPORT") == 0) { 574 520 ++report_next; 575 return 521 return; 576 522 } 577 523 578 524 if (strcmp(s, "CLR_REPORT") == 0) { 579 525 ++clear_report_next; 580 return 526 return; 581 527 } 582 528 583 529 if (strcmp(s, "TIMEOUT") == 0) { 584 530 ++timeout_next; 585 return 531 return; 586 532 } 587 533 588 534 if (strcmp(s, "ECHO") == 0) { 589 535 ++echo_next; 590 return 536 return; 591 537 } 592 538 593 539 if (strcmp(s, "SAY") == 0) { 594 540 ++say_next; 595 return 541 return; 596 542 } 597 543 … … 601 547 for (;;) { 602 548 expect = expect_strtok (s, "-"); 603 s = (char *) 0;549 s = (char *) 0; 604 550 605 551 if (expect == (char *) 0) 606 return 552 return; 607 553 608 554 reply = expect_strtok (s, "-"); … … 623 569 chat_send (reply); 624 570 } 625 626 /* 627 * The expectation did not occur. This is terminal. 628 */ 629 return ; 571 } 572 573 /* 574 * Translate the input character to the appropriate string for printing 575 * the data. 576 */ 577 578 char *character(c) 579 int c; 580 { 581 static char string[10]; 582 char *meta; 583 584 meta = (c & 0x80) ? "M-" : ""; 585 c &= 0x7F; 586 587 if (c < 32) 588 sprintf(string, "%s^%c", meta, (int)c + '@'); 589 else if (c == 127) 590 sprintf(string, "%s^?", meta); 591 else 592 sprintf(string, "%s%c", meta, c); 593 594 return (string); 630 595 } 631 596 … … 636 601 register char *s; 637 602 { 603 char file_data[STR_LEN]; 604 638 605 if (say_next) { 639 606 say_next = 0; 640 s = clean(s, 0);641 write( ttyfd, s, strlen(s));607 s = clean(s, 1); 608 write(2, s, strlen(s)); 642 609 free(s); 643 610 return; … … 646 613 if (hup_next) { 647 614 hup_next = 0; 615 return; 648 616 } 649 617 … … 655 623 656 624 if (abort_next) { 657 /* char *s1; */625 char *s1; 658 626 627 abort_next = 0; 628 if ( n_aborts < MAX_ABORTS ) { 629 s1 = clean(s, 0); 630 if (( strlen(s1) <= strlen(s) ) && 631 ( strlen(s1) < sizeof(fail_buffer))) { 632 633 abort_string[n_aborts++] = s1; 634 } 635 } 636 return; 637 } 638 639 if (clear_abort_next) { 640 clear_abort_next = 0; 641 return; 642 } 643 644 if (report_next) { 645 report_next = 0; 646 return; 647 } 648 649 if (clear_report_next) { 650 clear_report_next = 0; 651 return; 652 } 653 654 if (timeout_next) { 655 timeout_next = 0; 656 timeout = atoi(s); 659 657 660 ; 661 662 663 return; 664 } 665 666 if (timeout_next) { 667 timeout=atoi(s); 668 timeout_next = 0; 669 chat_timeout = atoi(s); 670 671 if (chat_timeout <= 0) 672 chat_timeout = DEFAULT_CHAT_TIMEOUT; 673 674 675 return; 676 } 658 if (timeout <= 0) 659 timeout = DEFAULT_CHAT_TIMEOUT; 660 661 return; 662 } 663 677 664 if (strcmp(s, "EOT") == 0) 678 665 s = "^D\\c"; … … 680 667 s = "\\K\\c"; 681 668 682 if (!put_string(s)) 683 { 684 exit_code=1; 685 return; 686 } 669 if (!put_string(s)) { 670 exit_code = 2; 671 } 687 672 } 688 673 … … 709 694 int c; 710 695 { 711 int status; 712 char ch = c; 713 714 /* inter-character typing delay (?) */ 715 716 status = write(ttyfd, &ch, 1); 717 718 switch (status) { 719 case 1: 720 return (0); 721 722 default: 723 724 725 } 696 char ch = c; 697 698 write(ttyfd, &ch, 1); 699 726 700 return 0; 727 701 } … … 775 749 } 776 750 777 /* alarm(0);*/778 751 return (1); 779 752 } 780 753 781 754 /* 782 * Echo a character to stderr.783 * When called with -1, a '\n' character is generated when784 * the cursor is not at the beginning of a line.785 */786 void echo_stderr(n)787 int n;788 {789 /* static int need_lf;790 char *s;791 792 switch (n) {793 case '\r':794 break;795 case -1:796 if (need_lf == 0)797 break;798 799 case '\n':800 write(2, "\n", 1);801 need_lf = 0;802 break;803 default:804 s = character(n);805 write(2, s, strlen(s));806 need_lf = 1;807 break;808 }*/809 }810 811 /*812 755 * 'Wait for' this string to appear on this file descriptor. 813 756 */ 814 815 757 int get_string(string) 816 758 register char *string; … … 820 762 char *logged = temp2; 821 763 struct termios tios; 764 765 memset(temp2, 0, sizeof(temp2)); 822 766 823 767 tcgetattr(ttyfd, &tios); … … 839 783 } 840 784 841 842 785 while ( (c = get_char()) >= 0) { 843 786 int n, abort_len; … … 845 788 *s++ = c; 846 789 *s=0; 847 790 848 791 if (s - temp2 >= len && 849 792 c == string[len - 1] && … … 872 815 } 873 816 } 817 874 818 exit_code = 3; 875 819 return (0); 876 820 } 877 878 /*879 * Gross kludge to handle Solaris versions >= 2.6 having usleep.880 */881 882 /*883 usleep -- support routine for 4.2BSD system call emulations884 last edit: 29-Oct-1984 D A Gwyn885 */886 887 888 #if 0889 int890 usleep( usec ) /* returns 0 if ok, else -1 */891 long usec; /* delay in microseconds */892 {893 rtems_status_code status;894 rtems_interval ticks_per_second;895 rtems_interval ticks;896 status = rtems_clock_get(897 RTEMS_CLOCK_GET_TICKS_PER_SECOND,898 &ticks_per_second);899 ticks = (usec * (ticks_per_second/1000))/1000;900 status = rtems_task_wake_after( ticks );901 return 0;902 }903 #endif904 905 void pack_array (array, end)906 char **array; /* The address of the array of string pointers */907 int end; /* The index of the next free entry before CLR_ */908 {909 int i, j;910 911 for (i = 0; i < end; i++) {912 if (array[i] == NULL) {913 for (j = i+1; j < end; ++j)914 if (array[j] != NULL)915 array[i++] = array[j];916 for (; i < end; ++i)917 array[i] = NULL;918 break;919 }920 }921 }922 923 /*924 * vfmtmsg - format a message into a buffer. Like vsprintf except we925 * also specify the length of the output buffer, and we handle the926 * %m (error message) format.927 * Doesn't do floating-point formats.928 * Returns the number of chars put into buf.929 */930 #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) -
c/src/libnetworking/pppd/example/README
rba71076 raee474b 7 7 be renamed to Makefile or the -f option given to make. The file 8 8 is renamed to avoid bootstrap -c removing it. 9 10 The files ppp.conf and pppd.options are sample configuration files 11 that have successfully used to make ppp connections over a null 12 modem serial cable to a UNIX box. Please review the man pages 13 for either the ppp or pppd applications to ensure they are configured 14 correctly. 15 -
c/src/libnetworking/pppd/pppd.h
rba71076 raee474b 590 590 #endif 591 591 #define DEBUGMAIN 1 592 #define DEBUGUPAP 1 593 #define DEBUGCHAP 1 592 594 593 595 -
c/src/libnetworking/pppd/rtemsmain.c
rba71076 raee474b 107 107 int kill_link; 108 108 int open_ccp_flag; 109 110 static int waiting;111 109 112 110 char **script_env; /* Env. variable values for scripts */ … … 234 232 setlogmask(LOG_UPTO(LOG_DEBUG)); 235 233 */ 236 237 waiting = 0;238 234 239 235 do_callback = 0; … … 401 397 new_phase(PHASE_ESTABLISH); 402 398 while (phase != PHASE_DEAD) { 403 waiting = 1;404 399 wait_input(timeleft(&timo)); 405 waiting = 0;406 407 400 calltimeout(); 408 401 get_input(); 402 409 403 if (kill_link) { 410 404 lcp_close(0, "User request"); … … 470 464 TIMEOUT(holdoff_end, NULL, t); 471 465 do { 472 waiting = 1;473 466 wait_input(timeleft(&timo)); 474 waiting = 0;475 467 476 468 calltimeout(); -
cpukit/libnetworking/ChangeLog
rba71076 raee474b 1 2001-10-12 Mike Siers <mikes@poliac.com> 2 3 * Update to stable working state. Congratulations Mike! :) 4 * modem_example: Directory removed. 5 * modem_example/16550.h, modem_example/README, modem_example/modem.c, 6 modem_example/modem.h, modem_example/ppp.c, modem_example/ppp.h, 7 modem_example/pppcompress.c: Files removed. 8 * pppd/example/pppd.options: New file. 9 * pppd/README, pppd/STATUS, pppd/cbcp.c, pppd/cbcp.h, pppd/chat.c, 10 pppd/pppd.h, pppd/rtemsmain.c: Updated. 11 1 12 2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 13 -
cpukit/pppd/README
rba71076 raee474b 17 17 The port was updated to 2.3.11 by Mike Siers <mikes@poliac.com> 18 18 who added an example test. 19 20 Updated the chat program to return the correct errors and support 21 the ABORT commands. Removed some dead code and did a lot of 22 testing on a new Coldfire BSP. Version seems to be very stable. 19 23 ================================================================= 20 24 -
cpukit/pppd/STATUS
rba71076 raee474b 3 3 # 4 4 5 The pppd application seems to very stable. It has been tested using 6 the example application with the i386/pc586 and m68k/sbc5206e BSPs. 7 The tests were executed using a null modem serial cable to connect 8 with a UNIX box running either the ppp or pppd application and with 9 an external modem to dial up a local ISP. 5 10 6 Notes from Mike Siers <mikes@poliac.com> 7 ======================================== 11 If you have problems getting your target to make consistent connections 12 with an ISP, the problem is most likely with the ppp options. First 13 try using the "novj" and "noaccomp" options. If you have questions 14 about what other option values are available for the rtems_pppd_set_option 15 function, please look at the pppd.8 man page file or the the source code. 16 The majority of options that are documented in man page should work 17 with this function call. 8 18 9 I know that several users have tried out this version of 10 pppd under RTEMS. It has been successfully used as both 11 a client and server. Below are the only issues that I 12 know of. 19 The pppd application requires the BSP termios driver support task 20 driven I/O. Below is a list of known issues that need to be resolved: 13 21 14 1) Large packet ping causes RTEMS box to lock up 15 If you ping the RTEMS box over the ppp link with a packet 16 size greater than 1500, the RTEMS box locks up. I think 17 the problem is in the pppd ethernet driver. 22 - pppd locks up when it receives large packet pings (> 1500 bytes) 23 - pppd occasionaly locks up with mbuf allocation error 24 (problem is rare and may be BSP related) 18 25 19 2) Upgrade the libnetworking/modem files 20 This upgrade did not modify the ppp ethernet driver files 21 in the libnetworking/modem directory. Would like to 22 upgrade these files. Hopefully, it will fix the large 23 packet ping problem. 26 If you find any other problems or fix some problems, please post your 27 changes to the RTEMS mailing list. 24 28 25 3) The files cbcp.c and cbcp.h provide a callback feature 26 that I have not tried to compile or use. The files in 27 this directory are identical to the 2.3.11 versions. 28 for completeness. 29 30 31 JOEL: Are the modifications to the original pppd such that the 32 real maintainers will accept them? 33 34 No. The pppd 2.3.11 branch is an old branch. The current 35 version is 2.4.x and it contains alot of extra items that 36 just did not make sense to have in an embedded environment. 37 I could make the RTEMS changes compatible with the standard 38 2.3.11 release by using compilation flags. I have not 39 contacted the maintainers to see if they are interested. 40 29 Good Luck -
cpukit/pppd/cbcp.c
rba71076 raee474b 1 /* 2 * cbcp - Call Back Configuration Protocol. 3 * 4 * Copyright (c) 1995 Pedro Roque Marques 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms are permitted 8 * provided that the above copyright notice and this paragraph are 9 * duplicated in all such forms and that any documentation, 10 * advertising materials, and other materials related to such 11 * distribution and use acknowledge that the software was developed 12 * by Pedro Roque Marques. The name of the author may not be used to 13 * endorse or promote products derived from this software without 14 * specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 */ 20 21 #define RCSID "$Id$" 22 23 #include <stdio.h> 24 #include <string.h> 25 #include <sys/types.h> 26 #include <sys/time.h> 27 28 #include "pppd.h" 29 #include "cbcp.h" 30 #include "fsm.h" 31 #include "lcp.h" 32 33 static const char rcsid[] = RCSID; 34 35 /* 36 * Options. 37 */ 38 static int setcbcp __P((char **)); 39 40 static option_t cbcp_option_list[] = { 41 { "callback", o_special, setcbcp, 42 "Ask for callback" }, 43 { NULL } 44 }; 45 46 /* 47 * Protocol entry points. 48 */ 49 static void cbcp_init __P((int unit)); 50 static void cbcp_open __P((int unit)); 51 static void cbcp_lowerup __P((int unit)); 52 static void cbcp_input __P((int unit, u_char *pkt, int len)); 53 static void cbcp_protrej __P((int unit)); 54 static int cbcp_printpkt __P((u_char *pkt, int len, 55 void (*printer) __P((void *, char *, ...)), 56 void *arg)); 57 58 struct protent cbcp_protent = { 59 PPP_CBCP, 60 cbcp_init, 61 cbcp_input, 62 cbcp_protrej, 63 cbcp_lowerup, 64 NULL, 65 cbcp_open, 66 NULL, 67 cbcp_printpkt, 68 NULL, 69 0, 70 "CBCP", 71 NULL, 72 cbcp_option_list, 73 NULL, 74 NULL, 75 NULL 76 }; 77 78 cbcp_state cbcp[NUM_PPP]; 79 80 /* internal prototypes */ 81 82 static void cbcp_recvreq __P((cbcp_state *us, char *pckt, int len)); 83 static void cbcp_resp __P((cbcp_state *us)); 84 static void cbcp_up __P((cbcp_state *us)); 85 static void cbcp_recvack __P((cbcp_state *us, char *pckt, int len)); 86 static void cbcp_send __P((cbcp_state *us, u_char code, u_char *buf, int len)); 87 88 /* option processing */ 89 static int 90 setcbcp(argv) 91 char **argv; 92 { 93 lcp_wantoptions[0].neg_cbcp = 1; 94 cbcp_protent.enabled_flag = 1; 95 cbcp[0].us_number = strdup(*argv); 96 if (cbcp[0].us_number == 0) 97 novm("callback number"); 98 cbcp[0].us_type |= (1 << CB_CONF_USER); 99 cbcp[0].us_type |= (1 << CB_CONF_ADMIN); 100 return (1); 101 } 102 103 /* init state */ 104 static void 105 cbcp_init(iface) 106 int iface; 107 { 108 cbcp_state *us; 109 110 us = &cbcp[iface]; 111 memset(us, 0, sizeof(cbcp_state)); 112 us->us_unit = iface; 113 us->us_type |= (1 << CB_CONF_NO); 114 } 115 116 /* lower layer is up */ 117 static void 118 cbcp_lowerup(iface) 119 int iface; 120 { 121 cbcp_state *us = &cbcp[iface]; 122 123 dbglog("cbcp_lowerup"); 124 dbglog("want: %d", us->us_type); 125 126 if (us->us_type == CB_CONF_USER) 127 dbglog("phone no: %s", us->us_number); 128 } 129 130 static void 131 cbcp_open(unit) 132 int unit; 133 { 134 dbglog("cbcp_open"); 135 } 136 137 /* process an incomming packet */ 138 static void 139 cbcp_input(unit, inpacket, pktlen) 140 int unit; 141 u_char *inpacket; 142 int pktlen; 143 { 144 u_char *inp; 145 u_char code, id; 146 u_short len; 147 148 cbcp_state *us = &cbcp[unit]; 149 150 inp = inpacket; 151 152 if (pktlen < CBCP_MINLEN) { 153 error("CBCP packet is too small"); 154 return; 155 } 156 157 GETCHAR(code, inp); 158 GETCHAR(id, inp); 159 GETSHORT(len, inp); 160 161 #if 0 162 if (len > pktlen) { 163 error("CBCP packet: invalid length"); 164 return; 165 } 166 #endif 167 168 len -= CBCP_MINLEN; 169 170 switch(code) { 171 case CBCP_REQ: 172 us->us_id = id; 173 cbcp_recvreq(us, inp, len); 174 break; 175 176 case CBCP_RESP: 177 dbglog("CBCP_RESP received"); 178 break; 179 180 case CBCP_ACK: 181 if (id != us->us_id) 182 dbglog("id doesn't match: expected %d recv %d", 183 us->us_id, id); 184 185 cbcp_recvack(us, inp, len); 186 break; 187 188 default: 189 break; 190 } 191 } 192 193 /* protocol was rejected by foe */ 194 void cbcp_protrej(int iface) 195 { 196 } 197 198 char *cbcp_codenames[] = { 199 "Request", "Response", "Ack" 200 }; 201 202 char *cbcp_optionnames[] = { 203 "NoCallback", 204 "UserDefined", 205 "AdminDefined", 206 "List" 207 }; 208 209 /* pretty print a packet */ 210 static int 211 cbcp_printpkt(p, plen, printer, arg) 212 u_char *p; 213 int plen; 214 void (*printer) __P((void *, char *, ...)); 215 void *arg; 216 { 217 int code, opt, id, len, olen, delay; 218 u_char *pstart; 219 220 if (plen < HEADERLEN) 221 return 0; 222 pstart = p; 223 GETCHAR(code, p); 224 GETCHAR(id, p); 225 GETSHORT(len, p); 226 if (len < HEADERLEN || len > plen) 227 return 0; 228 229 if (code >= 1 && code <= sizeof(cbcp_codenames) / sizeof(char *)) 230 printer(arg, " %s", cbcp_codenames[code-1]); 231 else 232 printer(arg, " code=0x%x", code); 233 234 printer(arg, " id=0x%x", id); 235 len -= HEADERLEN; 236 237 switch (code) { 238 case CBCP_REQ: 239 case CBCP_RESP: 240 case CBCP_ACK: 241 while(len >= 2) { 242 GETCHAR(opt, p); 243 GETCHAR(olen, p); 244 245 if (olen < 2 || olen > len) { 246 break; 247 } 248 249 printer(arg, " <"); 250 len -= olen; 251 252 if (opt >= 1 && opt <= sizeof(cbcp_optionnames) / sizeof(char *)) 253 printer(arg, " %s", cbcp_optionnames[opt-1]); 254 else 255 printer(arg, " option=0x%x", opt); 256 257 if (olen > 2) { 258 GETCHAR(delay, p); 259 printer(arg, " delay = %d", delay); 260 } 261 262 if (olen > 3) { 263 int addrt; 264 char str[256]; 265 266 GETCHAR(addrt, p); 267 memcpy(str, p, olen - 4); 268 str[olen - 4] = 0; 269 printer(arg, " number = %s", str); 270 } 271 printer(arg, ">"); 272 break; 273 } 274 275 default: 276 break; 277 } 278 279 for (; len > 0; --len) { 280 GETCHAR(code, p); 281 printer(arg, " %.2x", code); 282 } 283 284 return p - pstart; 285 } 286 287 /* received CBCP request */ 288 static void 289 cbcp_recvreq(us, pckt, pcktlen) 290 cbcp_state *us; 291 char *pckt; 292 int pcktlen; 293 { 294 u_char type, opt_len, delay, addr_type; 295 char address[256]; 296 int len = pcktlen; 297 298 address[0] = 0; 299 300 while (len) { 301 dbglog("length: %d", len); 302 303 GETCHAR(type, pckt); 304 GETCHAR(opt_len, pckt); 305 306 if (opt_len > 2) 307 GETCHAR(delay, pckt); 308 309 us->us_allowed |= (1 << type); 310 311 switch(type) { 312 case CB_CONF_NO: 313 dbglog("no callback allowed"); 314 break; 315 316 case CB_CONF_USER: 317 dbglog("user callback allowed"); 318 if (opt_len > 4) { 319 GETCHAR(addr_type, pckt); 320 memcpy(address, pckt, opt_len - 4); 321 address[opt_len - 4] = 0; 322 if (address[0]) 323 dbglog("address: %s", address); 324 } 325 break; 326 327 case CB_CONF_ADMIN: 328 dbglog("user admin defined allowed"); 329 break; 330 331 case CB_CONF_LIST: 332 break; 333 } 334 len -= opt_len; 335 } 336 337 cbcp_resp(us); 338 } 339 340 static void 341 cbcp_resp(us) 342 cbcp_state *us; 343 { 344 u_char cb_type; 345 u_char buf[256]; 346 u_char *bufp = buf; 347 int len = 0; 348 349 cb_type = us->us_allowed & us->us_type; 350 dbglog("cbcp_resp cb_type=%d", cb_type); 351 352 #if 0 353 if (!cb_type) 354 lcp_down(us->us_unit); 355 #endif 356 357 if (cb_type & ( 1 << CB_CONF_USER ) ) { 358 dbglog("cbcp_resp CONF_USER"); 359 PUTCHAR(CB_CONF_USER, bufp); 360 len = 3 + 1 + strlen(us->us_number) + 1; 361 PUTCHAR(len , bufp); 362 PUTCHAR(5, bufp); /* delay */ 363 PUTCHAR(1, bufp); 364 BCOPY(us->us_number, bufp, strlen(us->us_number) + 1); 365 cbcp_send(us, CBCP_RESP, buf, len); 366 return; 367 } 368 369 if (cb_type & ( 1 << CB_CONF_ADMIN ) ) { 370 dbglog("cbcp_resp CONF_ADMIN"); 371 PUTCHAR(CB_CONF_ADMIN, bufp); 372 len = 3; 373 PUTCHAR(len, bufp); 374 PUTCHAR(5, bufp); /* delay */ 375 cbcp_send(us, CBCP_RESP, buf, len); 376 return; 377 } 378 379 if (cb_type & ( 1 << CB_CONF_NO ) ) { 380 dbglog("cbcp_resp CONF_NO"); 381 PUTCHAR(CB_CONF_NO, bufp); 382 len = 3; 383 PUTCHAR(len , bufp); 384 PUTCHAR(0, bufp); 385 cbcp_send(us, CBCP_RESP, buf, len); 386 start_networks(); 387 return; 388 } 389 } 390 391 static void 392 cbcp_send(us, code, buf, len) 393 cbcp_state *us; 394 u_char code; 395 u_char *buf; 396 int len; 397 { 398 u_char *outp; 399 int outlen; 400 401 outp = outpacket_buf; 402 403 outlen = 4 + len; 404 405 MAKEHEADER(outp, PPP_CBCP); 406 407 PUTCHAR(code, outp); 408 PUTCHAR(us->us_id, outp); 409 PUTSHORT(outlen, outp); 410 411 if (len) 412 BCOPY(buf, outp, len); 413 414 output(us->us_unit, outpacket_buf, outlen + PPP_HDRLEN); 415 } 416 417 static void 418 cbcp_recvack(us, pckt, len) 419 cbcp_state *us; 420 char *pckt; 421 int len; 422 { 423 u_char type, delay, addr_type; 424 int opt_len; 425 char address[256]; 426 427 if (len) { 428 GETCHAR(type, pckt); 429 GETCHAR(opt_len, pckt); 430 431 if (opt_len > 2) 432 GETCHAR(delay, pckt); 433 434 if (opt_len > 4) { 435 GETCHAR(addr_type, pckt); 436 memcpy(address, pckt, opt_len - 4); 437 address[opt_len - 4] = 0; 438 if (address[0]) 439 dbglog("peer will call: %s", address); 440 } 441 if (type == CB_CONF_NO) 442 return; 443 } 444 445 cbcp_up(us); 446 } 447 448 /* ok peer will do callback */ 449 static void 450 cbcp_up(us) 451 cbcp_state *us; 452 { 453 persist = 0; 454 lcp_close(0, "Call me back, please"); 455 status = EXIT_CALLBACK; 456 } -
cpukit/pppd/cbcp.h
rba71076 raee474b 1 #ifndef CBCP_H 2 #define CBCP_H 3 4 typedef struct cbcp_state { 5 int us_unit; /* Interface unit number */ 6 u_char us_id; /* Current id */ 7 u_char us_allowed; 8 int us_type; 9 char *us_number; /* Telefone Number */ 10 } cbcp_state; 11 12 extern cbcp_state cbcp[]; 13 14 extern struct protent cbcp_protent; 15 16 #define CBCP_MINLEN 4 17 18 #define CBCP_REQ 1 19 #define CBCP_RESP 2 20 #define CBCP_ACK 3 21 22 #define CB_CONF_NO 1 23 #define CB_CONF_USER 2 24 #define CB_CONF_ADMIN 3 25 #define CB_CONF_LIST 4 26 #endif -
cpukit/pppd/chat.c
rba71076 raee474b 15 15 * 16 16 * ----------------- 17 * 22-May-99 added environment substitutuion, enabled with -E switch. 18 * Andreas Arens <andras@cityweb.de>. 19 * 20 * 12-May-99 added a feature to read data to be sent from a file, 21 * if the send string starts with @. Idea from gpk <gpk@onramp.net>. 22 * 17 23 * added -T and -U option and \T and \U substitution to pass a phone 18 24 * number into chat script. Two are needed for some ISDN TA applications. … … 75 81 * (614)451-1883 76 82 * 77 * 78 */ 79 80 #ifndef lint 81 /* static char rcsid[] = ""; */ 82 #endif 83 */ 83 84 84 85 #include <stdio.h> … … 86 87 #include <time.h> 87 88 #include <fcntl.h> 88 #include <signal.h>89 89 #include <errno.h> 90 90 #include <string.h> … … 94 94 #include <sys/stat.h> 95 95 #include <syslog.h> 96 #include <termios.h> 97 #include "pppd.h" 96 98 97 99 #undef TERMIOS 98 100 #define TERMIOS 99 101 100 101 #include <termios.h>102 102 103 103 #define STR_LEN 1024 … … 143 143 char *program_name; 144 144 145 #define MAX_ABORTS 5146 #define MAX_REPORTS 5145 #define MAX_ABORTS 16 146 #define MAX_REPORTS 16 147 147 #define DEFAULT_CHAT_TIMEOUT 45 148 #define fcntl(a, b,c ) 0 149 #define MAX_TIMEOUTS 10 150 151 int echo = 0; 152 int verbose = 0; 153 int to_log = 1; 154 int to_stderr = 0; 155 int Verbose = 0; 156 int quiet = 0; 157 int report = 0; 158 int exit_code = 0; 159 char *report_file = (char *) 0; 160 char *chat_file = (char *) 0; 161 char *phone_num = (char *) 0; 162 char *phone_num2 = (char *) 0; 163 int chat_timeout = DEFAULT_CHAT_TIMEOUT; 164 static int timeout = DEFAULT_CHAT_TIMEOUT; 165 int have_tty_parameters = 0; 148 #define MAX_TIMEOUTS 10 149 150 int echo = 0; 151 int quiet = 0; 152 int report = 0; 153 int use_env = 0; 154 int exit_code = 0; 155 char *report_file = (char *) 0; 156 char *chat_file = (char *) 0; 157 char *phone_num = (char *) 0; 158 char *phone_num2 = (char *) 0; 159 static int timeout = DEFAULT_CHAT_TIMEOUT; 166 160 167 161 #ifdef TERMIOS 168 162 #define term_parms struct termios 169 #define get_term_param(param) tcgetattr( ttyfd, param)170 #define set_term_param(param) tcsetattr( ttyfd, TCSANOW, param)163 #define get_term_param(param) tcgetattr(0, param) 164 #define set_term_param(param) tcsetattr(0, TCSANOW, param) 171 165 struct termios saved_tty_parameters; 172 166 #endif 173 167 174 char *abort_string[MAX_ABORTS]={"BUSY","NO DIALTONE","NO CARRIER","NO ASWER","RINGING\r\n\r\nRINGING"}; 175 char *fail_reason = (char *)0, 176 fail_buffer[50]; 177 int n_aborts = MAX_ABORTS, abort_next = 0, timeout_next = 0, echo_next = 0; 168 char *fail_reason = (char *)0; 169 char fail_buffer[50]; 170 char *abort_string[MAX_ABORTS]={"BUSY","NO DIALTONE","NO CARRIER","NO ANSWER","RING\r\nRING"}; 171 int n_aborts = 5; 172 int abort_next = 0, timeout_next = 0, echo_next = 0; 178 173 int clear_abort_next = 0; 179 174 … … 187 182 void *dup_mem __P((void *b, size_t c)); 188 183 void *copy_of __P((char *s)); 189 /*190 SIGTYPE sigalrm __P((int signo));191 SIGTYPE sigint __P((int signo));192 SIGTYPE sigterm __P((int signo));193 SIGTYPE sighup __P((int signo));194 */195 void unalarm __P((void));196 void init __P((void));197 void set_tty_parameters __P((void));198 void echo_stderr __P((int));199 184 void break_sequence __P((void)); 200 void terminate __P((int status));201 void do_file __P((char *chat_file));202 185 int get_string __P((register char *string)); 203 186 int put_string __P((register char *s)); … … 209 192 void chat_expect __P((register char *s)); 210 193 char *clean __P((register char *s, int sending)); 211 void break_sequence __P((void));212 void terminate __P((int status));213 void pack_array __P((char **array, int end));214 194 char *expect_strtok __P((char *, char *)); 215 int vfmtmsg __P((char *, int, const char *, va_list)); /* vsprintf++ */ 216 217 #if 0 218 int usleep( long usec ); /* returns 0 if ok, else -1 */ 219 #endif 220 221 extern int input_fd,output_fd; 222 223 int main __P((int, char *[])); 195 int chatmain __P((char *)); 196 224 197 225 198 void *dup_mem(b, c) … … 229 202 void *ans = malloc (c); 230 203 if (!ans) 231 232 233 memcpy 204 return NULL; 205 206 memcpy(ans, b, c); 234 207 return ans; 235 208 } … … 238 211 char *s; 239 212 { 240 return dup_mem (s, strlen (s) + 1); 241 } 242 243 /* 244 * chat [ -v ] [-T number] [-U number] [ -t timeout ] [ -f chat-file ] \ 245 * [ -r report-file ] \ 246 * [...[[expect[-say[-expect...]] say expect[-say[-expect]] ...]]] 247 * 248 * Perform a UUCP-dialer-like chat script on stdin and stdout. 249 */ 213 return dup_mem(s, strlen (s) + 1); 214 } 215 250 216 char *getnextcommand(char **string) 251 217 { 252 218 char *buf=*string,*res; 253 res=strchr(buf,' @');219 res=strchr(buf,'|'); 254 220 if (res==NULL) 255 221 return NULL; … … 259 225 } 260 226 261 262 extern int ttyfd;263 227 int chatmain(argv) 264 228 char *argv; … … 269 233 exit_code = 0; 270 234 271 printf("chat_main: %s\n", argv); 235 if ( debug ) { 236 dbglog("chat_main: %s\n", argv); 237 } 272 238 273 239 /* get first expect string */ 274 240 arg = getnextcommand(&argv); 275 while ( arg != NULL) {241 while (( arg != NULL ) && ( exit_code == 0 )) { 276 242 /* process the expect string */ 277 243 chat_expect(arg); 278 279 /* get the next send string */ 280 arg = getnextcommand(&argv); 281 if ( arg != NULL ) { 282 /* process the send string */ 283 chat_send(arg); 284 285 /* get the next expect string */ 244 if ( exit_code == 0 ) { 245 /* get the next send string */ 286 246 arg = getnextcommand(&argv); 247 if ( arg != NULL ) { 248 /* process the send string */ 249 chat_send(arg); 250 251 /* get the next expect string */ 252 arg = getnextcommand(&argv); 253 } 287 254 } 288 255 } 289 256 290 return 0; 291 } 292 293 294 295 /* 296 * Print an error message and terminate. 297 */ 298 299 void init() 300 { 301 set_tty_parameters(); 302 } 303 304 void set_tty_parameters() 305 { 306 term_parms t; 307 308 if (get_term_param (&t) < 0) 309 syslog(LOG_NOTICE,"Can't get terminal parameters:") 310 ; 311 312 saved_tty_parameters = t; 313 have_tty_parameters = 1; 314 t.c_iflag |= IGNBRK | ISTRIP | IGNPAR; 315 t.c_oflag = 0; 316 t.c_lflag = 0; 317 t.c_cc[VERASE] = 318 t.c_cc[VKILL] = 0; 319 t.c_cc[VMIN] = 0; 320 t.c_cc[VTIME] = 1; 321 if (set_term_param (&t) < 0) 322 syslog(LOG_NOTICE,"Can't set terminal parameters:") 323 ; 257 if ( exit_code ) { 258 exit_code = -exit_code; 259 } 260 261 return ( exit_code ); 324 262 } 325 263 326 264 void break_sequence() 327 265 { 328 329 /* tcsendbreak (0, 0);*/ 330 } 331 332 /*void terminate(status) 333 int status; 334 { 335 echo_stderr(-1); 336 337 if (have_tty_parameters) { 338 if (set_term_param (&saved_tty_parameters) < 0) 339 fatal(2, "Can't restore terminal parameters: %m"); 340 } 341 } 342 */ 266 tcsendbreak(ttyfd, 0); 267 } 268 343 269 /* 344 270 * 'Clean up' this string. … … 348 274 int sending; /* set to 1 when sending (putting) this string. */ 349 275 { 350 char temp[STR_LEN], cur_chr;276 char temp[STR_LEN], env_str[STR_LEN], cur_chr; 351 277 register char *s1, *phchar; 352 278 int add_return = sending; 353 #define isoctal(chr) (((chr) >= '0') && ((chr) <= '7')) 279 #define isoctal(chr) (((chr) >= '0') && ((chr) <= '7')) 280 #define isalnumx(chr) ((((chr) >= '0') && ((chr) <= '9')) \ 281 || (((chr) >= 'a') && ((chr) <= 'z')) \ 282 || (((chr) >= 'A') && ((chr) <= 'Z')) \ 283 || (chr) == '_') 354 284 355 285 s1 = temp; … … 368 298 continue; 369 299 } 300 301 if (use_env && cur_chr == '$') { /* ARI */ 302 phchar = env_str; 303 while (isalnumx(*s)) 304 *phchar++ = *s++; 305 *phchar = '\0'; 306 phchar = getenv(env_str); 307 if (phchar) 308 while (*phchar) 309 *s1++ = *phchar++; 310 continue; 311 } 370 312 371 313 if (cur_chr != '\\') { … … 401 343 if (sending) 402 344 *s1++ = '\\'; 403 404 345 *s1++ = cur_chr; 405 346 break; … … 407 348 case 'T': 408 349 if (sending && phone_num) { 409 for ( 350 for (phchar = phone_num; *phchar != '\0'; phchar++) 410 351 *s1++ = *phchar; 411 352 } … … 418 359 case 'U': 419 360 if (sending && phone_num2) { 420 for ( 361 for (phchar = phone_num2; *phchar != '\0'; phchar++) 421 362 *s1++ = *phchar; 422 363 } … … 456 397 break; 457 398 399 case '$': /* ARI */ 400 if (use_env) { 401 *s1++ = cur_chr; 402 break; 403 } 404 /* FALL THROUGH */ 405 458 406 default: 459 407 if (isoctal (cur_chr)) { … … 494 442 * A modified version of 'strtok'. This version skips \ sequences. 495 443 */ 496 497 444 char *expect_strtok (s, term) 498 445 char *s, *term; … … 549 496 * Process the expect string 550 497 */ 551 552 void chat_expect (s) 498 void chat_expect (s) 553 499 char *s; 554 500 { … … 558 504 if (strcmp(s, "HANGUP") == 0) { 559 505 ++hup_next; 560 return 506 return; 561 507 } 562 508 563 509 if (strcmp(s, "ABORT") == 0) { 564 510 ++abort_next; 565 return 511 return; 566 512 } 567 513 568 514 if (strcmp(s, "CLR_ABORT") == 0) { 569 515 ++clear_abort_next; 570 return 516 return; 571 517 } 572 518 573 519 if (strcmp(s, "REPORT") == 0) { 574 520 ++report_next; 575 return 521 return; 576 522 } 577 523 578 524 if (strcmp(s, "CLR_REPORT") == 0) { 579 525 ++clear_report_next; 580 return 526 return; 581 527 } 582 528 583 529 if (strcmp(s, "TIMEOUT") == 0) { 584 530 ++timeout_next; 585 return 531 return; 586 532 } 587 533 588 534 if (strcmp(s, "ECHO") == 0) { 589 535 ++echo_next; 590 return 536 return; 591 537 } 592 538 593 539 if (strcmp(s, "SAY") == 0) { 594 540 ++say_next; 595 return 541 return; 596 542 } 597 543 … … 601 547 for (;;) { 602 548 expect = expect_strtok (s, "-"); 603 s = (char *) 0;549 s = (char *) 0; 604 550 605 551 if (expect == (char *) 0) 606 return 552 return; 607 553 608 554 reply = expect_strtok (s, "-"); … … 623 569 chat_send (reply); 624 570 } 625 626 /* 627 * The expectation did not occur. This is terminal. 628 */ 629 return ; 571 } 572 573 /* 574 * Translate the input character to the appropriate string for printing 575 * the data. 576 */ 577 578 char *character(c) 579 int c; 580 { 581 static char string[10]; 582 char *meta; 583 584 meta = (c & 0x80) ? "M-" : ""; 585 c &= 0x7F; 586 587 if (c < 32) 588 sprintf(string, "%s^%c", meta, (int)c + '@'); 589 else if (c == 127) 590 sprintf(string, "%s^?", meta); 591 else 592 sprintf(string, "%s%c", meta, c); 593 594 return (string); 630 595 } 631 596 … … 636 601 register char *s; 637 602 { 603 char file_data[STR_LEN]; 604 638 605 if (say_next) { 639 606 say_next = 0; 640 s = clean(s, 0);641 write( ttyfd, s, strlen(s));607 s = clean(s, 1); 608 write(2, s, strlen(s)); 642 609 free(s); 643 610 return; … … 646 613 if (hup_next) { 647 614 hup_next = 0; 615 return; 648 616 } 649 617 … … 655 623 656 624 if (abort_next) { 657 /* char *s1; */625 char *s1; 658 626 627 abort_next = 0; 628 if ( n_aborts < MAX_ABORTS ) { 629 s1 = clean(s, 0); 630 if (( strlen(s1) <= strlen(s) ) && 631 ( strlen(s1) < sizeof(fail_buffer))) { 632 633 abort_string[n_aborts++] = s1; 634 } 635 } 636 return; 637 } 638 639 if (clear_abort_next) { 640 clear_abort_next = 0; 641 return; 642 } 643 644 if (report_next) { 645 report_next = 0; 646 return; 647 } 648 649 if (clear_report_next) { 650 clear_report_next = 0; 651 return; 652 } 653 654 if (timeout_next) { 655 timeout_next = 0; 656 timeout = atoi(s); 659 657 660 ; 661 662 663 return; 664 } 665 666 if (timeout_next) { 667 timeout=atoi(s); 668 timeout_next = 0; 669 chat_timeout = atoi(s); 670 671 if (chat_timeout <= 0) 672 chat_timeout = DEFAULT_CHAT_TIMEOUT; 673 674 675 return; 676 } 658 if (timeout <= 0) 659 timeout = DEFAULT_CHAT_TIMEOUT; 660 661 return; 662 } 663 677 664 if (strcmp(s, "EOT") == 0) 678 665 s = "^D\\c"; … … 680 667 s = "\\K\\c"; 681 668 682 if (!put_string(s)) 683 { 684 exit_code=1; 685 return; 686 } 669 if (!put_string(s)) { 670 exit_code = 2; 671 } 687 672 } 688 673 … … 709 694 int c; 710 695 { 711 int status; 712 char ch = c; 713 714 /* inter-character typing delay (?) */ 715 716 status = write(ttyfd, &ch, 1); 717 718 switch (status) { 719 case 1: 720 return (0); 721 722 default: 723 724 725 } 696 char ch = c; 697 698 write(ttyfd, &ch, 1); 699 726 700 return 0; 727 701 } … … 775 749 } 776 750 777 /* alarm(0);*/778 751 return (1); 779 752 } 780 753 781 754 /* 782 * Echo a character to stderr.783 * When called with -1, a '\n' character is generated when784 * the cursor is not at the beginning of a line.785 */786 void echo_stderr(n)787 int n;788 {789 /* static int need_lf;790 char *s;791 792 switch (n) {793 case '\r':794 break;795 case -1:796 if (need_lf == 0)797 break;798 799 case '\n':800 write(2, "\n", 1);801 need_lf = 0;802 break;803 default:804 s = character(n);805 write(2, s, strlen(s));806 need_lf = 1;807 break;808 }*/809 }810 811 /*812 755 * 'Wait for' this string to appear on this file descriptor. 813 756 */ 814 815 757 int get_string(string) 816 758 register char *string; … … 820 762 char *logged = temp2; 821 763 struct termios tios; 764 765 memset(temp2, 0, sizeof(temp2)); 822 766 823 767 tcgetattr(ttyfd, &tios); … … 839 783 } 840 784 841 842 785 while ( (c = get_char()) >= 0) { 843 786 int n, abort_len; … … 845 788 *s++ = c; 846 789 *s=0; 847 790 848 791 if (s - temp2 >= len && 849 792 c == string[len - 1] && … … 872 815 } 873 816 } 817 874 818 exit_code = 3; 875 819 return (0); 876 820 } 877 878 /*879 * Gross kludge to handle Solaris versions >= 2.6 having usleep.880 */881 882 /*883 usleep -- support routine for 4.2BSD system call emulations884 last edit: 29-Oct-1984 D A Gwyn885 */886 887 888 #if 0889 int890 usleep( usec ) /* returns 0 if ok, else -1 */891 long usec; /* delay in microseconds */892 {893 rtems_status_code status;894 rtems_interval ticks_per_second;895 rtems_interval ticks;896 status = rtems_clock_get(897 RTEMS_CLOCK_GET_TICKS_PER_SECOND,898 &ticks_per_second);899 ticks = (usec * (ticks_per_second/1000))/1000;900 status = rtems_task_wake_after( ticks );901 return 0;902 }903 #endif904 905 void pack_array (array, end)906 char **array; /* The address of the array of string pointers */907 int end; /* The index of the next free entry before CLR_ */908 {909 int i, j;910 911 for (i = 0; i < end; i++) {912 if (array[i] == NULL) {913 for (j = i+1; j < end; ++j)914 if (array[j] != NULL)915 array[i++] = array[j];916 for (; i < end; ++i)917 array[i] = NULL;918 break;919 }920 }921 }922 923 /*924 * vfmtmsg - format a message into a buffer. Like vsprintf except we925 * also specify the length of the output buffer, and we handle the926 * %m (error message) format.927 * Doesn't do floating-point formats.928 * Returns the number of chars put into buf.929 */930 #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) -
cpukit/pppd/example/README
rba71076 raee474b 7 7 be renamed to Makefile or the -f option given to make. The file 8 8 is renamed to avoid bootstrap -c removing it. 9 10 The files ppp.conf and pppd.options are sample configuration files 11 that have successfully used to make ppp connections over a null 12 modem serial cable to a UNIX box. Please review the man pages 13 for either the ppp or pppd applications to ensure they are configured 14 correctly. 15 -
cpukit/pppd/pppd.h
rba71076 raee474b 590 590 #endif 591 591 #define DEBUGMAIN 1 592 #define DEBUGUPAP 1 593 #define DEBUGCHAP 1 592 594 593 595 -
cpukit/pppd/rtemsmain.c
rba71076 raee474b 107 107 int kill_link; 108 108 int open_ccp_flag; 109 110 static int waiting;111 109 112 110 char **script_env; /* Env. variable values for scripts */ … … 234 232 setlogmask(LOG_UPTO(LOG_DEBUG)); 235 233 */ 236 237 waiting = 0;238 234 239 235 do_callback = 0; … … 401 397 new_phase(PHASE_ESTABLISH); 402 398 while (phase != PHASE_DEAD) { 403 waiting = 1;404 399 wait_input(timeleft(&timo)); 405 waiting = 0;406 407 400 calltimeout(); 408 401 get_input(); 402 409 403 if (kill_link) { 410 404 lcp_close(0, "User request"); … … 470 464 TIMEOUT(holdoff_end, NULL, t); 471 465 do { 472 waiting = 1;473 466 wait_input(timeleft(&timo)); 474 waiting = 0;475 467 476 468 calltimeout();
Note: See TracChangeset
for help on using the changeset viewer.