| 1931 | } |
| 1932 | |
| 1933 | static void |
| 1934 | sppp_open_event(const struct cp *cp, struct sppp *sp) |
| 1935 | { |
| 1936 | STDDCL; |
| 1937 | |
| 1938 | if (debug) |
| 1939 | log(LOG_DEBUG, SPP_FMT "%s open(%s)\n", |
| 1940 | SPP_ARGS(ifp), cp->name, |
| 1941 | sppp_state_name(sp->state[cp->protoidx])); |
| 1942 | |
| 1943 | switch (sp->state[cp->protoidx]) { |
| 1944 | case STATE_INITIAL: |
| 1945 | sppp_cp_change_state(cp, sp, STATE_STARTING); |
| 1946 | (cp->tls)(sp); |
| 1947 | break; |
| 1948 | case STATE_STARTING: |
| 1949 | break; |
| 1950 | case STATE_CLOSED: |
| 1951 | sp->rst_counter[cp->protoidx] = sp->lcp.max_configure; |
| 1952 | (cp->scr)(sp); |
| 1953 | sppp_cp_change_state(cp, sp, STATE_REQ_SENT); |
| 1954 | break; |
| 1955 | case STATE_STOPPED: |
| 1956 | /* |
| 1957 | * Try escaping stopped state. This seems to bite |
| 1958 | * people occasionally, in particular for IPCP, |
| 1959 | * presumably following previous IPCP negotiation |
| 1960 | * aborts. Somehow, we must have missed a Down event |
| 1961 | * which would have caused a transition into starting |
| 1962 | * state, so as a bandaid we force the Down event now. |
| 1963 | * This effectively implements (something like the) |
| 1964 | * `restart' option mentioned in the state transition |
| 1965 | * table of RFC 1661. |
| 1966 | */ |
| 1967 | sppp_cp_change_state(cp, sp, STATE_STARTING); |
| 1968 | (cp->tls)(sp); |
| 1969 | break; |
| 1970 | case STATE_STOPPING: |
| 1971 | case STATE_REQ_SENT: |
| 1972 | case STATE_ACK_RCVD: |
| 1973 | case STATE_ACK_SENT: |
| 1974 | case STATE_OPENED: |
| 1975 | break; |
| 1976 | case STATE_CLOSING: |
| 1977 | sppp_cp_change_state(cp, sp, STATE_STOPPING); |
| 1978 | break; |
| 1979 | } |
| 1980 | } |
| 1981 | |
| 1982 | static void |
| 1983 | sppp_close_event(const struct cp *cp, struct sppp *sp) |
no test coverage detected