[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Can you connect a MQTT client directly from a PPPoS sta
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-users] Can you connect a MQTT client directly from a PPPoS status callback? |
Date: |
Thu, 16 May 2019 23:38:36 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Freddie,
On Thu, May 16, 2019 at 10:09:49PM +0200, Freddie Chopin wrote:
> On Thu, 2019-05-16 at 21:28 +0200, Sylvain Rochet wrote:
> > Unless you are calling ppp_close() from a module, which I highly
> > doubt,
> > it is safe because other triggers are only rx packet or timeouts.
>
> Forgive my ignorance, but what is a "module" in the lwIP world? (;
I just used module because this is what was previously used. But this is
basically any function that can't be re-entered.
> Generally closing/disconnection are not that much important - when the
> PPPoS dies I guess MQTT will die by itself anyway, that's why my main
> concern is mqtt_client_connect().
>
> Let's say I would try to do it directly from the callback - it there
> anything I could check to tell with confidence that this was wrong or
> ok?
As usual with locks, re-entrancy, shared variables, shared memory, or
such. Some tools (e.g. coverity, coccinelle) can help checking that it
looks right but until now it is left to poor humans to check that it is
actually right.
For PPP callback, apart from ppp_close, it is safe because it can only
be called on the RX packet path or from timeouts, where having anything
else in the call stack than rx packet handler and timeout handler from
main() or tcpip thread is highly impossible.
So you either have to trust me, or to check yourself all possible call
stack leading to PPP callback being called. Luckily there are only a few
places where the callback is actually called and diving into all the
possible call stack is not a combinatorial explosion.
Basically, all possible call stack are:
ppp_close()
pcb->link_status_cb()
~timeout-handler~
pppoe_timeout()
pppoe_abort_connect()
ppp_link_failed()
pcb->link_status_cb()
~rx-packet-handler~
~udp-recv-callback~
pppol2tp_input();
pppol2tp_dispatch_control_packet()
pppol2tp_abort_connect()
ppp_link_failed()
pcb->link_status_cb()
~timeout-handler~
pppol2tp_timeout()
pppol2tp_abort_connect()
ppp_link_failed()
pcb->link_status_cb()
ppp_close()
ppp_link_terminated()
pcb->link_cb->disconnect() -> pppos_disconnect() or pppoe_disconnect() or
pppol2tp_disconnect()
ppp_link_end()
pcb->link_status_cb()
ppp_close()
lcp_lowerdown()
fsm_lowerdown()
f->callbacks->down() -> lcp_down()
link_down()
upper_layers_down()
protp->close -> lcp_close()
lcp_finished()
link_terminated()
ppp_link_terminated()
pcb->link_cb->disconnect() -> pppos_disconnect() or pppoe_disconnect() or
pppol2tp_disconnect()
ppp_link_end()
pcb->link_status_cb()
~rx-packet-handler~
ppp_input()
lcp_input()
fsm_input()
fsm_rtermack()
f->callbacks->finished() -> lcp_finished()
link_terminated()
ppp_link_terminated()
pcb->link_cb->disconnect() -> pppos_disconnect() or pppoe_disconnect() or
pppol2tp_disconnect()
ppp_link_end()
pcb->link_status_cb()
~rx-packet-handler~
ppp_input()
lcp_input()
fsm_input()
fsm_rtermreq() or fsm_rtermack()
f->callbacks->down() -> lcp_down()
link_down()
upper_layers_down()
protp->close -> lcp_close()
lcp_finished()
link_terminated()
ppp_link_terminated()
pcb->link_cb->disconnect() -> pppos_disconnect() or pppoe_disconnect() or
pppol2tp_disconnect()
ppp_link_end()
pcb->link_status_cb()
~timeout-handler~
LcpEchoTimeout()
LcpEchoCheck()
LcpSendEchoRequest()
LcpLinkFailure()
lcp_close()
lcp_finished()
link_terminated()
ppp_link_terminated()
pcb->link_cb->disconnect() -> pppos_disconnect() or pppoe_disconnect() or
pppol2tp_disconnect()
ppp_link_end()
pcb->link_status_cb()
~rx-packet-handler~
ppp_input()
protp->input() -> ipcp_input()
fsm_input()
fsm_rconfreq() or fsm_rconfack()
f->callbacks->up() -> ipcp_up()
sifup()
pcb->link_status_cb()
~rx-packet-handler~
ppp_input()
protp->input() -> ipv6cp_input()
fsm_input()
fsm_rconfreq() or fsm_rconfack()
f->callbacks->up() -> ipv6cp_up()
sif6up()
pcb->link_status_cb()
Sylvain
signature.asc
Description: Digital signature