Skip to content

Conversation

@SeppoTakalo
Copy link
Contributor

When remote peer have closed the PPP link normally (LCP Terminate-Request), the PPP stack on Zephyr side switches back to ESTABLISH phase to be ready for next handshake.

When calling net_if_down() on the interface, it should not try to initiate LCP link termination, but instead go directly to DEAD phase.

See https://datatracker.ietf.org/doc/html/rfc1661#section-3.2

   +------+        +-----------+           +--------------+
   |      | UP     |           | OPENED    |              | SUCCESS/NONE
   | Dead |------->| Establish |---------->| Authenticate |--+
   |      |        |           |           |              |  |
   +------+        +-----------+           +--------------+  |
      ^               |                        |             |
      |          FAIL |                   FAIL |             |
      +<--------------+             +----------+             |
      |                             |                        |
      |            +-----------+    |           +---------+  |
      |       DOWN |           |    |   CLOSING |         |  |
      +------------| Terminate |<---+<----------| Network |<-+
                   |           |                |         |
                   +-----------+                +---------+

ESTABLISH->DEAD is a valid transition.
It does not have to go to ESTABLISH->TERMINATE->DEAD.

Without this change, the net_if_down() waits for CONFIG_NET_L2_PPP_TIMEOUT until returning if the link was already closed by the remote peer. If the link was up, the termination is faster as peer is responding.

This is because when reaching the DEAD phase, the lcp_down() returns to ESTABLISH if we still indicate carrier is OK.
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/l2/ppp/lcp.c#L208-L210

This delay basically only affects the peer which is serving the connection (PPP server/modem).

When remote peer have closed the PPP link normally, the
PPP stack on Zephyr side switches back to ESTABLISH phase
to be ready for next handshake.

When calling net_if_down() on the interface, it should not
try to initiate LCP link termination, but instead go directly
to DEAD phase.

See https://datatracker.ietf.org/doc/html/rfc1661#section-3.2

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants