Age | Commit message (Collapse) | Author |
|
In case the keep flag is set in proto_shell_update_link no interface
update event is triggered when IPv4/6 addresses/routes/... are updated
as the proto_event callback is not called due to keep being set.
Unconditionally call the proto_event callback handler in proto_shell_update_link
but let the proto_event callback handler; in this case interface_proto_event_cb,
decide which actions need to be taken dependant on the interface state.
In case the interface is already in the up state trigger an update event
only if the interface updated flag actually indicates either an IP address/
route/data change; before interface update events were actually sent wihtout
any parameter change.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Export the config parameter "no-proto-task" as a proto flag so it's available for other
other netifd modules
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Commit c6858766 added interface teardown support on layer 3 device link loss
mainly for shell protocols who have no proto task like xl2tp. However for
shell protocols having a proto task it is not always the correct action to
teardown the interface; as an example the PPP daemon can be put into
persist state trying to re-establish the link via a hold-off mechanism
if layer 3 link loss is detected.
Therefore shell handlers can enable via TEARDOWN_ON_L3_LINK_DOWN a proto
flag which will teardown the interface when layer 3 link loss is detected
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
This is mainly for protocols with no_proto_task set. L2TP with xl2tpd
is such a case and the issue this commit tries to address is that xl2tpd
could fail redialing the connection (segfault or abort) without the
notice of netifd causing the concerned interface being left down.
This patch solves it by allowing users to configure an timeout value
instructing netifd to check if the interface is in up state after its
last attempt to setup it and try again if that is not the case.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
Signed-off-by: Steven Barth <steven@midlink.org>
|
|
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Adds a new config parameter "no-proto-task" for noting that no
proto_task will be running for this protocol type. This is required
since then change in commit "d0dcf74 proto-shell: retry setup if the
proto handler script quits without changing the state or starting a
process".
The change is mainly for protocols like xl2tpd in which control commands
are sent to another daemon xl2tpd to start L2TP negotiation and pppd
process who is not under netifd's control as proto_task as is the case
in other ppp related protocols like pppoe, pptp, etc.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
the state or starting a process
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
Adds interface last error support which preserves the last reported
error reported by the protocol handler till the interface is up;
e.g. survives network reload and interface restarts.
This is mainly usefull for tracking down why an interface fails
to establish; eg auth failure/traffic limit for PPP interfaces
Protocol handlers register last error support by setting lasterror=1
in the proto_init function
Signed-off-by: Johan Peeters <johan.peeters111@gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
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
|
|
|
|
|
|
|
|
|