install -m 755 lib/lxcf-net-del $(DESTDIR)$(libdir)/lxcf/lxcf-net-del
install -m 755 lib/lxcf-net-gateway $(DESTDIR)$(libdir)/lxcf/lxcf-net-gateway
install -m 755 lib/lxcf-net-route $(DESTDIR)$(libdir)/lxcf/lxcf-net-route
+ install -m 755 lib/lxcf-net-list $(DESTDIR)$(libdir)/lxcf/lxcf-net-list
install -m 755 lib/lxcf-net-ipv4 $(DESTDIR)$(libdir)/lxcf/lxcf-net-ipv4
install_sbin_lxcf: .prepare
install -m 755 cmd/net-del $(DESTDIR)$(libdir)/lxcf/sbin/net-del
install -m 755 cmd/net-gateway $(DESTDIR)$(libdir)/lxcf/sbin/net-gateway
install -m 755 cmd/net-route $(DESTDIR)$(libdir)/lxcf/sbin/net-route
+ install -m 755 cmd/net-list $(DESTDIR)$(libdir)/lxcf/sbin/net-list
install_conf: .prepare
install -m 644 conf/helpfile.txt $(DESTDIR)$(libdir)/lxcf/helpfile.txt
#!/bin/bash
-# copyright (C) 2014 FUJITSU LIMITED All Rights Reserved
+# copyright (C) 2015 FUJITSU LIMITED All Rights Reserved
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
--- /dev/null
+
+#!/bin/bash
+# copyright (C) 2015 FUJITSU LIMITED All Rights Reserved
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check distro
+DISTRO=`/usr/lib64/lxcf/lxcf-distro`
+
+# check root
+if [ ${EUID:-${UID}} != 0 ]; then
+ echo "error: Because you are not root, you cannot execute this command. "
+ exit 1
+fi
+
+usage()
+{
+ echo "usage: net-list [ -b ] [ -v ]"
+}
+
+# check options
+FLG_B=0
+FLG_V=0
+
+while getopts bv OPT ; do
+ case $OPT in
+ b) FLG_B=1 ;;
+ v) FLG_V=1 ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+list_br()
+{
+ brctl show
+}
+
+list_veth()
+{
+ ip a show
+}
+
+# check args
+if [ $FLG_B -eq 1 ]; then
+ if [ $# -ne 0 ]; then
+ usage
+ exit -1
+ else
+ list_br
+ fi
+fi
+if [ $FLG_V -eq 1 ]; then
+ if [ $# -ne 0 ]; then
+ usage
+ exit -1
+ else
+ list_veth
+ fi
+fi
+
+if [ $# -ne 0 ]; then
+ usage
+ exit -1
+fi
+
+ip a show | egrep -e "^[1-9]" -e inet | \
+ awk '{if (($1 == "inet") || ($1 == "inet6")){printf " %s",$2}else{printf "\n%s ",$2}}END{print}'
+
+
+exit 0