Changeset 48cdb95a in rtems for cpukit/pppd


Ignore:
Timestamp:
Apr 10, 2003, 4:20:38 PM (17 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
0d6849e7
Parents:
bbd88004
Message:

2003-04-10 Joel Sherrill <joel@…>

PR 371/pppd

  • pppd/auth.c, pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/lcp.c, pppd/options.c, pppd/pppd.h, pppd/rtemsmain.c, pppd/rtemspppd.c: Change many symbols to static. There are still global symbols in rtemspppd.h which might need to be changed or converted into member of a structure which is dereferenced with a pointer that is managed as a per task variable. But this patch should avoid many conflicts.
Location:
cpukit/pppd
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • cpukit/pppd/auth.c

    rbbd88004 r48cdb95a  
    250250    int unit;
    251251{
    252     if (phase == PHASE_DEAD)
     252    if (pppd_phase == PHASE_DEAD)
    253253        return;
    254254    if (pap_logout_hook) {
     
    284284    num_np_open = 0;
    285285    num_np_up = 0;
    286     if (phase != PHASE_DEAD)
     286    if (pppd_phase != PHASE_DEAD)
    287287        new_phase(PHASE_TERMINATE);
    288288}
     
    324324            warn("peer refused to authenticate: terminating link");
    325325            lcp_close(unit, "peer refused to authenticate");
    326             status = EXIT_PEER_AUTH_FAILED;
     326            pppd_status = EXIT_PEER_AUTH_FAILED;
    327327            return;
    328328        }
     
    426426     */
    427427    lcp_close(unit, "Authentication failed");
    428     status = EXIT_PEER_AUTH_FAILED;
     428    pppd_status = EXIT_PEER_AUTH_FAILED;
    429429}
    430430
     
    484484     */
    485485    lcp_close(unit, "Failed to authenticate ourselves to peer");
    486     status = EXIT_AUTH_TOPEER_FAILED;
     486    pppd_status = EXIT_AUTH_TOPEER_FAILED;
    487487}
    488488
     
    532532         * At this point we consider that the link has come up successfully.
    533533         */
    534         status = EXIT_OK;
     534        pppd_status = EXIT_OK;
    535535        unsuccess = 0;
    536536        new_phase(PHASE_RUNNING);
     
    604604        lcp_close(0, "Link inactive");
    605605        need_holdoff = 0;
    606         status = EXIT_IDLE_TIMEOUT;
     606        pppd_status = EXIT_IDLE_TIMEOUT;
    607607    } else {
    608608        TIMEOUT(check_idle, NULL, tlim);
     
    619619    info("Connect time expired");
    620620    lcp_close(0, "Connect time expired");       /* Close connection */
    621     status = EXIT_CONNECT_TIME;
     621    pppd_status = EXIT_CONNECT_TIME;
    622622}
    623623
  • cpukit/pppd/chat.c

    rbbd88004 r48cdb95a  
    141141/*************** Micro getopt() *********************************************/
    142142
    143 char *program_name;
    144 
    145143#define MAX_ABORTS              16
    146144#define MAX_REPORTS             16
     
    148146#define MAX_TIMEOUTS            10
    149147
    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;
     148static int echo             = 0;
     149static int quiet            = 0;
     150static int use_env          = 0;
     151static int exit_code        = 0;
     152static char *phone_num      = (char *) 0;
     153static char *phone_num2     = (char *) 0;
    159154static int ttyfd;
    160155static int timeout   = DEFAULT_CHAT_TIMEOUT;
  • cpukit/pppd/demand.c

    rbbd88004 r48cdb95a  
    4646static const char rcsid[] = RCSID;
    4747
    48 char *frame;
    49 int framelen;
    50 int framemax;
    51 int escape_flag;
    52 int flush_flag;
    53 int fcs;
     48static char *frame;
     49static int framelen;
     50static int framemax;
     51static int escape_flag;
     52static int flush_flag;
     53static int fcs;
    5454
    5555struct packet {
  • cpukit/pppd/fsm.c

    rbbd88004 r48cdb95a  
    4646#define PROTO_NAME(f)   ((f)->callbacks->proto_name)
    4747
    48 int peer_mru[NUM_PPP];
     48static int peer_mru[NUM_PPP];
    4949
    5050
  • cpukit/pppd/lcp.c

    rbbd88004 r48cdb95a  
    3939 * LCP-related command-line options.
    4040 */
    41 int     lcp_echo_interval = 0;  /* Interval between LCP echo-requests */
    42 int     lcp_echo_fails = 0;     /* Tolerance to unanswered echo-requests */
    43 bool    lax_recv = 0;           /* accept control chars in asyncmap */
     41static int      lcp_echo_interval = 0;  /* Interval between LCP echo-requests */
     42static int      lcp_echo_fails = 0;     /* Tolerance to unanswered echo-requests */
     43static bool     lax_recv = 0;           /* accept control chars in asyncmap */
    4444
    4545static int setescape __P((char **));
     
    336336    fsm *f = &lcp_fsm[unit];
    337337
    338     if (phase != PHASE_DEAD)
     338    if (pppd_phase != PHASE_DEAD)
    339339        new_phase(PHASE_TERMINATE);
    340340    if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
     
    10641064                notice("Serial line is looped back.");
    10651065                lcp_close(f->unit, "Loopback detected");
    1066                 status = EXIT_LOOPBACK;
     1066                pppd_status = EXIT_LOOPBACK;
    10671067            }
    10681068        } else
     
    18161816        notice("Serial link appears to be disconnected.");
    18171817        lcp_close(f->unit, "Peer not responding");
    1818         status = EXIT_PEER_DEAD;
     1818        pppd_status = EXIT_PEER_DEAD;
    18191819    }
    18201820}
  • cpukit/pppd/options.c

    rbbd88004 r48cdb95a  
    624624    if ((opt->flags & OPT_PREPASS) == 0 && prepass)
    625625        return 1;
    626     if ((opt->flags & OPT_INITONLY) && phase != PHASE_INITIALIZE) {
     626    if ((opt->flags & OPT_INITONLY) && pppd_phase != PHASE_INITIALIZE) {
    627627        option_error("it's too late to use the %s option", opt->name);
    628628        return 0;
     
    778778usage()
    779779{
    780     if (phase == PHASE_INITIALIZE)
     780    if (pppd_phase == PHASE_INITIALIZE)
    781781        fprintf(stderr, usage_string, VERSION, PATCHLEVEL, IMPLEMENTATION,
    782                 progname);
     782                "rtems_pppd");
    783783}
    784784
     
    786786 * option_error - print a message about an error in an option.
    787787 * The message is logged, and also sent to
    788  * stderr if phase == PHASE_INITIALIZE.
     788 * stderr if pppd_phase == PHASE_INITIALIZE.
    789789 */
    790790void
     
    13231323    }
    13241324
    1325     if (phase != PHASE_INITIALIZE) {
     1325    if (pppd_phase != PHASE_INITIALIZE) {
    13261326        option_error("device name cannot be changed after initialization");
    13271327        return -1;
  • cpukit/pppd/pppd.h

    rbbd88004 r48cdb95a  
    138138 */
    139139
    140 extern int      kill_link;      /* Signal to terminate processing loop */
     140extern int      pppd_kill_link; /* Signal to terminate processing loop */
    141141extern int      hungup;         /* Physical layer has disconnected */
    142142extern int      pppifunit;      /* Interface unit number */
     
    145145extern char     hostname[];     /* Our hostname */
    146146extern u_char   outpacket_buf[]; /* Buffer for outgoing packets */
    147 extern int      phase;          /* Current state of link - see values below */
     147extern int      pppd_phase;             /* Current state of link - see values below */
    148148extern int      baud_rate;      /* Current link speed in bits/sec */
    149 extern char     *progname;      /* Name of this program */
    150149extern int      redirect_stderr;/* Connector's stderr should go to file */
    151150extern char     peer_authname[];/* Authenticated name of peer */
     
    160159extern int      log_to_fd;      /* logging to this fd as well as syslog */
    161160extern char     *no_ppp_msg;    /* message to print if ppp not in kernel */
    162 extern volatile int status;     /* exit status for pppd */
     161extern volatile int pppd_status;        /* exit status for pppd */
    163162extern int      devnam_fixed;   /* can no longer change devnam */
    164163extern int      unsuccess;      /* # unsuccessful connection attempts */
  • cpukit/pppd/rtemsmain.c

    rbbd88004 r48cdb95a  
    7575int pppifunit;                  /* Interface unit number */
    7676
    77 char *progname;                 /* Name of this program */
    7877char hostname[MAXNAMELEN];      /* Our hostname */
    7978static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
     
    8887int prepass = 0;                /* doing prepass to find device name */
    8988int devnam_fixed;               /* set while in options.ttyxx file */
    90 volatile int status;            /* exit status for pppd */
     89volatile int pppd_status;               /* exit status for pppd */
    9190int unsuccess;                  /* # unsuccessful connection attempts */
    9291int do_callback;                /* != 0 if we should do callback next */
     
    103102static int real_ttyfd;          /* fd for actual serial port (not pty) */
    104103
    105 int phase;                      /* where the link is at */
    106 int kill_link;
     104int pppd_phase;                 /* where the link is at */
     105int pppd_kill_link;
    107106int open_ccp_flag;
    108107
     
    196195#endif
    197196
    198     progname = *argv;
    199 
    200197
    201198    if (!ppp_available()) {
     
    238235        ttyfd = -1;
    239236        real_ttyfd = -1;
    240         status = EXIT_OK;
     237        pppd_status = EXIT_OK;
    241238        ++unsuccess;
    242239        doing_callback = do_callback;
     
    261258         */
    262259        hungup = 0;
    263         kill_link = 0;
     260        pppd_kill_link = 0;
    264261        connector = doing_callback? callback_script: connect_script;
    265262        if (devnam[0] != 0) {
     
    276273                if (err != EINTR) {
    277274                    error("Failed to open %s: %m", devnam);
    278                     status = EXIT_OPEN_FAILED;
     275                    pppd_status = EXIT_OPEN_FAILED;
    279276                }
    280277                if (!persist || err != EINTR)
     
    314311                if (device_script(ttyfd, DIALER_INIT, initializer) < 0) {
    315312                    error("Initializer script failed");
    316                     status = EXIT_INIT_FAILED;
     313                    pppd_status = EXIT_INIT_FAILED;
    317314                    goto fail;
    318315                }
    319                 if (kill_link)
     316                if (pppd_kill_link)
    320317                    goto disconnect;
    321318
     
    326323                if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) {
    327324                    error("Connect script failed");
    328                     status = EXIT_CONNECT_FAILED;
     325                    pppd_status = EXIT_CONNECT_FAILED;
    329326                    goto fail;
    330327                }
    331                 if (kill_link)
     328                if (pppd_kill_link)
    332329                    goto disconnect;
    333330
     
    351348                if (errno != EINTR) {
    352349                    error("Failed to reopen %s: %m", devnam);
    353                     status = EXIT_OPEN_FAILED;
     350                    pppd_status = EXIT_OPEN_FAILED;
    354351                }
    355                 if (!persist || errno != EINTR || hungup || kill_link)
     352                if (!persist || errno != EINTR || hungup || pppd_kill_link)
    356353                    goto fail;
    357354            }
     
    371368        fd_ppp = establish_ppp(ttyfd);
    372369        if (fd_ppp < 0) {
    373             status = EXIT_FATAL_ERROR;
     370            pppd_status = EXIT_FATAL_ERROR;
    374371            goto disconnect;
    375372        }
     
    391388
    392389        open_ccp_flag = 0;
    393         status = EXIT_NEGOTIATION_FAILED;
     390        pppd_status = EXIT_NEGOTIATION_FAILED;
    394391        new_phase(PHASE_ESTABLISH);
    395         while (phase != PHASE_DEAD) {
     392        while (pppd_phase != PHASE_DEAD) {
    396393            wait_input(timeleft(&timo));
    397394            calltimeout();
    398395            get_input();
    399396
    400             if (kill_link) {
     397            if (pppd_kill_link) {
    401398                lcp_close(0, "User request");
    402                 kill_link = 0;
     399                pppd_kill_link = 0;
    403400            }
    404401            if (open_ccp_flag) {
    405                 if (phase == PHASE_NETWORK || phase == PHASE_RUNNING) {
     402                if (pppd_phase == PHASE_NETWORK || pppd_phase == PHASE_RUNNING) {
    406403                    ccp_fsm[0].flags = OPT_RESTART; /* clears OPT_SILENT */
    407404                    (*ccp_protent.open)(0);
     
    451448            break;
    452449
    453         kill_link = 0;
     450        pppd_kill_link = 0;
    454451        if (demand)
    455452            demand_discard();
     
    464461
    465462                calltimeout();
    466                 if (kill_link) {
    467                     kill_link = 0;
     463                if (pppd_kill_link) {
     464                    pppd_kill_link = 0;
    468465                    new_phase(PHASE_DORMANT); /* allow signal to end holdoff */
    469466                }
    470             } while (phase == PHASE_HOLDOFF);
     467            } while (pppd_phase == PHASE_HOLDOFF);
    471468            if (!persist)
    472469                break;
     
    474471    }
    475472
    476     die(status);
    477     return status;
     473    die(pppd_status);
     474    return pppd_status;
    478475}
    479476
     
    592589        notice("Modem hangup");
    593590        hungup = 1;
    594         status = EXIT_HANGUP;
     591        pppd_status = EXIT_HANGUP;
    595592        lcp_lowerdown(0);       /* serial link is no longer available */
    596593        link_terminated(0);
     
    622619     * except LCP, LQR and authentication packets.
    623620     */
    624     if (phase <= PHASE_AUTHENTICATE
     621    if (pppd_phase <= PHASE_AUTHENTICATE
    625622        && !(protocol == PPP_LCP || protocol == PPP_LQR
    626623             || protocol == PPP_PAP || protocol == PPP_CHAP)) {
    627624        MAINDEBUG(("get_input: discarding proto 0x%x in phase %d",
    628                    protocol, phase));
     625                   protocol, pppd_phase));
    629626        return;
    630627    }
     
    664661    int p;
    665662{
    666     phase = p;
     663    pppd_phase = p;
    667664    if (new_phase_hook)
    668665        (*new_phase_hook)(p);
  • cpukit/pppd/rtemspppd.c

    rbbd88004 r48cdb95a  
    178178
    179179    /* save current phase value */
    180     prevPhase = phase;
    181     phase     = PHASE_INITIALIZE;
     180    prevPhase = pppd_phase;
     181    pppd_phase     = PHASE_INITIALIZE;
    182182
    183183    /* process option and reset phase value */
    184184    iReturn = options_from_list(&option, 1);
    185     phase   = prevPhase;
     185    pppd_phase   = prevPhase;
    186186  }
    187187
     
    201201  /* set pppd global variables to disconnect */
    202202  persist   = 0;
    203   kill_link = 1;
     203  pppd_kill_link = 1;
    204204}
    205205
Note: See TracChangeset for help on using the changeset viewer.