refactor: 'ip addr list' -> '... show'
Since the man page only mentions the latter
This commit is contained in:
1 parent
f79496ddcb
commit
0e4a30c9ee
1 file changed
+5
-5
+5
-5
@@ -162,7 +162,7 @@ attach() {
|
|||||||
if ip link show $LOCAL_IFNAME >/dev/null 2>&1 ; then
|
if ip link show $LOCAL_IFNAME >/dev/null 2>&1 ; then
|
||||||
# veth name already exists, so assume we set it up already;
|
# veth name already exists, so assume we set it up already;
|
||||||
# just add the IP address.
|
# just add the IP address.
|
||||||
if ip netns exec $NETNS ip addr list dev $CONTAINER_IFNAME | grep -F $2 >/dev/null ; then
|
if ip netns exec $NETNS ip addr show dev $CONTAINER_IFNAME | grep -F $2 >/dev/null ; then
|
||||||
# address was there already
|
# address was there already
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -206,7 +206,7 @@ attach() {
|
|||||||
# Detach Container-ID $1 at CIDR address $2 from the weave network
|
# Detach Container-ID $1 at CIDR address $2 from the weave network
|
||||||
# removing the virtual ethernet device if there are no more addresses
|
# removing the virtual ethernet device if there are no more addresses
|
||||||
detach() {
|
detach() {
|
||||||
if ! ip netns exec $NETNS ip addr list dev $CONTAINER_IFNAME | grep -F $2 >/dev/null ; then
|
if ! ip netns exec $NETNS ip addr show dev $CONTAINER_IFNAME | grep -F $2 >/dev/null ; then
|
||||||
# address is not there, leave the device alone
|
# address is not there, leave the device alone
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -215,7 +215,7 @@ detach() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$(ip netns exec $NETNS ip -f inet addr list dev ethwe)" ] ; then
|
if [ -n "$(ip netns exec $NETNS ip -f inet addr show dev ethwe)" ] ; then
|
||||||
# other addresses are left, leave the device alone
|
# other addresses are left, leave the device alone
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -314,7 +314,7 @@ case "$COMMAND" in
|
|||||||
IPADDR=$1
|
IPADDR=$1
|
||||||
shift 1
|
shift 1
|
||||||
create_bridge
|
create_bridge
|
||||||
if ! ip addr list dev $BRIDGE | grep -qF $IPADDR
|
if ! ip addr show dev $BRIDGE | grep -qF $IPADDR
|
||||||
then
|
then
|
||||||
ip addr add dev $BRIDGE $IPADDR
|
ip addr add dev $BRIDGE $IPADDR
|
||||||
fi
|
fi
|
||||||
@@ -324,7 +324,7 @@ case "$COMMAND" in
|
|||||||
IPADDR=$1
|
IPADDR=$1
|
||||||
shift 1
|
shift 1
|
||||||
create_bridge
|
create_bridge
|
||||||
if ip addr list dev $BRIDGE | grep -qF $IPADDR
|
if ip addr show dev $BRIDGE | grep -qF $IPADDR
|
||||||
then
|
then
|
||||||
ip addr del dev $BRIDGE $IPADDR
|
ip addr del dev $BRIDGE $IPADDR
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user