Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Move RCA event after RCR event



details:   https://anonhg.NetBSD.org/src/rev/766dfe99c63d
branches:  trunk
changeset: 1021135:766dfe99c63d
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue May 11 06:21:28 2021 +0000

description:
Move RCA event after RCR event

A authentication failed by TO+ event between RCA and RCR events
 1. RCA event in REQ-SENT state
   - REQ-SENT => ACK-RCVD
 2. TO+ event
   - ACK-RCVD => REQ-SENT
 3. RCR+ event
   - REQ-SENT => ACK-SENT

By moving RCA after RCR, the state is transisted to OPENED
 1. RCR event
   - REQ-SENT => ACK-SENT
 2. TO+ event
   - state is not changed
 3. RCA event
   - ACK-SENT => OPENED

diffstat:

 sys/net/if_spppsubr.c |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diffs (66 lines):

diff -r aaa4d7ec94b9 -r 766dfe99c63d sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue May 11 06:03:54 2021 +0000
+++ b/sys/net/if_spppsubr.c     Tue May 11 06:21:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.233 2021/05/11 01:27:45 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.234 2021/05/11 06:21:28 yamaguchi Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.233 2021/05/11 01:27:45 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.234 2021/05/11 06:21:28 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -4876,11 +4876,6 @@
 
                        if (memcmp(digest, value, value_len) == 0) {
                                sp->scp[IDX_CHAP].rcr_type = CP_RCR_ACK;
-                               if (!ISSET(sppp_auth_role(&chap, sp), SPPP_AUTH_PEER) ||
-                                   sp->chap.rechallenging) {
-                                       /* generate a dummy RCA event*/
-                                       sppp_wq_add(sp->wq_cp, &sp->scp[IDX_CHAP].work_rca);
-                               }
                        } else {
                                sp->scp[IDX_CHAP].rcr_type = CP_RCR_NAK;
                        }
@@ -4896,6 +4891,13 @@
                }
 
                sppp_wq_add(sp->wq_cp, &sp->scp[IDX_CHAP].work_rcr);
+
+               /* generate a dummy RCA event */
+               if (sp->scp[IDX_CHAP].rcr_type == CP_RCR_ACK &&
+                   (!ISSET(sppp_auth_role(&chap, sp), SPPP_AUTH_PEER) ||
+                   sp->chap.rechallenging)) {
+                       sppp_wq_add(sp->wq_cp, &sp->scp[IDX_CHAP].work_rca);
+               }
                break;
 
        default:
@@ -5149,15 +5151,17 @@
                    secret_len == sp->hisauth.secret_len &&
                    memcmp(secret, sp->hisauth.secret, secret_len) == 0) {
                        sp->scp[IDX_PAP].rcr_type = CP_RCR_ACK;
-                       if (!ISSET(sppp_auth_role(&pap, sp), SPPP_AUTH_PEER)) {
-                               /* generate a dummy RCA event*/
-                               sppp_wq_add(sp->wq_cp, &sp->scp[IDX_PAP].work_rca);
-                       }
                } else {
                        sp->scp[IDX_PAP].rcr_type = CP_RCR_NAK;
                }
 
                sppp_wq_add(sp->wq_cp, &sp->scp[IDX_PAP].work_rcr);
+
+               /* generate a dummy RCA event */
+               if (sp->scp[IDX_PAP].rcr_type == CP_RCR_ACK &&
+                   !ISSET(sppp_auth_role(&pap, sp), SPPP_AUTH_PEER)) {
+                       sppp_wq_add(sp->wq_cp, &sp->scp[IDX_PAP].work_rca);
+               }
                break;
 
        /* ack and nak are his authproto */



Home | Main Index | Thread Index | Old Index