libvirt/tests/networkxml2xmlin
Gene Czarcinski ccff335f83 Support for static routes on a virtual bridge
network: static route support for <network>

This patch adds the <route> subelement of <network> to define a static
route.  the address and prefix (or netmask) attribute identify the
destination network, and the gateway attribute specifies the next hop
address (which must be directly reachable from the containing
<network>) which is to receive the packets destined for
"address/(prefix|netmask)".

These attributes are translated into an "ip route add" command that is
executed when the network is started. The command used is of the
following form:

  ip route add <address>/<prefix> via <gateway> \
               dev <virbr-bridge> proto static metric <metric>

Tests are done to validate that the input data are correct.  For
example, for a static route ip definition, the address must be a
network address and not a host address.  Additional checks are added
to ensure that the specified gateway is directly reachable via this
network (i.e. that the gateway IP address is in the same subnet as one
of the IP's defined for the network).

prefix='0' is supported for both family='ipv4' address='0.0.0.0'
netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::',
prefix=0', although care should be taken to not override a desired
system default route.

Anytime an attempt is made to define a static route which *exactly*
duplicates an existing static route (for example, address=::,
prefix=0, metric=1), the following error message will be sent to
syslog:

    RTNETLINK answers: File exists

This can be overridden by decreasing the metric value for the route
that should be preferred, or increasing the metric for the route that
shouldn't be preferred (and is thus in place only in anticipation that
the preferred route may be removed in the future).  Caution should be
used when manipulating route metrics, especially for a default route.

Note: The use of the command-line interface should be replaced by
direct use of libnl so that error conditions can be handled better.  But,
that is being left as an exercise for another day.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
Signed-off-by: Laine Stump <laine@laine.org>
2013-05-13 16:14:40 -04:00
..
8021Qbh-net.xml conf: add <vlan> element to network and domain interface elements 2012-08-15 13:10:57 -04:00
bandwidth-network.xml
dhcp6host-routed-network.xml Support for static routes on a virtual bridge 2013-05-13 16:14:40 -04:00
direct-net.xml
empty-allow-ipv6.xml network: allow guest to guest IPv6 without gateway definition 2012-12-05 14:58:32 -05:00
host-bridge-net.xml
hostdev-pf.xml network: support <driver name='vfio'/> in network definitions 2013-04-26 21:51:12 -04:00
hostdev.xml conf: parser/formatter/rng for <forward mode='hostdev'> 2012-08-17 15:43:26 -04:00
isolated-network.xml network: allow guest to guest IPv6 without gateway definition 2012-12-05 14:58:32 -05:00
nat-network-dns-hosts.xml
nat-network-dns-srv-record-minimal.xml
nat-network-dns-srv-record.xml
nat-network-dns-txt-record.xml
nat-network.xml
netboot-network.xml Revert "Add support for <option> tag in network config" 2013-02-27 10:55:24 -05:00
netboot-proxy-network.xml Revert "Add support for <option> tag in network config" 2013-02-27 10:55:24 -05:00
openvswitch-net.xml conf: add <vlan> element to network and domain interface elements 2012-08-15 13:10:57 -04:00
passthrough-pf.xml conf: parser/formatter/rng for <forward mode='hostdev'> 2012-08-17 15:43:26 -04:00
routed-network.xml
vepa-net.xml conf: support partially-specified <virtualport> in parser and formatter 2012-08-14 15:47:50 -04:00