#! /bin/sh
-# Copyright (c) 2011 Nicira Networks, Inc.
+# Copyright (c) 2011 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
devs=$*
for dev in $devs; do
- state=`ip link show $dev` || continue
+ state=`ip link show dev $dev` || continue
echo "# $dev"
# Link state (Ethernet addresses, up/down, ...)
linkcmd="$linkcmd mtu $mtu"
fi
if test -n "$linkcmd"; then
- echo ip link set $dev down # Required to change hwaddr.
- echo ip link set $dev $linkcmd
+ echo ip link set dev $dev down # Required to change hwaddr.
+ echo ip link set dev $dev $linkcmd
fi
# IP addresses (including IPv6).
- echo "ip addr flush $dev 2>/dev/null" # Suppresses "Nothing to flush".
+ echo "ip addr flush dev $dev 2>/dev/null" # Suppresses "Nothing to flush".
ip addr show dev $dev | while read addr; do
set -- $addr
continue 2
fi
;;
- "$dev")
- # Omit because "ip" wants "dev" keyword in front.
+ "$dev"|"$dev:"*)
+ # Address label string
+ addrcmd="$addrcmd label $1"
shift
continue
;;