Branch data Line data Source code
1 : : /* SPDX-License-Identifier: GPL-2.0-only */
2 : : /*
3 : : * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
4 : : */
5 : :
6 : : #include "bpfilter/front.h"
7 : :
8 : : #include "bpfilter/helper.h"
9 : :
10 : 180 : const char *bf_front_to_str(enum bf_front front)
11 : : {
12 : : static const char * const names[] = {
13 : : [BF_FRONT_IPT] = "BF_FRONT_IPT",
14 : : [BF_FRONT_NFT] = "BF_FRONT_NFT",
15 : : [BF_FRONT_CLI] = "BF_FRONT_CLI",
16 : : };
17 : : static_assert(ARRAY_SIZE(names) == _BF_FRONT_MAX,
18 : : "missing fronts in bf_front_to_str()");
19 : :
20 [ + + ]: 180 : if (front < 0 || front >= _BF_FRONT_MAX)
21 : : return "<bf_front unknown>";
22 : :
23 : 178 : return names[front];
24 : : }
|