nexthop: Assert the invariant that a NH group is of only one type
authorPetr Machata <petrm@nvidia.com>
Thu, 28 Jan 2021 12:49:16 +0000 (13:49 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Jan 2021 04:49:51 +0000 (20:49 -0800)
commit720ccd9a728506ca4721b18a22a2157a9d48ed60
tree38307a1561dc0b97aad2394ba0d18352e61f211a
parentb9bae61be46645aa3b8b5d79d5cdfabe55ae1507
nexthop: Assert the invariant that a NH group is of only one type

Most of the code that deals with nexthop groups relies on the fact that the
group is of exactly one well-known type. Currently there is only one type,
"mpath", but as more next-hop group types come, it becomes desirable to
have a central place where the setting is validated. Introduce such place
into nexthop_create_group(), such that the check is done before the code
that relies on that invariant is invoked.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/nexthop.c