• G
    Support for static routes on a virtual bridge · ccff335f
    Gene Czarcinski 提交于
    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: NGene Czarcinski <gene@czarc.net>
    Signed-off-by: NLaine Stump <laine@laine.org>
    ccff335f
libvirt_private.syms 44.3 KB