Skip to content

Commit dea159a

Browse files
committed
Introduce HIDE_LOCAL_IPV6 which removes all local ipv6 addressed from display
1 parent 1ee5216 commit dea159a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/bsp/common/etc/default/armbian-motd.dpkg-dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
MOTD_DISABLE="clear"
88
ONE_WIRE=""
99
HIDE_IP_PATTERN="^dummy0|^lo|^docker|^hassio|^br-|^veth|^vnet|^virbr"
10+
HIDE_LOCAL_IPV6="true"
1011
PRIMARY_INTERFACE="$(ip route | grep '^default' | sed "s/.*dev //" | cut -d" " -f1)"
1112
PRIMARY_DIRECTION="rx"
1213
STORAGE=/dev/sda1

packages/bsp/common/etc/update-motd.d/10-armbian-header

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
THIS_SCRIPT="header"
1313
MOTD_DISABLE=""
1414
HIDE_IP_PATTERN="^dummy0|^lo|^docker|^hassio|^br-|^veth|^vnet|^virbr"
15+
HIDE_LOCAL_IPV6="true"
1516

1617
# Read image configuration
1718
[[ -f /etc/armbian-image-release ]] && . /etc/armbian-image-release
@@ -85,6 +86,9 @@ function get_ip_addresses() {
8586
ipv4=$(echo "${ipv4}" | cut -d'/' -f1)
8687
ipv4=$(echo "${ipv4}" | awk '!x[$0]++')
8788
ipv6=$(ip -6 addr show dev "${intf}")
89+
if [[ "${HIDE_LOCAL_IPV6}" == true ]]; then
90+
ipv6=$(ip -6 addr show dev "${intf}" | grep -v fe80)
91+
fi
8892
ipv6=$(echo "${ipv6}" | grep -v "${intf}:avahi")
8993
ipv6=$(echo "${ipv6}" | awk '/inet6/ {print $2}')
9094
ipv6=$(echo "${ipv6}" | cut -d'/' -f1)
@@ -206,9 +210,11 @@ if [[ -n "${wan_ip6_address}" && "${ipv6s}" == *${wan_ip6_address}* ]]; then
206210
ipv6s=$(echo $ipv6s | sed "s/"${wan_ip6_address}"//g" | xargs )
207211
fi
208212

209-
if [[ -n ${ipv6s} ]]; then
213+
if [[ -n ${ipv6s} || -n ${wan_ip6_address} ]]; then
210214
all_ip6_address=" IPv6: "
211-
all_ip6_address+="\x1B[96m${ipv6s// /, }\x1B[0m "
215+
if [[ -n ${ipv6s} ]]; then
216+
all_ip6_address+="\x1B[96m${ipv6s// /, }\x1B[0m "
217+
fi
212218
if [[ -n ${wan_ip6_address} ]]; then
213219
all_ip6_address+="\x1B[93m(WAN)\x1B[0m \x1B[95m${wan_ip6_address}\x1B[0m "
214220
fi

0 commit comments

Comments
 (0)