diff options
Diffstat (limited to 'lib/route/cls/ematch.c')
-rw-r--r-- | lib/route/cls/ematch.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/route/cls/ematch.c b/lib/route/cls/ematch.c index 76c34be..e2719c2 100644 --- a/lib/route/cls/ematch.c +++ b/lib/route/cls/ematch.c @@ -682,4 +682,18 @@ char *rtnl_ematch_offset2txt(uint8_t layer, uint16_t offset, char *buf, size_t l return buf; } +static const char *operand_txt[] = { + [TCF_EM_OPND_EQ] = "=", + [TCF_EM_OPND_LT] = "<", + [TCF_EM_OPND_GT] = ">", +}; + +char *rtnl_ematch_opnd2txt(uint8_t opnd, char *buf, size_t len) +{ + snprintf(buf, len, "%s", + opnd <= ARRAY_SIZE(operand_txt) ? operand_txt[opnd] : "?"); + + return buf; +} + /** @} */ |