networkmanager: ifupdown: add a setting to disable this feature
The 'ifupdown' script does not allow to disconnect a network interface on purpose. Once it is down, the script will reconnect it again. This commit adds a configuration section inside 'NetworkManager.conf' to be able to manage this behavior. By default, it is disabled. https://onedigi.atlassian.net/browse/DEL-8342 Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
parent
0f1dfc3823
commit
5eb0f07906
|
|
@ -12,3 +12,6 @@ unmanaged-devices=interface-name:p2p*;interface-name:wlan1
|
||||||
|
|
||||||
[device]
|
[device]
|
||||||
wifi.scan-rand-mac-address=no
|
wifi.scan-rand-mac-address=no
|
||||||
|
|
||||||
|
[digi-recovery]
|
||||||
|
ifdownup=false
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright 2019, Digi International Inc.
|
# Copyright 2019-2023, Digi International Inc.
|
||||||
#
|
#
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
|
@ -26,6 +26,16 @@ log() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
log info "device-connectivity-change detected on interface ${DEVICE_IP_IFACE}"
|
# $1 = file, $2 = section, $3 = parameter
|
||||||
nmcli device disconnect "${DEVICE_IP_IFACE}"
|
get_cfg_param() {
|
||||||
nmcli connection up "${CONNECTION_ID}"
|
sed -nr "/^\[${2}\]/ { :l /^${3}[ ]*=/ { s/[^=]*=[ ]*//; p; q;}; n; b l;}" "${1}" | tr '[:upper:]' '[:lower:]'
|
||||||
|
}
|
||||||
|
|
||||||
|
ifdownup=$(get_cfg_param /etc/NetworkManager/NetworkManager.conf digi-recovery ifdownup)
|
||||||
|
[ -z "${ifdownup}" ] && ifdownup="false"
|
||||||
|
|
||||||
|
if [ "${ifdownup}" = "true" ] || [ "${ifdownup}" = "yes" ]; then
|
||||||
|
log info "device-connectivity-change detected on interface ${DEVICE_IP_IFACE}"
|
||||||
|
nmcli device disconnect "${DEVICE_IP_IFACE}"
|
||||||
|
nmcli connection up "${CONNECTION_ID}"
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue