diff options
Diffstat (limited to 'accel-pppd/ppp/ppp_ipv6cp.c')
-rw-r--r-- | accel-pppd/ppp/ppp_ipv6cp.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/accel-pppd/ppp/ppp_ipv6cp.c b/accel-pppd/ppp/ppp_ipv6cp.c index 9a87922..1194b31 100644 --- a/accel-pppd/ppp/ppp_ipv6cp.c +++ b/accel-pppd/ppp/ppp_ipv6cp.c @@ -54,7 +54,7 @@ static void ipv6cp_options_init(struct ppp_ipv6cp_t *ipv6cp) struct ipv6cp_option_handler_t *h; ipv6cp->conf_req_len = sizeof(struct ipv6cp_hdr_t); - + list_for_each_entry(h,&option_handlers,entry) { lopt = h->init(ipv6cp); if (lopt) { @@ -80,16 +80,16 @@ static struct ppp_layer_data_t *ipv6cp_layer_init(struct ppp_t *ppp) { struct ppp_ipv6cp_t *ipv6cp = _malloc(sizeof(*ipv6cp)); memset(ipv6cp, 0, sizeof(*ipv6cp)); - + log_ppp_debug("ipv6cp_layer_init\n"); ipv6cp->ppp = ppp; ipv6cp->fsm.ppp = ppp; - + ipv6cp->hnd.proto = PPP_IPV6CP; ipv6cp->hnd.recv = ipv6cp_recv; ipv6cp->hnd.recv_proto_rej = ipv6cp_recv_proto_rej; - + ppp_register_unit_handler(ppp, &ipv6cp->hnd); ipv6cp->fsm.proto = PPP_IPV6CP; @@ -109,7 +109,7 @@ static struct ppp_layer_data_t *ipv6cp_layer_init(struct ppp_t *ppp) INIT_LIST_HEAD(&ipv6cp->ropt_list); ipv6cp->ld.passive = conf_ipv6 == IPV6_ALLOW || conf_ipv6 == IPV6_DENY; - + return &ipv6cp->ld; } @@ -118,7 +118,7 @@ static void ipv6cp_start_timeout(struct triton_timer_t *t) struct ppp_ipv6cp_t *ipv6cp = container_of(t, typeof(*ipv6cp), timeout); triton_timer_del(t); - + if (ipv6cp->ppp->ses.state == AP_STATE_STARTING) ap_session_terminate(&ipv6cp->ppp->ses, TERM_USER_ERROR, 0); } @@ -126,7 +126,7 @@ static void ipv6cp_start_timeout(struct triton_timer_t *t) int ipv6cp_layer_start(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_start\n"); ipv6cp_options_init(ipv6cp); @@ -144,18 +144,18 @@ int ipv6cp_layer_start(struct ppp_layer_data_t *ld) return -1; } } - + return 0; } void ipv6cp_layer_finish(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_finish\n"); ipv6cp->fsm.fsm_state = FSM_Closed; - + log_ppp_debug("ipv6cp_layer_finished\n"); ppp_layer_finished(ipv6cp->ppp, &ipv6cp->ld); } @@ -163,9 +163,9 @@ void ipv6cp_layer_finish(struct ppp_layer_data_t *ld) void ipv6cp_layer_free(struct ppp_layer_data_t *ld) { struct ppp_ipv6cp_t *ipv6cp = container_of(ld, typeof(*ipv6cp), ld); - + log_ppp_debug("ipv6cp_layer_free\n"); - + ppp_unregister_handler(ipv6cp->ppp, &ipv6cp->hnd); ipv6cp_options_free(ipv6cp); ppp_fsm_free(&ipv6cp->fsm); @@ -189,7 +189,7 @@ static void __ipv6cp_layer_up(struct ppp_ipv6cp_t *ipv6cp) static void ipv6cp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_ipv6cp_t *ipv6cp = container_of(fsm, typeof(*ipv6cp), fsm); - + if (!ipv6cp->delay_ack) __ipv6cp_layer_up(ipv6cp); } @@ -207,7 +207,7 @@ static void ipv6cp_layer_finished(struct ppp_fsm_t *fsm) ppp_layer_passive(ipv6cp->ppp, &ipv6cp->ld); } else if (!ipv6cp->ppp->ses.terminating) ap_session_terminate(&ipv6cp->ppp->ses, TERM_USER_ERROR, 0); - + fsm->fsm_state = FSM_Closed; } @@ -244,7 +244,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm) ipv6cp_hdr->code = CONFREQ; ipv6cp_hdr->id = ipv6cp->fsm.id; ipv6cp_hdr->len = 0; - + ptr += sizeof(*ipv6cp_hdr); list_for_each_entry(lopt, &ipv6cp->options, entry) { @@ -318,7 +318,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) ipv6cp_hdr->code = CONFNAK; ipv6cp_hdr->id = ipv6cp->fsm.recv_id; ipv6cp_hdr->len = 0; - + ptr += sizeof(*ipv6cp_hdr); list_for_each_entry(ropt, &ipv6cp->ropt_list, entry) { @@ -331,7 +331,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm) } } } - + if (conf_ppp_verbose) log_ppp_info2("]\n"); @@ -407,7 +407,7 @@ static int ipv6cp_recv_conf_req(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int data += hdr->len; size -= hdr->len; } - + list_for_each_entry(lopt, &ipv6cp->options, entry) lopt->state=IPV6CP_OPT_NONE; @@ -454,7 +454,7 @@ static int ipv6cp_recv_conf_req(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int if (r < ret) ret = r; break; - } + } } if (!ropt->lopt) { ropt->state = IPV6CP_OPT_REJ; @@ -504,7 +504,7 @@ static int ipv6cp_recv_conf_rej(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -545,7 +545,7 @@ static int ipv6cp_recv_conf_nak(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -588,7 +588,7 @@ static int ipv6cp_recv_conf_ack(struct ppp_ipv6cp_t *ipv6cp, uint8_t *data, int while (size > 0) { hdr = (struct ipv6cp_opt_hdr_t *)data; - + if (!hdr->len || hdr->len > size) break; @@ -644,7 +644,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm) if (conf_ppp_verbose) log_ppp_info2("send [IPV6CP TermAck id=%x]\n", hdr.id); - + ppp_unit_send(ipv6cp->ppp, &hdr, 6); } @@ -675,12 +675,12 @@ static void ipv6cp_recv(struct ppp_handler_t*h) log_ppp_warn("IPV6CP: short packet received\n"); return; } - + if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != ipv6cp->fsm.id) return; ipv6cp->fsm.recv_id = hdr->id; - + switch(hdr->code) { case CONFREQ: r = ipv6cp_recv_conf_req(ipv6cp,(uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN); @@ -763,7 +763,7 @@ static void ipv6cp_recv_proto_rej(struct ppp_handler_t*h) if (ipv6cp->fsm.fsm_state == FSM_Initial || ipv6cp->fsm.fsm_state == FSM_Closed) return; - + ppp_fsm_lower_down(&ipv6cp->fsm); ppp_fsm_close(&ipv6cp->fsm); } @@ -773,9 +773,9 @@ int ipv6cp_option_register(struct ipv6cp_option_handler_t *h) /*struct ipv6cp_option_drv_t *p; list_for_each_entry(p,option_drv_list,entry) - if (p->id==h->id) + if (p->id==h->id) return -1;*/ - + list_add_tail(&h->entry, &option_handlers); return 0; @@ -785,11 +785,11 @@ struct ipv6cp_option_t *ipv6cp_find_option(struct ppp_t *ppp, struct ipv6cp_opti { struct ppp_ipv6cp_t *ipv6cp = container_of(ppp_find_layer_data(ppp, &ipv6cp_layer), typeof(*ipv6cp), ld); struct ipv6cp_option_t *opt; - + list_for_each_entry(opt, &ipv6cp->options, entry) if (opt->h == h) return opt; - + log_emerg("ipv6cp: BUG: option not found\n"); abort(); } |