Age | Commit message (Collapse) | Author |
|
Improve code readibility regarding state transitions when handling teardown event
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Fix setup race condition when proto shell is in teardown or setup_abort state when setup cmd is received.
Don't change the proto shell state and launch no setup in these conditions so the proto shell teardown
timeout handler does not kill the wrong processes and proto_shell_task_finish takes action on the correct
teardown state.
Don't launch a new setup action when already in setup state.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
When a shell script call is finished, proto_shell_task_finish( ) is
called to monitor processes, and determine the next interface state.
When the interface is brought up after a reconfiguration from dhcp
to static, it will first try to (erroneously?) reconfigure the
interface for DHCP. Upon doing this, it realises the mistake and
kills off the script by setting the state to S_SETUP_ABORT. This is
done by the proto_shell_handler. When this happens. the scripts
have 1 second to finish.
When this happens, S_SETUP_ABORT in proto_shell_task_finish( )
should issue a 'teardown' event to the shell script to deconfigure
the interface. It is here that things go wrong.
Shell scripts do not execute commands themselves, they should
finish as quick as possible. This is very race condition sensitive,
though; Instead of executing commands, they post messages to
execute commands. It is therefore possible that when the script
finishes, there's still commands to execute.
The dhcp protocol handler script, one of the scripts involved,
notifies netifd of changes by (indirectly) calling
proto_shell_update_link( ).
Once every so often, the dhcp script will not be finished in time,
and proto_shell_task_finish( ) cannot immediately continue,
because (in this case) the proto_task is still pending.
If this happens, the proto_shell_task_finish( ) will wait, but if
the proto_shell_update_link( ) notification is then received, it
will set the statemachine to idle, thus breaking the
S_SETUP_ABORT. Furthermore, an event is generated to indicate that
the network interface should be set to UP, rather than DOWN.
This confuses netifd, and the result is a stuck process that does
not respond to UCI calls anymore.
Note that a similar situation happens in the S_TEARDOWN state in
proto_shell_task_finish( ).
The fix, although a bit ugly, is to prevent the UP event from
being sent, and not to reset the state machine to idle in
proto_shell_update_link( ).
Signed-off-by: Michel Stam <m.stam@fugro.nl>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
otherwise teardown will not kill the process
if the interface was renewed before, which
set proto_task_killed
Signed-off-by: Ulrich Weber <uw@ocedo.com>
|
|
In commit e1ec2d2b9e7f7692a4ff88a0361bbcdbe34f0d99 (proto-shell: extend race condition avoidance), changes were made to prevent notifications from the proto handler during the proto shell states teardown and abort.
These changes unfortunately also prevent netifd from being notified of a number of proto handler events like notify_error, blok_restart and kill during the teardown state.
This introduces issues when the protocol is ppp, the authfail UCI parameter is set and authentication fails; the interface autostart parameter cannot be set to disabled while the ppp daemon keeps running as these proto handler notifications are dropped in the teardown state.
The attached patch blocks the notifications in the individual notification handlers which should not get notifications during teardown/abort state and allows notify_error/blok_restart/kill notifications during these states.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
In commit e1ec2d2b9e7f7692a4ff88a0361bbcdbe34f0d99 (proto-shell: extend race condition avoidance), changes were made to prevent notifications from the proto handler during teardown.
According to the comments, this was done to avoid the shell proto state being reset to S_IDLE and the interface hanging in IFS_TEARDOWN state.
These changes unfortunately also prevent netifd from being notified of the errors (proto_shell_notify_error) that actually caused the teardown.
This is for instance an issue when the protocol is ppp and e.g. PAP/CHAP authentication fails.
Since proto_shell_notify_error does not touch the proto state, it seems like a good idea to at least allow these notifications in teardown state.
The attached patch accomplishes this.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Joeri Barbarien <joeri.barbarien@gmail.com>
|
|
Disallow all notifications from the proto handler during teardown to
avoid the shell proto state being reset to S_IDLE and the interface
hanging in IFS_TEARDOWN state.
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
If a renew event arrives before the setup event has been processed, the
renew event needs to be deferred, otherwise interfaces can get stuck
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Fixes observed issue a tunnel interface is reported as up although device_claim failed
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
same interface
Preserve the device when keep == true
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
A link-down event clears l3_dev, so even if the proto handler does not
provide a new ifname, it still needs to be set explicitly
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Introduce a new device event "topology change" that gets signaled
by bridges on adding/removing members.
On "topology changes" the proto handlers are requested to "renew"
which is most useful for DHCP.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
The link layer state is monitored for a given interface; an interface will be setup
when both enabled and link layer active. Likewise an interface will be teared down
when either disabled or link layer down.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
|
|
This reverts commit 7335c3e19ea09674245dda3653d3f40705e68d6b.
|
|
Patch implements handling of link layer support on interface level.
An interface will go into the setup state when it's enabled and the
underlying link state is enabled. Vice versa an interface will go to
the down state when it's either disabled or underlying link state is
disabled.
Testing has been done with PPP, IPoE, tunnel and static interfaces
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
calloc_a
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
network.device status call after the protocol has been reconnected
|
|
static entries
|
|
|
|
|
|
|
|
|
|
update_link notifications
|
|
|
|
|
|
address/route removal on device or interface state changes
|
|
|
|
|
|
|
|
|
|
|
|
|