Lines Matching refs:fsm

26 struct ppp_context *ppp_fsm_ctx(struct ppp_fsm *fsm)  in ppp_fsm_ctx()  argument
28 if (fsm->protocol == PPP_LCP) { in ppp_fsm_ctx()
29 return CONTAINER_OF(fsm, struct ppp_context, lcp.fsm); in ppp_fsm_ctx()
31 } else if (fsm->protocol == PPP_IPCP) { in ppp_fsm_ctx()
32 return CONTAINER_OF(fsm, struct ppp_context, ipcp.fsm); in ppp_fsm_ctx()
35 } else if (fsm->protocol == PPP_IPV6CP) { in ppp_fsm_ctx()
36 return CONTAINER_OF(fsm, struct ppp_context, ipv6cp.fsm); in ppp_fsm_ctx()
39 } else if (fsm->protocol == PPP_PAP) { in ppp_fsm_ctx()
40 return CONTAINER_OF(fsm, struct ppp_context, pap.fsm); in ppp_fsm_ctx()
47 struct net_if *ppp_fsm_iface(struct ppp_fsm *fsm) in ppp_fsm_iface() argument
49 struct ppp_context *ctx = ppp_fsm_ctx(fsm); in ppp_fsm_iface()
56 static void fsm_send_configure_req(struct ppp_fsm *fsm, bool retransmit) in fsm_send_configure_req() argument
60 if (fsm->state != PPP_ACK_RECEIVED && in fsm_send_configure_req()
61 fsm->state != PPP_ACK_SENT && in fsm_send_configure_req()
62 fsm->state != PPP_REQUEST_SENT) { in fsm_send_configure_req()
64 if (fsm->cb.config_info_reset) { in fsm_send_configure_req()
65 fsm->cb.config_info_reset(fsm); in fsm_send_configure_req()
68 fsm->recv_nack_loops = 0; in fsm_send_configure_req()
69 fsm->nack_loops = 0; in fsm_send_configure_req()
73 fsm->retransmits = MAX_CONFIGURE_REQ; in fsm_send_configure_req()
74 fsm->req_id = ++fsm->id; in fsm_send_configure_req()
77 fsm->ack_received = false; in fsm_send_configure_req()
79 if (fsm->cb.config_info_add) { in fsm_send_configure_req()
80 pkt = fsm->cb.config_info_add(fsm); in fsm_send_configure_req()
84 fsm->name, fsm, ppp_pkt_type2str(PPP_CONFIGURE_REQ), in fsm_send_configure_req()
85 PPP_CONFIGURE_REQ, fsm->req_id, ppp_state_str(fsm->state), in fsm_send_configure_req()
86 fsm->state); in fsm_send_configure_req()
88 (void)ppp_send_pkt(fsm, NULL, PPP_CONFIGURE_REQ, fsm->req_id, in fsm_send_configure_req()
91 fsm->retransmits--; in fsm_send_configure_req()
93 (void)k_work_reschedule(&fsm->timer, FSM_TIMEOUT); in fsm_send_configure_req()
99 struct ppp_fsm *fsm = CONTAINER_OF(dwork, struct ppp_fsm, timer); in ppp_fsm_timeout() local
101 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_timeout()
102 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_timeout()
104 switch (fsm->state) { in ppp_fsm_timeout()
108 if (fsm->retransmits <= 0) { in ppp_fsm_timeout()
110 fsm->name, fsm, in ppp_fsm_timeout()
112 fsm->retransmits); in ppp_fsm_timeout()
114 ppp_change_state(fsm, PPP_STOPPED); in ppp_fsm_timeout()
116 if (fsm->cb.finished) { in ppp_fsm_timeout()
117 fsm->cb.finished(fsm); in ppp_fsm_timeout()
120 if (fsm->cb.retransmit) { in ppp_fsm_timeout()
121 fsm->cb.retransmit(fsm); in ppp_fsm_timeout()
124 fsm_send_configure_req(fsm, true); in ppp_fsm_timeout()
126 if (fsm->state == PPP_ACK_RECEIVED) { in ppp_fsm_timeout()
127 ppp_change_state(fsm, PPP_REQUEST_SENT); in ppp_fsm_timeout()
135 if (fsm->retransmits <= 0) { in ppp_fsm_timeout()
136 ppp_change_state(fsm, in ppp_fsm_timeout()
137 fsm->state == PPP_CLOSING ? in ppp_fsm_timeout()
140 if (fsm->cb.finished) { in ppp_fsm_timeout()
141 fsm->cb.finished(fsm); in ppp_fsm_timeout()
144 fsm->req_id = ++fsm->id; in ppp_fsm_timeout()
146 ppp_send_pkt(fsm, NULL, PPP_TERMINATE_REQ, fsm->req_id, in ppp_fsm_timeout()
147 fsm->terminate_reason, in ppp_fsm_timeout()
148 strlen(fsm->terminate_reason)); in ppp_fsm_timeout()
150 fsm->retransmits--; in ppp_fsm_timeout()
152 (void)k_work_reschedule(&fsm->timer, FSM_TIMEOUT); in ppp_fsm_timeout()
158 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_timeout()
159 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_timeout()
164 void ppp_fsm_init(struct ppp_fsm *fsm, uint16_t protocol) in ppp_fsm_init() argument
166 fsm->protocol = protocol; in ppp_fsm_init()
167 fsm->state = PPP_INITIAL; in ppp_fsm_init()
168 fsm->flags = 0U; in ppp_fsm_init()
170 k_work_init_delayable(&fsm->timer, ppp_fsm_timeout); in ppp_fsm_init()
173 static void fsm_down(struct ppp_fsm *fsm) in fsm_down() argument
177 for (i = 0; i < fsm->my_options.count; i++) { in fsm_down()
178 fsm->my_options.data[i].flags = 0; in fsm_down()
181 if (fsm->cb.down) { in fsm_down()
182 fsm->cb.down(fsm); in fsm_down()
186 static void terminate(struct ppp_fsm *fsm, enum ppp_state next_state) in terminate() argument
188 if (fsm->state != PPP_OPENED) { in terminate()
189 k_work_cancel_delayable(&fsm->timer); in terminate()
191 fsm_down(fsm); in terminate()
194 fsm->retransmits = MAX_TERMINATE_REQ; in terminate()
195 fsm->req_id = ++fsm->id; in terminate()
197 (void)ppp_send_pkt(fsm, NULL, PPP_TERMINATE_REQ, fsm->req_id, in terminate()
198 fsm->terminate_reason, in terminate()
199 strlen(fsm->terminate_reason)); in terminate()
201 if (fsm->retransmits == 0) { in terminate()
202 ppp_change_state(fsm, next_state); in terminate()
204 if (fsm->cb.finished) { in terminate()
205 fsm->cb.finished(fsm); in terminate()
211 (void)k_work_reschedule(&fsm->timer, FSM_TIMEOUT); in terminate()
213 fsm->retransmits--; in terminate()
215 ppp_change_state(fsm, next_state); in terminate()
218 void ppp_fsm_close(struct ppp_fsm *fsm, const uint8_t *reason) in ppp_fsm_close() argument
220 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_close()
221 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_close()
223 switch (fsm->state) { in ppp_fsm_close()
229 int limit_len = sizeof(fsm->terminate_reason) - 1; in ppp_fsm_close()
231 strncpy(fsm->terminate_reason, reason, limit_len); in ppp_fsm_close()
232 fsm->terminate_reason[limit_len] = '\0'; in ppp_fsm_close()
235 terminate(fsm, PPP_CLOSING); in ppp_fsm_close()
240 ppp_change_state(fsm, PPP_INITIAL); in ppp_fsm_close()
244 ppp_change_state(fsm, PPP_CLOSED); in ppp_fsm_close()
248 ppp_change_state(fsm, PPP_CLOSING); in ppp_fsm_close()
252 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_close()
253 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_close()
258 void ppp_fsm_lower_down(struct ppp_fsm *fsm) in ppp_fsm_lower_down() argument
260 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_lower_down()
261 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_lower_down()
263 switch (fsm->state) { in ppp_fsm_lower_down()
268 ppp_change_state(fsm, PPP_STARTING); in ppp_fsm_lower_down()
269 k_work_cancel_delayable(&fsm->timer); in ppp_fsm_lower_down()
273 ppp_change_state(fsm, PPP_INITIAL); in ppp_fsm_lower_down()
277 ppp_change_state(fsm, PPP_INITIAL); in ppp_fsm_lower_down()
278 k_work_cancel_delayable(&fsm->timer); in ppp_fsm_lower_down()
282 ppp_change_state(fsm, PPP_STARTING); in ppp_fsm_lower_down()
283 fsm_down(fsm); in ppp_fsm_lower_down()
288 ppp_change_state(fsm, PPP_STARTING); in ppp_fsm_lower_down()
289 if (fsm->cb.starting) { in ppp_fsm_lower_down()
290 fsm->cb.starting(fsm); in ppp_fsm_lower_down()
296 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_lower_down()
297 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_lower_down()
302 void ppp_fsm_lower_up(struct ppp_fsm *fsm) in ppp_fsm_lower_up() argument
304 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_lower_up()
305 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_lower_up()
307 switch (fsm->state) { in ppp_fsm_lower_up()
312 ppp_change_state(fsm, PPP_CLOSED); in ppp_fsm_lower_up()
316 fsm_send_configure_req(fsm, false); in ppp_fsm_lower_up()
317 ppp_change_state(fsm, PPP_REQUEST_SENT); in ppp_fsm_lower_up()
322 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_lower_up()
323 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_lower_up()
328 void ppp_fsm_open(struct ppp_fsm *fsm) in ppp_fsm_open() argument
330 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_open()
331 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_open()
333 switch (fsm->state) { in ppp_fsm_open()
335 ppp_change_state(fsm, PPP_REQUEST_SENT); in ppp_fsm_open()
336 fsm_send_configure_req(fsm, false); in ppp_fsm_open()
340 ppp_change_state(fsm, PPP_STOPPING); in ppp_fsm_open()
341 if (fsm->flags & FSM_RESTART) { in ppp_fsm_open()
342 ppp_fsm_lower_down(fsm); in ppp_fsm_open()
343 ppp_fsm_lower_up(fsm); in ppp_fsm_open()
349 ppp_change_state(fsm, PPP_STARTING); in ppp_fsm_open()
350 if (fsm->cb.starting) { in ppp_fsm_open()
351 fsm->cb.starting(fsm); in ppp_fsm_open()
358 if (fsm->flags & FSM_RESTART) { in ppp_fsm_open()
359 ppp_fsm_lower_down(fsm); in ppp_fsm_open()
360 ppp_fsm_lower_up(fsm); in ppp_fsm_open()
366 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_open()
367 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_open()
372 int ppp_send_pkt(struct ppp_fsm *fsm, struct net_if *iface, in ppp_send_pkt() argument
387 if (!fsm) { in ppp_send_pkt()
391 iface = ppp_fsm_iface(fsm); in ppp_send_pkt()
398 if (fsm) { in ppp_send_pkt()
399 protocol = fsm->protocol; in ppp_send_pkt()
404 struct ppp_context *ctx = ppp_fsm_ctx(fsm); in ppp_send_pkt()
497 struct ppp_context *ctx = CONTAINER_OF(fsm, struct ppp_context, in ppp_send_pkt()
498 lcp.fsm); in ppp_send_pkt()
529 fsm ? fsm->name : "?", fsm, net_pkt_get_len(pkt), pkt, in ppp_send_pkt()
534 if (fsm) { in ppp_send_pkt()
560 static enum net_verdict fsm_recv_configure_req(struct ppp_fsm *fsm, in fsm_recv_configure_req() argument
569 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_configure_req()
570 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_req()
572 switch (fsm->state) { in fsm_recv_configure_req()
578 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_TERMINATE_ACK, in fsm_recv_configure_req()
587 fsm_down(fsm); in fsm_recv_configure_req()
589 fsm_send_configure_req(fsm, false); in fsm_recv_configure_req()
590 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_req()
598 fsm_send_configure_req(fsm, false); in fsm_recv_configure_req()
599 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_req()
603 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in fsm_recv_configure_req()
604 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_req()
619 if (fsm->cb.config_info_req) { in fsm_recv_configure_req()
622 ret = fsm->cb.config_info_req(fsm, pkt, remaining_len, out); in fsm_recv_configure_req()
627 if (fsm->nack_loops >= MAX_NACK_LOOPS && in fsm_recv_configure_req()
644 fsm->name, fsm, ppp_pkt_type2str(code), code, id, in fsm_recv_configure_req()
645 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_req()
647 (void)ppp_send_pkt(fsm, NULL, code, id, out, len); in fsm_recv_configure_req()
650 if (fsm->state == PPP_ACK_RECEIVED) { in fsm_recv_configure_req()
651 k_work_cancel_delayable(&fsm->timer); in fsm_recv_configure_req()
653 ppp_change_state(fsm, PPP_OPENED); in fsm_recv_configure_req()
655 if (fsm->cb.up) { in fsm_recv_configure_req()
656 fsm->cb.up(fsm); in fsm_recv_configure_req()
659 ppp_change_state(fsm, PPP_ACK_SENT); in fsm_recv_configure_req()
662 fsm->nack_loops = 0; in fsm_recv_configure_req()
664 if (fsm->state != PPP_ACK_RECEIVED) { in fsm_recv_configure_req()
665 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_req()
669 fsm->nack_loops++; in fsm_recv_configure_req()
681 static enum net_verdict fsm_recv_configure_ack(struct ppp_fsm *fsm, uint8_t id, in fsm_recv_configure_ack() argument
685 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_configure_ack()
686 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_ack()
688 if (id != fsm->req_id || fsm->ack_received) { in fsm_recv_configure_ack()
692 if (fsm->cb.config_info_ack) { in fsm_recv_configure_ack()
693 if (fsm->cb.config_info_ack(fsm, pkt, remaining_len) < 0) { in fsm_recv_configure_ack()
694 NET_DBG("[%s/%p] %s %s received", fsm->name, fsm, in fsm_recv_configure_ack()
701 fsm->ack_received = true; in fsm_recv_configure_ack()
702 fsm->recv_nack_loops = 0; in fsm_recv_configure_ack()
704 switch (fsm->state) { in fsm_recv_configure_ack()
706 k_work_cancel_delayable(&fsm->timer); in fsm_recv_configure_ack()
707 fsm_send_configure_req(fsm, false); in fsm_recv_configure_ack()
708 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_ack()
712 k_work_cancel_delayable(&fsm->timer); in fsm_recv_configure_ack()
713 ppp_change_state(fsm, PPP_OPENED); in fsm_recv_configure_ack()
714 fsm->retransmits = MAX_CONFIGURE_REQ; in fsm_recv_configure_ack()
715 if (fsm->cb.up) { in fsm_recv_configure_ack()
716 fsm->cb.up(fsm); in fsm_recv_configure_ack()
723 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_TERMINATE_ACK, in fsm_recv_configure_ack()
728 fsm_down(fsm); in fsm_recv_configure_ack()
730 fsm_send_configure_req(fsm, false); in fsm_recv_configure_ack()
731 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_ack()
735 ppp_change_state(fsm, PPP_ACK_RECEIVED); in fsm_recv_configure_ack()
736 fsm->retransmits = MAX_CONFIGURE_REQ; in fsm_recv_configure_ack()
740 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in fsm_recv_configure_ack()
741 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_ack()
748 static enum net_verdict fsm_recv_configure_nack_rej(struct ppp_fsm *fsm, in fsm_recv_configure_nack_rej() argument
756 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_configure_nack_rej()
757 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_nack_rej()
759 if (id != fsm->req_id || fsm->ack_received) { in fsm_recv_configure_nack_rej()
766 fsm->recv_nack_loops++; in fsm_recv_configure_nack_rej()
768 if (fsm->recv_nack_loops >= MAX_NACK_LOOPS) { in fsm_recv_configure_nack_rej()
772 if (fsm->cb.config_info_nack) { in fsm_recv_configure_nack_rej()
775 err = fsm->cb.config_info_nack(fsm, pkt, length, in fsm_recv_configure_nack_rej()
779 fsm->name, fsm, "Nack", err); in fsm_recv_configure_nack_rej()
786 NET_DBG("[%s/%p] %s %s (id %d)", fsm->name, fsm, in fsm_recv_configure_nack_rej()
791 fsm->recv_nack_loops = 0; in fsm_recv_configure_nack_rej()
793 if (fsm->cb.config_info_rej) { in fsm_recv_configure_nack_rej()
796 err = fsm->cb.config_info_rej(fsm, pkt, length); in fsm_recv_configure_nack_rej()
799 fsm->name, fsm, "Reject", err); in fsm_recv_configure_nack_rej()
806 NET_DBG("[%s/%p] %s %s (id %d)", fsm->name, fsm, in fsm_recv_configure_nack_rej()
812 fsm->ack_received = true; in fsm_recv_configure_nack_rej()
814 switch (fsm->state) { in fsm_recv_configure_nack_rej()
816 k_work_cancel_delayable(&fsm->timer); in fsm_recv_configure_nack_rej()
817 fsm_send_configure_req(fsm, false); in fsm_recv_configure_nack_rej()
818 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_nack_rej()
823 k_work_cancel_delayable(&fsm->timer); in fsm_recv_configure_nack_rej()
824 fsm_send_configure_req(fsm, false); in fsm_recv_configure_nack_rej()
829 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_TERMINATE_ACK, in fsm_recv_configure_nack_rej()
834 fsm_down(fsm); in fsm_recv_configure_nack_rej()
836 fsm_send_configure_req(fsm, false); in fsm_recv_configure_nack_rej()
837 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_configure_nack_rej()
841 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in fsm_recv_configure_nack_rej()
842 ppp_state_str(fsm->state), fsm->state); in fsm_recv_configure_nack_rej()
849 static enum net_verdict fsm_recv_terminate_req(struct ppp_fsm *fsm, uint8_t id, in fsm_recv_terminate_req() argument
853 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_terminate_req()
854 ppp_state_str(fsm->state), fsm->state); in fsm_recv_terminate_req()
856 switch (fsm->state) { in fsm_recv_terminate_req()
859 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_terminate_req()
864 net_pkt_read(pkt, fsm->terminate_reason, in fsm_recv_terminate_req()
866 sizeof(fsm->terminate_reason) - 1)); in fsm_recv_terminate_req()
869 fsm->name, fsm, "Terminated by peer", in fsm_recv_terminate_req()
870 fsm->terminate_reason); in fsm_recv_terminate_req()
873 fsm->name, fsm); in fsm_recv_terminate_req()
876 fsm->retransmits = 0; in fsm_recv_terminate_req()
877 ppp_change_state(fsm, PPP_STOPPING); in fsm_recv_terminate_req()
879 fsm_down(fsm); in fsm_recv_terminate_req()
881 (void)k_work_reschedule(&fsm->timer, FSM_TIMEOUT); in fsm_recv_terminate_req()
885 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in fsm_recv_terminate_req()
886 ppp_state_str(fsm->state), fsm->state); in fsm_recv_terminate_req()
890 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_TERMINATE_ACK, id, in fsm_recv_terminate_req()
896 static enum net_verdict fsm_recv_terminate_ack(struct ppp_fsm *fsm, uint8_t id, in fsm_recv_terminate_ack() argument
902 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_terminate_ack()
903 ppp_state_str(fsm->state), fsm->state); in fsm_recv_terminate_ack()
905 switch (fsm->state) { in fsm_recv_terminate_ack()
911 fsm_down(fsm); in fsm_recv_terminate_ack()
913 fsm_send_configure_req(fsm, false); in fsm_recv_terminate_ack()
914 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_terminate_ack()
922 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_terminate_ack()
926 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in fsm_recv_terminate_ack()
927 ppp_state_str(fsm->state), fsm->state); in fsm_recv_terminate_ack()
934 k_work_cancel_delayable(&fsm->timer); in fsm_recv_terminate_ack()
935 ppp_change_state(fsm, new_state); in fsm_recv_terminate_ack()
937 if (fsm->cb.finished) { in fsm_recv_terminate_ack()
938 fsm->cb.finished(fsm); in fsm_recv_terminate_ack()
944 static enum net_verdict fsm_recv_code_rej(struct ppp_fsm *fsm, in fsm_recv_code_rej() argument
950 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in fsm_recv_code_rej()
951 ppp_state_str(fsm->state), fsm->state); in fsm_recv_code_rej()
963 NET_DBG("[%s/%p] Received Code-Rej code %d id %d", fsm->name, fsm, in fsm_recv_code_rej()
966 if (fsm->state == PPP_ACK_RECEIVED) { in fsm_recv_code_rej()
967 ppp_change_state(fsm, PPP_REQUEST_SENT); in fsm_recv_code_rej()
973 void ppp_fsm_proto_reject(struct ppp_fsm *fsm) in ppp_fsm_proto_reject() argument
975 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_proto_reject()
976 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_proto_reject()
978 switch (fsm->state) { in ppp_fsm_proto_reject()
983 k_work_cancel_delayable(&fsm->timer); in ppp_fsm_proto_reject()
984 ppp_change_state(fsm, PPP_STOPPED); in ppp_fsm_proto_reject()
985 if (fsm->cb.finished) { in ppp_fsm_proto_reject()
986 fsm->cb.finished(fsm); in ppp_fsm_proto_reject()
992 ppp_change_state(fsm, PPP_CLOSED); in ppp_fsm_proto_reject()
993 if (fsm->cb.finished) { in ppp_fsm_proto_reject()
994 fsm->cb.finished(fsm); in ppp_fsm_proto_reject()
1000 k_work_cancel_delayable(&fsm->timer); in ppp_fsm_proto_reject()
1001 ppp_change_state(fsm, PPP_CLOSED); in ppp_fsm_proto_reject()
1002 if (fsm->cb.finished) { in ppp_fsm_proto_reject()
1003 fsm->cb.finished(fsm); in ppp_fsm_proto_reject()
1009 terminate(fsm, PPP_STOPPING); in ppp_fsm_proto_reject()
1013 ppp_change_state(fsm, PPP_STOPPED); in ppp_fsm_proto_reject()
1014 if (fsm->cb.finished) { in ppp_fsm_proto_reject()
1015 fsm->cb.finished(fsm); in ppp_fsm_proto_reject()
1021 NET_DBG("[%s/%p] %s state %s (%d)", fsm->name, fsm, "Invalid", in ppp_fsm_proto_reject()
1022 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_proto_reject()
1027 enum net_verdict ppp_fsm_input(struct ppp_fsm *fsm, uint16_t proto, in ppp_fsm_input() argument
1033 struct ppp_context *ctx = ppp_fsm_ctx(fsm); in ppp_fsm_input()
1038 fsm->name, fsm, "code", net_pkt_get_len(pkt)); in ppp_fsm_input()
1045 fsm->name, fsm, "id", net_pkt_get_len(pkt)); in ppp_fsm_input()
1052 fsm->name, fsm, "length", net_pkt_get_len(pkt)); in ppp_fsm_input()
1057 NET_DBG("[%s/%p] Too long msg %d", fsm->name, fsm, length); in ppp_fsm_input()
1061 if (fsm->state == PPP_INITIAL || fsm->state == PPP_STARTING) { in ppp_fsm_input()
1063 fsm->name, fsm, ppp_proto2str(proto), in ppp_fsm_input()
1064 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_input()
1071 NET_DBG("[%s/%p] %s %s (%d) id %d payload len %d", fsm->name, fsm, in ppp_fsm_input()
1077 return fsm_recv_code_rej(fsm, pkt); in ppp_fsm_input()
1080 return fsm_recv_configure_ack(fsm, id, pkt, length); in ppp_fsm_input()
1083 return fsm_recv_configure_nack_rej(fsm, code, id, pkt, length); in ppp_fsm_input()
1086 return fsm_recv_configure_req(fsm, id, pkt, length); in ppp_fsm_input()
1089 return fsm_recv_configure_nack_rej(fsm, code, id, pkt, length); in ppp_fsm_input()
1092 return fsm_recv_terminate_ack(fsm, id, pkt, length); in ppp_fsm_input()
1095 return fsm_recv_terminate_req(fsm, id, pkt, length); in ppp_fsm_input()
1098 if (fsm->cb.proto_extension) { in ppp_fsm_input()
1101 verdict = fsm->cb.proto_extension(fsm, code, id, pkt); in ppp_fsm_input()
1107 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_CODE_REJ, in ppp_fsm_input()
1114 enum net_verdict ppp_fsm_recv_protocol_rej(struct ppp_fsm *fsm, in ppp_fsm_recv_protocol_rej() argument
1118 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_recv_protocol_rej()
1119 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_recv_protocol_rej()
1124 enum net_verdict ppp_fsm_recv_echo_req(struct ppp_fsm *fsm, in ppp_fsm_recv_echo_req() argument
1128 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_recv_echo_req()
1129 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_recv_echo_req()
1131 (void)ppp_send_pkt(fsm, net_pkt_iface(pkt), PPP_ECHO_REPLY, in ppp_fsm_recv_echo_req()
1137 enum net_verdict ppp_fsm_recv_echo_reply(struct ppp_fsm *fsm, in ppp_fsm_recv_echo_reply() argument
1141 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_recv_echo_reply()
1142 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_recv_echo_reply()
1145 struct ppp_context *ctx = CONTAINER_OF(fsm, struct ppp_context, in ppp_fsm_recv_echo_reply()
1146 lcp.fsm); in ppp_fsm_recv_echo_reply()
1156 enum net_verdict ppp_fsm_recv_discard_req(struct ppp_fsm *fsm, in ppp_fsm_recv_discard_req() argument
1160 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ppp_fsm_recv_discard_req()
1161 ppp_state_str(fsm->state), fsm->state); in ppp_fsm_recv_discard_req()