In case of carrier loss, clear all queues, enter state LABB_STATE_0 and stop all timers. By setting rc = LAPB_NOTCONNECTED, the upper layer is informed about the disconnect. Signed-off-by: Martin Schiller <ms@xxxxxxxxxx> --- net/lapb/lapb_iface.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 8dd7c420ae93..017bc169c334 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -303,6 +303,18 @@ int lapb_disconnect_request(struct net_device *dev) if (!lapb) goto out; + if (!netif_carrier_ok(dev)) { + lapb_dbg(0, "(%p) Carrier lost!\n", lapb->dev); + lapb_dbg(0, "(%p) S%d -> S0\n", lapb->dev, lapb->state); + lapb_clear_queues(lapb); + lapb->state = LAPB_STATE_0; + lapb->n2count = 0; + lapb_stop_t1timer(lapb); + lapb_stop_t2timer(lapb); + rc = LAPB_NOTCONNECTED; + goto out_put; + } + switch (lapb->state) { case LAPB_STATE_0: rc = LAPB_NOTCONNECTED; -- 2.20.1