Re: hdlc_ppp: why no detach()?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Krzysztof Halasa
Date: Wednesday, April 14, 2010 - 3:48 pm

Hello Michael,

Michael Barkowski <michaelbarkowski@ruggedcom.com> writes:


I assume you mean .detach = fr_destroy(). It's used only to kill
subdevices, i.e. it has nothing to do with the interface being up/down.


Theoretically all paths adding skbs to the tx_queue should send them out
before returning (possibly also on behalf of other devices). However I
wonder if it's the case. Let's see: Only ppp_tx_cp() adds to the queue
directly:
- ppp_rx() (calls ppp_tx_flush())
- ppp_timer (calls ppp_tx_flush())
- ppp_cp_event():
  - ppp_cp_parse_cr() (calls ppp_tx_flush())
  - ppp_stop() calls ppp_cp_event(), but it won't queue any skb, it only
    marks the connection as closed and does the same to IPCP and IPV6CP.

This means the problematic part is ppp_start() which calls
ppp_cp_event(LCP, START) = IRC | SCR | 3 meaning
Initialize-Restart-Count, Send-Configure-Request and change state to
REQ_SENT. This causes two problems:

1. The SCR packet will be delayed by 2 seconds (both first and second
   SCR will be sent the same time). Perhaps we delay only a little
   (instead of full 2 seconds) and only then send the initial packet.

2. (as you noted) the skb will be added to tx_queue and left there. If
   we happen to "ifconfig up" and "rmmod driver" before receiving any
   packet and before ppp->req_timeout (2 seconds) and before any other
   PPP interface does the same, we will eventually get skb with invalid
   ->dev. This is simple to drain in .close (detach is a wrong place
   since it may be called long after the interface is deactivated, there
   is no need to delay it past .close). The fix for #1 will already fix
   #2, but the redundant safety doesn't cost us anything.

Thanks for noting the problem, I'll post a patch shortly.

Also it seems the timeouts etc. should be configurable. ATM we're only
fixing bugs, good.
-- 
Krzysztof Halasa
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
hdlc_ppp: why no detach()?, Michael Barkowski, (Mon Apr 12, 7:15 am)
Re: hdlc_ppp: why no detach()?, Michael Barkowski, (Mon Apr 12, 7:34 am)
Re: hdlc_ppp: why no detach()?, Krzysztof Halasa, (Wed Apr 14, 3:48 pm)
Re: hdlc_ppp: why no detach()?, Krzysztof Halasa, (Wed Apr 14, 5:02 pm)