• Stefan Tomanek's avatar
    ip rule: add route suppression options · b1d0525f
    Stefan Tomanek authored
    When configuring a system with multiple network uplinks and default routes, it
    is often convenient to reference a routing table multiple times - but reject
    its routing decision if certain constraints are not met by it.
    
    Consider this setup:
    
    $ ip route add table secuplink default via 10.42.23.1
    
    $ ip rule add pref 100            table main suppress_prefixlength 0
    $ ip rule add pref 150 fwmark 0xA table secuplink
    
    With this setup, packets marked 0xA will be processed by the additional routing
    table "secuplink", but only if no suitable route in the main routing table can
    be found. By suppressing entries with a prefixlength of 0 (or less), the
    default route (/0) of the table "main" is hidden to packets processed by rule
    100; packets traveling to destinations via more specific routes are processed
    as usual.
    
    It is also possible to suppress a routing entry if a device belonging to
    a specific interface group is to be used:
    
    $ ip rule add pref 150 table main suppress_group 1
    Signed-off-by: default avatarStefan Tomanek <stefan.tomanek@wertarbyte.de>
    b1d0525f
iprule.c 12.6 KB