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 : 285 : 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_enum_mapping(names, _BF_FRONT_MAX);
18 : :
19 [ + + ]: 285 : if (front < 0 || front >= _BF_FRONT_MAX)
20 : : return "<bf_front unknown>";
21 : :
22 : 283 : return names[front];
23 : : }
|