ia64/xen-unstable

diff tools/examples/network-bridge @ 16684:7b7700a30e52

Handle netdev secondary addresses and labels

Fix the network-bridge logic to correctly transfer secondary IP
address from $netdev to $bridge.

e.g. if you add an secondary address/label/alias with:

$> ip addr add 172.31.0.200/24 dev eth0 label eth0:00

then, "ip addr show dev eth0" gives e.g.:

inet 172.31.0.10/24 brd 172.31.0.255 scope global eth0
inet 172.31.0.200/24 scope global secondary eth0:00

and transfer_addrs() tries to execute:

ip addr add 172.31.0.10/24 brd 172.31.0.255 scope global dev tmpbridge
ip addr add 172.31.0.200/24 scope global secondary dev tmpbridge:00

which causes the sript to fail because:

1) The device tmpbridge:00 doesn't exist
2) The "secondary" flag isn't valid

This patch fixes the sed commands to instead give:

ip addr add 172.31.0.10/24 brd 172.31.0.255 scope global dev tmpbridge label tmpbridge
ip addr add 172.31.0.200/24 scope global dev tmpbridge label tmpbridge:00

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 08 09:43:44 2008 +0000 (2008-01-08)
parents d4c5a1cdcf2e
children 850ec55df0dc
line diff
     1.1 --- a/tools/examples/network-bridge	Tue Jan 08 09:40:33 2008 +0000
     1.2 +++ b/tools/examples/network-bridge	Tue Jan 08 09:43:44 2008 +0000
     1.3 @@ -121,7 +121,8 @@ transfer_addrs () {
     1.4      ip addr show dev ${src} | egrep '^ *inet ' | sed -e "
     1.5  s/inet/ip addr add/
     1.6  s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
     1.7 -s/${src}/dev ${dst}/
     1.8 +s/${src}/dev ${dst} label ${dst}/
     1.9 +s/secondary//
    1.10  " | sh -e
    1.11      # Remove automatic routes on destination device
    1.12      ip route list | sed -ne "