mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
New version, new tarball, new man page. This corrects several oversights of the 2.3.10 IPv6 update.
Now there is an -x option for -i that will show the additioanl IPv6 address data for scope global, temporary, and site. Also a fallback for unhandled scope: unknown. If the tool 'ip' is used, it will filter out the deprecated temp site/global addresses, ifconfig tool does not appear to offer this option. Also changed is that now ipv6 address always shows, it's not an -x option. Probably about time to start rolling out ip v6 data to users now that ip v6 is starting, slowly, to be used more. Another small change, the link address for ipv6 is changed from ip-v6: to ip-v6-link so that it's more clear which IP v6 address it is. The last commit had a significant logic error in it that did not distinguish between the link address, which is what should have only shown, and the remaining possible addresses. I've tried to get a basic bsd support, but it's difficult to know the variants of ifconfig output syntax
This commit is contained in:
parent
c1883d40a6
commit
f7fcee483c
179
inxi
179
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.3.10
|
#### Version: 2.3.11
|
||||||
#### Date: 2017-05-31
|
#### Date: 2017-05-31
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -3131,7 +3131,7 @@ show_options()
|
||||||
print_lines_basic "2" "-D" "Hdd temp with disk data if you have hddtemp installed, if you are root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer) Example:^<username>^ALL^=^NOPASSWD:^/usr/sbin/hddtemp"
|
print_lines_basic "2" "-D" "Hdd temp with disk data if you have hddtemp installed, if you are root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer) Example:^<username>^ALL^=^NOPASSWD:^/usr/sbin/hddtemp"
|
||||||
print_lines_basic "2" "-G" "Direct rendering status for Graphics (in X)."
|
print_lines_basic "2" "-G" "Direct rendering status for Graphics (in X)."
|
||||||
print_lines_basic "2" "-G" "(for single gpu, nvidia driver) screen number gpu is running on."
|
print_lines_basic "2" "-G" "(for single gpu, nvidia driver) screen number gpu is running on."
|
||||||
print_lines_basic "2" "-i" "IPv6 as well for LAN interface (IF) devices."
|
print_lines_basic "2" "-i" "For IPv6, show additional IP v6 scope addresses: Global, Site, Temporary, Unknown."
|
||||||
print_lines_basic "2" "-I" "System GCC, default. With -xx, also show other installed GCC versions. If running in console, not in IRC client, shows shell version number, if detected. Init/RC Type and runlevel (if available)."
|
print_lines_basic "2" "-I" "System GCC, default. With -xx, also show other installed GCC versions. If running in console, not in IRC client, shows shell version number, if detected. Init/RC Type and runlevel (if available)."
|
||||||
print_lines_basic "2" "-m" "Part number; Max memory module size (if available)."
|
print_lines_basic "2" "-m" "Part number; Max memory module size (if available)."
|
||||||
print_lines_basic "2" "-N -A" "Version/port(s)/driver version (if available) for Network/Audio;"
|
print_lines_basic "2" "-N -A" "Version/port(s)/driver version (if available) for Network/Audio;"
|
||||||
|
@ -8093,7 +8093,9 @@ get_networking_local_ip_data()
|
||||||
gawk -v ipTool=$ip_tool -v bsdType=$BSD_TYPE '
|
gawk -v ipTool=$ip_tool -v bsdType=$BSD_TYPE '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
|
addIpV6 = ""
|
||||||
interface=""
|
interface=""
|
||||||
|
ipExtV6=""
|
||||||
ifIp=""
|
ifIp=""
|
||||||
ifIpV6=""
|
ifIpV6=""
|
||||||
ifMask=""
|
ifMask=""
|
||||||
|
@ -8116,10 +8118,12 @@ get_networking_local_ip_data()
|
||||||
ifIp=""
|
ifIp=""
|
||||||
ifIpV6=""
|
ifIpV6=""
|
||||||
ifMask=""
|
ifMask=""
|
||||||
|
ipExtV6=""
|
||||||
aInterfaces[interface]++
|
aInterfaces[interface]++
|
||||||
|
|
||||||
while (getline && !/^$/ ) {
|
while (getline && !/^$/ ) {
|
||||||
addIpV6 = ""
|
addIpV6 = ""
|
||||||
|
addExtV6 = ""
|
||||||
if ( ipTool == "ifconfig" ) {
|
if ( ipTool == "ifconfig" ) {
|
||||||
if (/inet addr:/) {
|
if (/inet addr:/) {
|
||||||
ifIp = gensub( /addr:([0-9\.]+)/, "\\1", "g", $2 )
|
ifIp = gensub( /addr:([0-9\.]+)/, "\\1", "g", $2 )
|
||||||
|
@ -8128,7 +8132,20 @@ get_networking_local_ip_data()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (/inet6 addr:/) {
|
if (/inet6 addr:/) {
|
||||||
addIpV6 = $3
|
# ^fe80:
|
||||||
|
if ( $2 ~ /^fe80/) {
|
||||||
|
addIpV6 = $2
|
||||||
|
}
|
||||||
|
else if ( $0 ~ /<global>/ || $0 ~ /Scope:Global/ ) {
|
||||||
|
addExtV6 = "sg~" $2
|
||||||
|
}
|
||||||
|
# ^fec0:
|
||||||
|
else if ( $0 ~ /<site>/ || $0 ~ /Scope:Site/ || $2 ~ /^fec0/ || $2 ~ /^fc00/) {
|
||||||
|
addExtV6 = "ss~" $2
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addExtV6 = "su~" $2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( bsdType == "bsd" ) {
|
if ( bsdType == "bsd" ) {
|
||||||
if ( $1 == "inet" ) {
|
if ( $1 == "inet" ) {
|
||||||
|
@ -8137,9 +8154,23 @@ get_networking_local_ip_data()
|
||||||
ifMask = $4
|
ifMask = $4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $0 ~ /inet6.*%/ ) {
|
if ( $0 ~ /inet6.*%/ ){
|
||||||
sub(/%.*/,"",$2)
|
if ( $2 ~ /^fe80/ ) {
|
||||||
addIpV6 = $2
|
sub(/%.*/,"",$2)
|
||||||
|
addIpV6 = $2
|
||||||
|
}
|
||||||
|
else if ( $2 ~ /^fec0/ || $2 ~ /^fc00/ ) {
|
||||||
|
sub(/%.*/,"",$2)
|
||||||
|
addExtV6 = "ss~" $2
|
||||||
|
}
|
||||||
|
# else if ( $2 ~ /^2/ ) {
|
||||||
|
# sub(/%.*/,"",$2)
|
||||||
|
# addExtV6 = "sg~" $2
|
||||||
|
# }
|
||||||
|
else {
|
||||||
|
sub(/%.*/,"",$2)
|
||||||
|
addExtV6 = "sg~" $2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8147,25 +8178,47 @@ get_networking_local_ip_data()
|
||||||
if ( $1 == "inet" ) {
|
if ( $1 == "inet" ) {
|
||||||
ifIp = $2
|
ifIp = $2
|
||||||
}
|
}
|
||||||
if ( $1 == "inet6" && $0 !~ / temporary/) { # filter out IPv6 privacy addresses
|
if ( $1 == "inet6" ){
|
||||||
addIpV6 = $2
|
# filter out deprecated IPv6 privacy addresses
|
||||||
|
if ( $0 ~ / temporary deprecated/) {
|
||||||
|
addExtV6 = ""
|
||||||
|
}
|
||||||
|
else if ( $0 ~ /scope global temporary/) {
|
||||||
|
addExtV6 = "st~" $2
|
||||||
|
}
|
||||||
|
else if ( $0 ~ /scope global/) {
|
||||||
|
addExtV6 = "sg~" $2
|
||||||
|
}
|
||||||
|
# ^fe80:
|
||||||
|
else if ( $2 ~ /^fe80/ || $0 ~ /scope link/) {
|
||||||
|
addIpV6 = $2
|
||||||
|
}
|
||||||
|
# ^fec0:
|
||||||
|
else if ( $2 ~ /^fec0/ || $2 ~ /^fc00/ || $0 ~ /scope site/) {
|
||||||
|
addExtV6 = "ss~" $2
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addExtV6 = "su~" $2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( addIpV6 != "" ) {
|
||||||
if ( addIpV6 != "" && addIpV6 !~ /^fe80:/ ) { # filter out IPv6 link-local
|
|
||||||
if ( ifIpV6 == "" ) {
|
if ( ifIpV6 == "" ) {
|
||||||
ifIpV6 = addIpV6
|
ifIpV6 = addIpV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ifIpV6 = ifIpV6 "," addIpV6
|
ifIpV6 = ifIpV6 "^" addIpV6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( ipExtV6 != "" ){
|
||||||
|
ipExtV6 = ipExtV6 "^" addExtV6
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# slice off the digits that are sometimes tacked to the end of the address,
|
# slice off the digits that are sometimes tacked to the end of the address,
|
||||||
# like: /64 or /24
|
# like: /64 or /24
|
||||||
sub(/\/[0-9]+/, "", ifIp)
|
sub(/\/[0-9]+/, "", ifIp)
|
||||||
gsub(/\/[0-9]+/, "", ifIpV6)
|
gsub(/\/[0-9]+/, "", ifIpV6) #
|
||||||
ipAddresses[interface] = ifIp "," ifMask "," ifIpV6
|
ipAddresses[interface] = ifIp "," ifMask "," ifIpV6 "," ipExtV6
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
j=0
|
j=0
|
||||||
|
@ -13557,61 +13610,87 @@ print_networking_ip_data()
|
||||||
if [[ -n ${a_interfaces_working[1]} ]];then
|
if [[ -n ${a_interfaces_working[1]} ]];then
|
||||||
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||||
if_ip=$FILTER_STRING
|
if_ip=$FILTER_STRING
|
||||||
|
# we could filter each ipv6 extra address, but that can lead to
|
||||||
|
# a LOT of pointless output depending on the ip tool used and how
|
||||||
|
# many deprecated addresses there are, so just delete the values
|
||||||
|
a_interfaces_working[4]=''
|
||||||
else
|
else
|
||||||
if_ip=${a_interfaces_working[1]}
|
if_ip=${a_interfaces_working[1]}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if_ip_string=" ${C1}ip-v4$SEP3${C2} $if_ip"
|
if_ip_string=" ${C1}ip-v4$SEP3${C2} $if_ip"
|
||||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
# this is now going to always show as IPv6 starts to really be used globally
|
||||||
if [[ -n ${a_interfaces_working[3]} ]];then
|
if [[ -n ${a_interfaces_working[3]} ]];then
|
||||||
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||||
if_ipv6=$FILTER_STRING
|
if_ipv6=$FILTER_STRING
|
||||||
else
|
else
|
||||||
# may be more than one address here; get them all as one string
|
# may be more than one address here; get them all as one string
|
||||||
if_ipv6=${a_interfaces_working[@]:3}
|
# but this is only the LINK scope, not Site or Global or Temporary
|
||||||
fi
|
if_ipv6=${a_interfaces_working[3]/^/, }
|
||||||
fi
|
fi
|
||||||
if_ipv6_string=" ${C1}ip-v6$SEP3${C2} $if_ipv6"
|
|
||||||
fi
|
fi
|
||||||
|
if_ipv6_string=" ${C1}ip-v6-link$SEP3${C2} $if_ipv6"
|
||||||
fi
|
fi
|
||||||
if [[ -n ${a_interfaces_working[0]} ]];then
|
if [[ -n ${a_interfaces_working[0]} ]];then
|
||||||
if_id=${a_interfaces_working[0]}
|
if_id=${a_interfaces_working[0]}
|
||||||
fi
|
fi
|
||||||
if_string="${C1}IF$SEP3${C2} $if_id$if_ip_string$if_ipv6_string "
|
if_string="${C1}IF$SEP3${C2} $if_id$if_ip_string$if_ipv6_string "
|
||||||
# first line, print wan on its own line if too long
|
# first line, print wan on its own line, then the next item
|
||||||
if [[ $i -eq 0 ]];then
|
if [[ $i -eq 0 ]];then
|
||||||
if [[ $( calculate_line_length "$wan_ip_data$if_string" ) -gt $COLS_INNER ]];then
|
full_string=$( create_print_line " " "$wan_ip_data" )
|
||||||
full_string=$( create_print_line " " "$wan_ip_data" )
|
print_screen_output "$full_string"
|
||||||
print_screen_output "$full_string"
|
wan_ip_data=''
|
||||||
wan_ip_data=''
|
fi
|
||||||
full_string=$( create_print_line " " "$if_string" )
|
full_string=$( create_print_line " " "$if_string" )
|
||||||
print_screen_output "$full_string"
|
print_screen_output "$full_string"
|
||||||
if_string=''
|
if_string=''
|
||||||
else
|
if [[ ${a_interfaces_working[4]} != '' ]];then
|
||||||
full_string=$( create_print_line " " "$wan_ip_data$if_string" )
|
IFS="^"
|
||||||
print_screen_output "$full_string"
|
a_ipv6_ext=(${a_interfaces_working[4]})
|
||||||
wan_ip_data=''
|
IFS="$ORIGINAL_IFS"
|
||||||
if_string=''
|
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||||
fi
|
for (( j=0; j < ${#a_ipv6_ext[@]}; j++ ))
|
||||||
else
|
do
|
||||||
if [[ $( calculate_line_length "$if_string_holding$if_string" ) -gt $COLS_INNER ]];then
|
print_ipv6_ext_line ${a_ipv6_ext[j]}
|
||||||
if [[ -n $if_string_holding ]];then
|
done
|
||||||
full_string=$( create_print_line " " "$if_string_holding" )
|
|
||||||
print_screen_output "$full_string"
|
|
||||||
fi
|
|
||||||
if_string_holding="$if_string"
|
|
||||||
else
|
|
||||||
if_string_holding="$if_string_holding$if_string"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
((i++))
|
((i++))
|
||||||
done
|
done
|
||||||
|
|
||||||
# then print out anything not printed already
|
eval $LOGFE
|
||||||
if [[ -n $if_string_holding ]];then
|
}
|
||||||
full_string=$( create_print_line " " "$if_string_holding" )
|
print_ipv6_ext_line()
|
||||||
print_screen_output "$full_string"
|
{
|
||||||
|
eval $LOGFS
|
||||||
|
|
||||||
|
local full_string='' ip_starter='' ip_data='' ip=''
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
sg~*)
|
||||||
|
ip_starter="ip-v6-global"
|
||||||
|
ip=${1/sg~/}
|
||||||
|
;;
|
||||||
|
ss~*)
|
||||||
|
ip_starter="ip-v6-site"
|
||||||
|
ip=${1/ss~/}
|
||||||
|
;;
|
||||||
|
st~*)
|
||||||
|
ip_starter="ip-v6-temporary"
|
||||||
|
ip=${1/st~/}
|
||||||
|
;;
|
||||||
|
su~*)
|
||||||
|
ip_starter="ip-v6-unknown"
|
||||||
|
ip=${1/su~/}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||||
|
ip=$FILTER_STRING
|
||||||
fi
|
fi
|
||||||
|
ip_data="${C1}$ip_starter$SEP3${C2} $ip"
|
||||||
|
full_string=$( create_print_line " " "$ip_data" )
|
||||||
|
print_screen_output "$full_string"
|
||||||
|
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
inxi.1
24
inxi.1
|
@ -1,4 +1,4 @@
|
||||||
.TH INXI 1 "2017\-01\-04" inxi "inxi manual"
|
.TH INXI 1 "2017\-05\-31" inxi "inxi manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
inxi \- Command line system information script for console and IRC
|
inxi \- Command line system information script for console and IRC
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -141,9 +141,27 @@ The help menu, plus developer options. Do not use dev options in normal
|
||||||
operation!
|
operation!
|
||||||
.TP
|
.TP
|
||||||
.B \-i
|
.B \-i
|
||||||
Show Wan IP address, and shows local interfaces (requires ifconfig network tool).
|
Show Wan IP address, and shows local interfaces (requires \fBifconfig\fR or \fBip\fR network tool).
|
||||||
Same as \-Nni. Not shown with \fB\-F\fR for user security reasons, you shouldn't
|
Same as \-Nni. Not shown with \fB\-F\fR for user security reasons, you shouldn't
|
||||||
paste your local/wan IP.
|
paste your local/wan IP.
|
||||||
|
|
||||||
|
For IP v6, shows per IP/scope for each interface. Note that there is no way I am aware of to
|
||||||
|
filter out the deprecated IP v6 scope site/global temporary addresses from the output of \fBifconfig\fR.
|
||||||
|
\fBip\fR tool shows that clearly.
|
||||||
|
|
||||||
|
\fBip-v6-temporary\fR \- (\fBip\fR tool only), scope global temporary. Scope global temporary deprecated is not shown
|
||||||
|
|
||||||
|
\fBip-v6-global\fR \- scope global (\fBifconfig\fR will show this for all types, global, global temporary,
|
||||||
|
and global temporary deprecated, \fBip\fR shows it only for global)
|
||||||
|
|
||||||
|
\fBip-v6-link\fR \- scope link (\fBip\fR/\fBifconfig\fR)
|
||||||
|
|
||||||
|
\fBip-v6-site\fR \- scope site (\fBip\fR/\fBifconfig\fR). This has been deprecated in IPv6, but still exists.
|
||||||
|
\fBifconfig\fR may show multiple site values, as with global temporary, and
|
||||||
|
global temporary deprecated.
|
||||||
|
|
||||||
|
\fBip-v6-unknown\fR \- unknown scope
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-I
|
.B \-I
|
||||||
Show Information: processes, uptime, memory, irc client (or shell type if run in shell, not irc), inxi version.
|
Show Information: processes, uptime, memory, irc client (or shell type if run in shell, not irc), inxi version.
|
||||||
|
@ -377,7 +395,7 @@ The following shows which lines / items get extra information with each extra da
|
||||||
\- Shows PCI Bus ID/Usb ID number of each Graphics card.
|
\- Shows PCI Bus ID/Usb ID number of each Graphics card.
|
||||||
.TP
|
.TP
|
||||||
.B \-x \-i
|
.B \-x \-i
|
||||||
\- Show IPv6 as well for LAN interface (IF) devices.
|
\- Show IP v6 additional scope data, like Global, Site, Temporary for each interface.
|
||||||
.TP
|
.TP
|
||||||
.B \-x \-I
|
.B \-x \-I
|
||||||
\- Show current init system (and init rc in some cases, like OpenRC). With \-xx, shows init/rc
|
\- Show current init system (and init rc in some cases, like OpenRC). With \-xx, shows init/rc
|
||||||
|
|
|
@ -1,3 +1,31 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 2.3.11
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: 2017-05-31
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
New version, new tarball, new man page. This corrects several oversights of the 2.3.10 IPv6 update.
|
||||||
|
|
||||||
|
Now there is an -x option for -i that will show the additioanl IPv6 address data for scope global,
|
||||||
|
temporary, and site. Also a fallback for unhandled scope: unknown. If the tool 'ip' is used, it will
|
||||||
|
filter out the deprecated temp site/global addresses, ifconfig tool does not appear to offer this
|
||||||
|
option.
|
||||||
|
|
||||||
|
Also changed is that now ipv6 address always shows, it's not an -x option. Probably about time to
|
||||||
|
start rolling out ip v6 data to users now that ip v6 is starting, slowly, to be used more.
|
||||||
|
|
||||||
|
Another small change, the link address for ipv6 is changed from ip-v6: to ip-v6-link so that it's
|
||||||
|
more clear which IP v6 address it is.
|
||||||
|
|
||||||
|
The last commit had a significant logic error in it that did not distinguish between the link address,
|
||||||
|
which is what should have only shown, and the remaining possible addresses.
|
||||||
|
|
||||||
|
I've tried to get a basic bsd support, but it's difficult to know the variants of ifconfig output syntax
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Wed, 31 May 2017 14:22:21 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 2.3.10
|
Version: 2.3.10
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue