• Petr Machata's avatar
    selftests: forwarding.config.sample: Move overrides to lib.sh · fd36fd26
    Petr Machata authored
    forwarding.config.sample, net/lib.sh and net/forwarding/lib.sh contain
    definitions and redefinitions of some of the same variables. The overlap
    between net/forwarding/lib.sh and forwarding.config.sample is especially
    large. This duplication is a potential source of confusion and problems.
    
    It would be overall less error prone if each variable were defined in one
    place only. In this patch set, that place is the library itself. Therefore
    move all comments from forwarding.config.sample to net/forwarding/lib.sh.
    
    Move over also a definition of TC_FLAG, which was missing from lib.sh
    entirely.
    
    Additionally, add to lib.sh a default definition of the topology variables.
    The logic behind this is that forgetting to specify forwarding.config was a
    frequent source of frustration for the selftest users. But really, most of
    the time the default veth based topology is just fine. We considered just
    sourcing forwarding.config.sample instead if forwarding.config is not
    available, but this is a cleaner solution.
    
    That means the syntax of the forwarding.config.sample override has to
    change to an array assignment, so that the whole variable is overwritten,
    not just individual keys, which could leave the value of some keys
    unchanged. Do the same in lib.sh for any cut'n'pasters out there.
    
    The config file is then given a sort of carte blanche to redefine whatever
    variables it sees fit from the libraries. This is described in a comment in
    the file. Only a handful of variables are left behind, to illustrate the
    customization.
    
    The fact that the variables are now missing from forwarding.config.sample,
    and therefore would miss from forwarding.config derived from that file as
    well, should not change anything. This is just the sample file. Users that
    keep their own forwarding.config would retain it as before.
    
    The only observable change is introduction of TC_FLAG to lib.sh, because
    now the filters would not be attempted to install to HW datapath. For veth
    pairs this does not change anything. For HW deployments, users presumably
    have forwarding.config with this value overridden.
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarBenjamin Poirier <bpoirier@nvidia.com>
    Link: https://lore.kernel.org/r/b9b8a11a22821a7aa532211ff461a34f596e26bf.1711464583.git.petrm@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    fd36fd26
forwarding.config.sample 706 Bytes