libvirt/tests/networkxml2xmlout
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 util: Change virMacAddrFormat to lowercase hex characters 2013-04-02 15:53:43 +02:00
dhcp6host-routed-network.xml Support for static routes on a virtual bridge 2013-05-13 16:14:40 -04:00
direct-net.xml conf: support abstracted interface info in network XML 2011-07-21 14:46:53 -04:00
empty-allow-ipv6.xml util: Change virMacAddrFormat to lowercase hex characters 2013-04-02 15:53:43 +02:00
host-bridge-net.xml conf: support abstracted interface info in network XML 2011-07-21 14:46:53 -04:00
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 util: Change virMacAddrFormat to lowercase hex characters 2013-04-02 15:53:43 +02:00
nat-network-dns-hosts.xml conf: support abstracted interface info in network XML 2011-07-21 14:46:53 -04:00
nat-network-dns-srv-record-minimal.xml Implement DNS SRV record into the bridge driver 2012-01-02 23:05:55 +08:00
nat-network-dns-srv-record.xml Implement DNS SRV record into the bridge driver 2012-01-02 23:05:55 +08:00
nat-network-dns-txt-record.xml conf: support abstracted interface info in network XML 2011-07-21 14:46:53 -04:00
nat-network.xml conf: support abstracted interface info in network XML 2011-07-21 14:46:53 -04:00
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 Adding the element pf to network xml. 2012-01-11 13:10:21 -07:00
routed-network.xml util: Change virMacAddrFormat to lowercase hex characters 2013-04-02 15:53:43 +02:00
vepa-net.xml conf: support partially-specified <virtualport> in parser and formatter 2012-08-14 15:47:50 -04:00