Fix DNS resolution across Wi-Fi, cellular, USB tethering, and VPNs

- Add NetworkManager rc-manager=file with dnsmasq caching and baseline /etc/resolv.conf, isolate usb0 routes/DNS in USB_Networking.nmconnection, enable loopback in boot runlevel, and guard 90-nm-cloud-setup.sh for OpenRC.
- Rewrite 50-dns-filter.sh to handle dhcp4/dhcp6/dns events, drop BusyBox-invalid logger -i and blocking gateway sleeps, gate IPv6 AAAA filtering on global unicast addresses and accept_ra, and fall back to 1.1.1.1/9.9.9.9 when no upstream DNS is advertised.
- Fix bananarchy-privacy-ctl musl parallel-query leaks (omit 127.0.0.1 in VPN mode, add sync-dns recovery, replace pkill/pgrep), add usb-tether DNS DNAT, rebuild and verify all four a1120 target images and release zips, and add scripts/test-dns-resolution.py.
This commit is contained in:
Luxferre committed 2026-11-18 13:12:11 +02:00
1 parent 6cedcf980c
commit 63ef9299fc
15 files changed
+764 -105

No files matched your search

@@ -0,0 +1,7 @@
# Keep NetworkManager's local caching/interface-scoped dnsmasq plugin, but
# manage /etc/resolv.conf atomically as a file instead of openresolv so
# signature mismatches never lock out DNS updates across reboots and network
# transitions do not fork resolvconf subscriber scripts.
[main]
dns=dnsmasq
rc-manager=file
+3
View File
@@ -0,0 +1,3 @@
# Generated by NetworkManager
nameserver 127.0.0.1
options edns0 trust-ad
+69 -32
View File
@@ -4,10 +4,16 @@
# with zero background CPU/battery drain when services are turned off.
set -u
STATE_DIR="/tmp/bananarchy-privacy"
STATE_DIR="${BANANARCHY_PRIVACY_STATE_DIR:-/tmp/bananarchy-privacy}"
USER_HOME="/home/user"
CONF_DIR="$USER_HOME/.config/bananarchy"
CONF_FILE="$CONF_DIR/privacy.conf"
CONF_DIR="${BANANARCHY_PRIVACY_CONF_DIR:-$USER_HOME/.config/bananarchy}"
CONF_FILE="${BANANARCHY_PRIVACY_CONF:-$CONF_DIR/privacy.conf}"
RESOLV_CONF="${BANANARCHY_RESOLV_CONF:-/etc/resolv.conf}"
NM_RESOLV_CONF="${BANANARCHY_NM_RESOLV_CONF:-/run/NetworkManager/resolv.conf}"
NM_NOSTUB_RESOLV_CONF="${BANANARCHY_NM_NOSTUB_RESOLV_CONF:-/run/NetworkManager/no-stub-resolv.conf}"
DURESS_FILE="${BANANARCHY_DURESS_FILE:-/tmp/bananarchy_duress_mode}"
SCREEN_LOCKED_FILE="${BANANARCHY_SCREEN_LOCKED_FILE:-/tmp/bananarchy_screen_locked}"
PRIVACY_NO_ROOT="${BANANARCHY_PRIVACY_NO_ROOT:-0}"
DEFAULT_GSWARP_OVPN="$USER_HOME/.config/gs-warp/client.ovpn"
if [ ! -f "$DEFAULT_GSWARP_OVPN" ] && [ -f "/etc/gs-warp/client.ovpn" ]; then
DEFAULT_GSWARP_OVPN="/etc/gs-warp/client.ovpn"
@@ -16,15 +22,18 @@ fi
CMD="${1:-status}"
# Block all operations except stop-all when in duress mode or screen locked
if [ "$CMD" != "stop-all" ] && [ "$CMD" != "_ovpn_up" ] && [ "$CMD" != "_tor_up" ]; then
if [ -e "/tmp/bananarchy_duress_mode" ] || [ -e "/tmp/bananarchy_screen_locked" ]; then
# Allow sync-dns while screen-locked (unless in duress) so Wi-Fi roam keeps tunnel DNS pinned
if [ "$CMD" != "stop-all" ] && [ "$CMD" != "_ovpn_up" ] && [ "$CMD" != "_tor_up" ] && [ "$CMD" != "sync-dns" ]; then
if [ -e "$DURESS_FILE" ] || [ -e "$SCREEN_LOCKED_FILE" ]; then
echo "Error: Privacy Center is unavailable." >&2
exit 1
fi
elif [ "$CMD" = "sync-dns" ] && [ -e "$DURESS_FILE" ]; then
exit 0
fi
# Escalate to root via doas or bananarchy-engmenu-exec if invoked as normal user
if [ "$(id -u)" -ne 0 ]; then
if [ "$PRIVACY_NO_ROOT" != "1" ] && [ "$(id -u)" -ne 0 ]; then
if command -v doas >/dev/null 2>&1; then
exec doas -n /usr/bin/bananarchy-privacy-ctl "$@"
elif [ -x /usr/bin/bananarchy-engmenu-exec ]; then
@@ -38,7 +47,11 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [ -n "${BANANARCHY_TEST_PATH_PREFIX:-}" ]; then
export PATH="${BANANARCHY_TEST_PATH_PREFIX}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
fi
mkdir -p "$STATE_DIR" "$CONF_DIR"
# Default configuration values
@@ -159,7 +172,7 @@ is_tor_active() {
return 0
fi
fi
pgrep -x tor >/dev/null 2>&1
pidof tor >/dev/null 2>&1
}
is_gswarp_active() {
@@ -203,6 +216,27 @@ is_wg_active() {
}
# Remove an iptables chain from a table and all references from hook chains
find_proc_pids() {
_pat="$1"
for _pdir in /proc/[0-9]*; do
[ -r "$_pdir/cmdline" ] || continue
_pid="${_pdir#/proc/}"
[ "$_pid" = "$$" ] && continue
_cmd="$(tr '\0' ' ' < "$_pdir/cmdline" 2>/dev/null || true)"
case "$_cmd" in
*$_pat*)
printf '%s\n' "$_pid"
;;
esac
done
}
kill_proc_matches() {
for _pid in $(find_proc_pids "$1"); do
kill "$_pid" 2>/dev/null || true
done
}
flush_and_delete_chain() {
tbl="$1"
chain="$2"
@@ -276,30 +310,26 @@ sync_dns_resolv() {
fi
if [ -n "$active_dns" ]; then
if [ ! -f "$STATE_DIR/resolv.conf.orig" ] && [ -f /etc/resolv.conf ]; then
cp -f /etc/resolv.conf "$STATE_DIR/resolv.conf.orig" 2>/dev/null || true
fi
{
echo "# Managed by bananarchy-privacy-ctl (tunneled DNS)"
echo "nameserver $active_dns"
if [ "$active_dns" != "1.1.1.1" ]; then
if [ "$active_dns" != "127.0.0.1" ] && [ "$active_dns" != "1.1.1.1" ]; then
echo "nameserver 1.1.1.1"
fi
if [ "$active_dns" != "127.0.0.1" ]; then
echo "nameserver 127.0.0.1"
fi
} > "$STATE_DIR/resolv.conf.new"
cp -f "$STATE_DIR/resolv.conf.new" /etc/resolv.conf 2>/dev/null || true
cp -f "$STATE_DIR/resolv.conf.new" "$RESOLV_CONF" 2>/dev/null || true
else
if [ -f "$STATE_DIR/resolv.conf.orig" ]; then
cp -f "$STATE_DIR/resolv.conf.orig" /etc/resolv.conf 2>/dev/null || true
rm -f "$STATE_DIR/resolv.conf.orig"
fi
if ! grep -q '^nameserver ' /etc/resolv.conf 2>/dev/null; then
rm -f "$STATE_DIR/resolv.conf.orig" "$STATE_DIR/resolv.conf.new" 2>/dev/null || true
if grep -q '^nameserver ' "$NM_RESOLV_CONF" 2>/dev/null; then
cp -f "$NM_RESOLV_CONF" "$RESOLV_CONF" 2>/dev/null || true
elif grep -q '^nameserver ' "$NM_NOSTUB_RESOLV_CONF" 2>/dev/null; then
cp -f "$NM_NOSTUB_RESOLV_CONF" "$RESOLV_CONF" 2>/dev/null || true
else
{
echo "# Generated by NetworkManager"
echo "nameserver 127.0.0.1"
echo "nameserver 1.1.1.1"
} > /etc/resolv.conf 2>/dev/null || true
echo "options edns0 trust-ad"
} > "$RESOLV_CONF" 2>/dev/null || true
fi
fi
}
@@ -490,7 +520,7 @@ stop_tor() {
kill "$(cat "$STATE_DIR/tor.pid" 2>/dev/null)" 2>/dev/null || true
rm -f "$STATE_DIR/tor.pid"
fi
pkill -x tor 2>/dev/null || true
killall -q tor 2>/dev/null || true
sync_dns_resolv
}
@@ -627,7 +657,7 @@ start_gswarp() {
-D -p 1194 -s "$GSWARP_SECRET" 2>/dev/null || \
/usr/bin/gs-netcat -D -p 1194 -s "$GSWARP_SECRET" 2>/dev/null
sleep 0.2
gs_pid="$(pgrep -f "gs-netcat -D -p 1194" | head -n 1 || true)"
gs_pid="$(find_proc_pids "gs-netcat -D -p 1194" | head -n 1 || true)"
if [ -z "$gs_pid" ]; then
echo "Error: failed to start gs-netcat for GS-Warp." >&2
return 1
@@ -673,8 +703,8 @@ stop_gswarp() {
rm -f "$pidf"
fi
done
pkill -f "gs-netcat -D -p 1194" 2>/dev/null || true
pkill -f "openvpn.*tun_gswarp" 2>/dev/null || true
kill_proc_matches "gs-netcat -D -p 1194"
kill_proc_matches "openvpn*tun_gswarp"
ip link del dev tun_gswarp 2>/dev/null || true
sync_base_vpn_rules
sync_dns_resolv
@@ -730,7 +760,7 @@ stop_ovpn() {
kill "$(cat "$STATE_DIR/ovpn.pid" 2>/dev/null)" 2>/dev/null || true
rm -f "$STATE_DIR/ovpn.pid"
fi
pkill -f "openvpn.*tun_ovpn" 2>/dev/null || true
kill_proc_matches "openvpn*tun_ovpn"
ip link del dev tun_ovpn 2>/dev/null || true
sync_base_vpn_rules
sync_dns_resolv
@@ -816,13 +846,13 @@ start_gsocket() {
-D -l -s "$GSOCKET_SECRET" -d 127.0.0.1 -p "$GSOCKET_PORT" 2>/dev/null || \
/usr/bin/gs-netcat -D -l -s "$GSOCKET_SECRET" -d 127.0.0.1 -p "$GSOCKET_PORT" 2>/dev/null
sleep 0.2
gs_pid="$(pgrep -f "gs-netcat -D -l -s .* -p $GSOCKET_PORT" | head -n 1 || true)"
gs_pid="$(find_proc_pids "gs-netcat -D -l -s *-p $GSOCKET_PORT" | head -n 1 || true)"
else
start-stop-daemon -S -g openvpn -x /usr/bin/gs-netcat -- \
-D -s "$GSOCKET_SECRET" -p "$GSOCKET_PORT" 2>/dev/null || \
/usr/bin/gs-netcat -D -s "$GSOCKET_SECRET" -p "$GSOCKET_PORT" 2>/dev/null
sleep 0.2
gs_pid="$(pgrep -f "gs-netcat -D -s .* -p $GSOCKET_PORT" | head -n 1 || true)"
gs_pid="$(find_proc_pids "gs-netcat -D -s *-p $GSOCKET_PORT" | head -n 1 || true)"
fi
if [ -z "$gs_pid" ]; then
@@ -839,8 +869,8 @@ stop_gsocket() {
kill "$(cat "$STATE_DIR/gsocket-port.pid" 2>/dev/null)" 2>/dev/null || true
rm -f "$STATE_DIR/gsocket-port.pid"
fi
pkill -f "gs-netcat -D -s .* -p $GSOCKET_PORT" 2>/dev/null || true
pkill -f "gs-netcat -D -l -s .* -p $GSOCKET_PORT" 2>/dev/null || true
kill_proc_matches "gs-netcat -D -s *-p $GSOCKET_PORT"
kill_proc_matches "gs-netcat -D -l -s *-p $GSOCKET_PORT"
}
# ==============================================================================
@@ -1168,5 +1198,12 @@ case "$CMD" in
stop_gsocket
stop_wg
;;
sync-dns)
if is_tor_active || is_gswarp_active || is_ovpn_active || is_wg_active; then
sync_dns_resolv
elif grep -q '^# Managed by bananarchy-privacy-ctl' "$RESOLV_CONF" 2>/dev/null; then
sync_dns_resolv
fi
;;
esac
exit 0
@@ -1,17 +1,28 @@
#!/bin/sh
# This dispatcher script configures NetworkManager's dnsmasq instance to
# restrict DNS responses based on the IP families supported by the Primary
# Connection, treating D-Bus null object paths ("/") as absent.
# Configure NetworkManager's dnsmasq instance and /etc/resolv.conf fallback state
# according to active upstream connectivity, treating "/" D-Bus paths as null.
set -eu
log_tag="nm-dns-filter"
dbus="busctl --json=short"
jq=gojq
dbus="${BANANARCHY_BUSCTL:-busctl --json=short}"
jq="${BANANARCHY_JQ:-gojq}"
ip_cmd="${BANANARCHY_IP_CMD:-ip}"
logger_cmd="${BANANARCHY_LOGGER_CMD:-logger}"
privacy_ctl="${BANANARCHY_PRIVACY_CTL:-/usr/bin/bananarchy-privacy-ctl}"
resolv_conf="${BANANARCHY_RESOLV_CONF:-/etc/resolv.conf}"
nm_resolv_conf="${BANANARCHY_NM_RESOLV_CONF:-/run/NetworkManager/resolv.conf}"
nm_nostub_resolv_conf="${BANANARCHY_NM_NOSTUB_RESOLV_CONF:-/run/NetworkManager/no-stub-resolv.conf}"
accept_ra_dir="${BANANARCHY_IPV6_CONF_DIR:-/proc/sys/net/ipv6/conf}"
iface="${1:-}"
action="${2:-}"
get_gateway() {
log_msg() {
"$logger_cmd" -t "$log_tag" "$*" 2>/dev/null || true
}
get_ipcfg_path() {
_conn="$1"
_ver="$2"
@@ -25,39 +36,74 @@ get_gateway() {
echo ""
return 0
fi
logger -i -t "$log_tag" "pri conn ip$_ver config path: $_ipcfg"
log_msg "pri conn ip$_ver config path: $_ipcfg"
echo "$_ipcfg"
}
_attempt=0
_gateway=""
while [ "$_attempt" -lt 5 ]; do
_gateway="$($dbus get-property \
org.freedesktop.NetworkManager \
"$_ipcfg" \
"org.freedesktop.NetworkManager.IP${_ver}Config" \
Gateway 2>/dev/null | $jq -r '.data // empty' 2>/dev/null || true)"
if [ -n "$_gateway" ]; then
break
fi
sleep 1
_attempt=$(( _attempt + 1 ))
done
get_gateway() {
_ipcfg="$1"
_ver="$2"
logger -i -t "$log_tag" "ip$_ver gateway: $_gateway"
if [ -z "$_ipcfg" ] || [ "$_ipcfg" = "/" ]; then
echo ""
return 0
fi
_gateway="$($dbus get-property \
org.freedesktop.NetworkManager \
"$_ipcfg" \
"org.freedesktop.NetworkManager.IP${_ver}Config" \
Gateway 2>/dev/null | $jq -r '.data // empty' 2>/dev/null || true)"
log_msg "ip$_ver gateway: $_gateway"
echo "$_gateway"
}
dnsmasq_running() {
$dbus call org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus \
NameHasOwner s org.freedesktop.NetworkManager.dnsmasq 2>/dev/null | \
$jq -r '.data[0] // empty' 2>/dev/null | grep -qx 'true'
}
set_filter() {
_type="$1"
_val="$2"
logger -i -t "$log_tag" "setting $_type filter to '$_val'"
log_msg "setting $_type filter to '$_val'"
$dbus call org.freedesktop.NetworkManager.dnsmasq \
/uk/org/thekelleys/dnsmasq \
org.freedesktop.NetworkManager.dnsmasq \
"SetFilter$_type" b "$_val"
"SetFilter$_type" b "$_val" >/dev/null 2>&1 || true
}
sync_privacy_or_fallback_resolv() {
_has_v4="$1"
if [ -x "$privacy_ctl" ]; then
"$privacy_ctl" sync-dns >/dev/null 2>&1 || true
fi
if grep -q '^# Managed by bananarchy-privacy-ctl' "$resolv_conf" 2>/dev/null; then
return 0
fi
if [ "$_has_v4" = "1" ] && ! grep -q '^nameserver ' "$nm_nostub_resolv_conf" 2>/dev/null; then
log_msg "no upstream DNS advertised; writing public fallback resolvers"
{
echo "# Generated by NetworkManager"
echo "nameserver 1.1.1.1"
echo "nameserver 9.9.9.9"
} > "$resolv_conf" 2>/dev/null || true
elif grep -q '^nameserver ' "$nm_resolv_conf" 2>/dev/null && \
grep -q '^nameserver 1\.1\.1\.1$' "$resolv_conf" 2>/dev/null && \
grep -q '^nameserver 127\.0\.0\.1$' "$nm_resolv_conf" 2>/dev/null; then
cp -f "$nm_resolv_conf" "$resolv_conf" 2>/dev/null || true
fi
}
case "$action" in
"up" | "down" | "reapply")
"up" | "down" | "reapply" | "dhcp4-change" | "dhcp6-change" | "dns-change")
;;
*)
exit 0
@@ -70,40 +116,71 @@ primaryConn="$($dbus get-property \
org.freedesktop.NetworkManager \
PrimaryConnection 2>/dev/null | $jq -r '.data // empty' 2>/dev/null || true)"
if [ -z "$primaryConn" ] || [ "$primaryConn" = "/" ]; then
ip4cfg=""
ip6cfg=""
ip4gateway=""
ip6gateway=""
if [ -n "$primaryConn" ] && [ "$primaryConn" != "/" ]; then
ip4cfg="$(get_ipcfg_path "$primaryConn" 4)"
ip6cfg="$(get_ipcfg_path "$primaryConn" 6)"
ip4gateway="$(get_gateway "$ip4cfg" 4)"
ip6gateway="$(get_gateway "$ip6cfg" 6)"
fi
has_ipv4=0
if [ -n "$ip4gateway" ] && [ "$ip4gateway" != "0.0.0.0" ]; then
has_ipv4=1
elif "$ip_cmd" -4 route show default 2>/dev/null | grep -q .; then
has_ipv4=1
elif "$ip_cmd" -4 -o addr show scope global 2>/dev/null | \
awk '$2 != "usb0" && $2 != "lo" { found=1 } END { exit !found }'; then
has_ipv4=1
fi
has_ipv6=0
v6_gw_ok=0
if [ -n "$ip6gateway" ] && [ "$ip6gateway" != "::" ]; then
v6_gw_ok=1
elif "$ip_cmd" -6 route show default 2>/dev/null | grep -q .; then
v6_gw_ok=1
fi
if [ "$v6_gw_ok" = "1" ] && \
"$ip_cmd" -6 -o addr show scope global 2>/dev/null | grep -Eq 'inet6 [23][0-9a-fA-F]{0,3}:'; then
has_ipv6=1
v6_def_dev="$("$ip_cmd" -6 route show default 2>/dev/null | awk '{ for (i = 1; i <= NF; i++) if ($i == "dev") { print $(i + 1); exit } }')"
if [ "$v6_def_dev" = "wlan0" ] || { [ -z "$v6_def_dev" ] && [ "$iface" = "wlan0" ]; }; then
if [ -r "$accept_ra_dir/wlan0/accept_ra" ]; then
IFS= read -r wlan_ra < "$accept_ra_dir/wlan0/accept_ra" 2>/dev/null || wlan_ra=""
if [ "$wlan_ra" = "0" ]; then
has_ipv6=0
fi
fi
fi
fi
sync_privacy_or_fallback_resolv "$has_ipv4"
if ! dnsmasq_running; then
exit 0
fi
ip4gateway="$(get_gateway "$primaryConn" 4)"
ip6gateway="$(get_gateway "$primaryConn" 6)"
if [ -z "$ip4gateway" ] && [ -z "$ip6gateway" ]; then
logger -i -t "$log_tag" "no gateways for primary connection"
logger -i -t "$log_tag" "disabling IPv4 filter"
set_filter A false
logger -i -t "$log_tag" "disabling IPv6 filter"
set_filter AAAA false
else
if [ -z "$ip4gateway" ]; then
logger -i -t "$log_tag" "enabling IPv4 filter"
set_filter A true
else
logger -i -t "$log_tag" "disabling IPv4 filter"
set_filter A false
fi
if [ -z "$ip6gateway" ]; then
logger -i -t "$log_tag" "enabling IPv6 filter"
set_filter AAAA true
else
logger -i -t "$log_tag" "disabling IPv6 filter"
set_filter AAAA false
fi
filter_a="false"
filter_aaaa="false"
if [ "$has_ipv4" = "0" ] && [ "$has_ipv6" = "1" ] && { [ -z "$ip4cfg" ] || [ "$ip4cfg" = "/" ]; }; then
filter_a="true"
fi
if [ "$has_ipv4" = "1" ] && [ "$has_ipv6" = "0" ]; then
filter_aaaa="true"
fi
set_filter A "$filter_a"
set_filter AAAA "$filter_aaaa"
$dbus call \
org.freedesktop.NetworkManager.dnsmasq \
/uk/org/thekelleys/dnsmasq org.freedesktop.NetworkManager.dnsmasq \
ClearCache
/uk/org/thekelleys/dnsmasq \
org.freedesktop.NetworkManager.dnsmasq \
ClearCache >/dev/null 2>&1 || true
logger -i -t "$log_tag" "dns filter config applied successfully"
log_msg "dns filter config applied successfully"
@@ -0,0 +1,19 @@
#!/bin/sh
command -v systemctl >/dev/null 2>&1 || exit 0
case "$2" in
pre-up)
NO_BLOCK=
;;
dhcp4-change)
NO_BLOCK=--no-block
;;
*)
exit 0
;;
esac
if systemctl -q is-enabled nm-cloud-setup.service; then
exec systemctl $NO_BLOCK restart nm-cloud-setup.service
fi
@@ -0,0 +1,19 @@
[connection]
id=USB Networking
uuid=83bd1823-feca-4c2b-9205-4b83dc792e1f
type=ethernet
interface-name=usb0
[ethernet]
[ipv4]
address1=172.16.42.1/16
method=manual
never-default=true
ignore-auto-dns=true
[ipv6]
addr-gen-mode=default
method=ignore
[proxy]
@@ -1310,8 +1310,13 @@ PY
on)
ensure_usb_network_gadget
sysctl -w net.ipv4.ip_forward=1 >/dev/null 2>&1 || true
sysctl -w net.ipv4.conf.usb0.route_localnet=1 >/dev/null 2>&1 || true
nft add table ip nat 2>/dev/null || true
nft 'add chain ip nat prerouting { type nat hook prerouting priority -100 ; }' 2>/dev/null || true
nft 'add chain ip nat postrouting { type nat hook postrouting priority 100 ; }' 2>/dev/null || true
nft flush chain ip nat prerouting 2>/dev/null || true
nft add rule ip nat prerouting iifname "usb*" udp dport 53 dnat to 127.0.0.1:53 2>/dev/null || true
nft add rule ip nat prerouting iifname "usb*" tcp dport 53 dnat to 127.0.0.1:53 2>/dev/null || true
nft add rule ip nat postrouting oifname "wwan*" masquerade 2>/dev/null || true
nft add rule ip nat postrouting oifname "wlan*" masquerade 2>/dev/null || true
ip addr show dev usb0 2>/dev/null | grep -q "172.16.42.1" || ip addr add 172.16.42.1/16 dev usb0 2>/dev/null || true
@@ -1320,6 +1325,7 @@ PY
;;
off)
ensure_usb_network_gadget
sysctl -w net.ipv4.conf.usb0.route_localnet=0 >/dev/null 2>&1 || true
sysctl -w net.ipv4.ip_forward=0 >/dev/null 2>&1 || true
nft delete table ip nat 2>/dev/null || true
nmcli connection delete USBNetworkShare >/dev/null 2>&1 || true