mirror of
https://git.netfilter.org/nftables
synced 2026-01-26 10:34:27 +00:00
utils: Cover for missing newline after BUG() messages
Relieve callers from having to suffix their messages with a newline escape sequence, have the macro append it to the format string instead. This is mostly a fix for (the many) calls to BUG() without a newline suffix. Adjust the previously correct ones since they emit an extra newline now. Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
8720428253
commit
f42ffcda1d
@ -32,7 +32,7 @@
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __noreturn __attribute__((__noreturn__))
|
||||
|
||||
#define BUG(fmt, arg...) ({ fprintf(stderr, "BUG: " fmt, ##arg); assert(0); abort(); })
|
||||
#define BUG(fmt, arg...) ({ fprintf(stderr, "BUG: " fmt "\n", ##arg); assert(0); abort(); })
|
||||
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
|
||||
|
||||
@ -119,7 +119,7 @@ void datatype_print(const struct expr *expr, struct output_ctx *octx)
|
||||
false, octx);
|
||||
} while ((dtype = dtype->basetype));
|
||||
|
||||
BUG("datatype %s has no print method or symbol table\n",
|
||||
BUG("datatype %s has no print method or symbol table",
|
||||
expr->dtype->name);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ void erec_print(struct output_ctx *octx, const struct error_record *erec,
|
||||
case INDESC_NETLINK:
|
||||
break;
|
||||
default:
|
||||
BUG("invalid input descriptor type %u\n", indesc->type);
|
||||
BUG("invalid input descriptor type %u", indesc->type);
|
||||
}
|
||||
|
||||
f = octx->error_fp;
|
||||
|
||||
@ -172,7 +172,7 @@ static enum ops byteorder_conversion_op(struct expr *expr,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
BUG("invalid byte order conversion %u => %u\n",
|
||||
BUG("invalid byte order conversion %u => %u",
|
||||
expr->byteorder, byteorder);
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ static int expr_evaluate_bits(struct eval_ctx *ctx, struct expr **exprp)
|
||||
&extra_len);
|
||||
break;
|
||||
default:
|
||||
BUG("Unknown expression %s\n", expr_name(expr));
|
||||
BUG("Unknown expression %s", expr_name(expr));
|
||||
}
|
||||
|
||||
masklen = len + shift;
|
||||
@ -1375,7 +1375,7 @@ static int expr_evaluate_unary(struct eval_ctx *ctx, struct expr **expr)
|
||||
byteorder = BYTEORDER_HOST_ENDIAN;
|
||||
break;
|
||||
default:
|
||||
BUG("invalid unary operation %u\n", unary->op);
|
||||
BUG("invalid unary operation %u", unary->op);
|
||||
}
|
||||
|
||||
__datatype_set(unary, datatype_clone(arg->dtype));
|
||||
@ -1426,7 +1426,7 @@ static int constant_binop_simplify(struct eval_ctx *ctx, struct expr **expr)
|
||||
mpz_rshift_ui(val, mpz_get_uint32(right->value));
|
||||
break;
|
||||
default:
|
||||
BUG("invalid binary operation %u\n", op->op);
|
||||
BUG("invalid binary operation %u", op->op);
|
||||
}
|
||||
|
||||
new = constant_expr_alloc(&op->location, op->dtype, op->byteorder,
|
||||
@ -1615,7 +1615,7 @@ static int expr_evaluate_binop(struct eval_ctx *ctx, struct expr **expr)
|
||||
ret = expr_evaluate_bitwise(ctx, expr);
|
||||
break;
|
||||
default:
|
||||
BUG("invalid binary operation %u\n", op->op);
|
||||
BUG("invalid binary operation %u", op->op);
|
||||
}
|
||||
|
||||
|
||||
@ -2053,7 +2053,7 @@ static int interval_set_eval(struct eval_ctx *ctx, struct set *set,
|
||||
case CMD_RESET:
|
||||
break;
|
||||
default:
|
||||
BUG("unhandled op %d\n", ctx->cmd->op);
|
||||
BUG("unhandled op %d", ctx->cmd->op);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2278,7 +2278,7 @@ static int expr_evaluate_map(struct eval_ctx *ctx, struct expr **expr)
|
||||
return -1;
|
||||
|
||||
if (ectx.len && mappings->set->data->len != ectx.len)
|
||||
BUG("%d vs %d\n", mappings->set->data->len, ectx.len);
|
||||
BUG("%d vs %d", mappings->set->data->len, ectx.len);
|
||||
|
||||
map->mappings = mappings;
|
||||
|
||||
@ -2643,7 +2643,7 @@ static int binop_transfer_one(struct eval_ctx *ctx,
|
||||
*right, expr_get(left->right));
|
||||
break;
|
||||
default:
|
||||
BUG("invalid binary operation %u\n", left->op);
|
||||
BUG("invalid binary operation %u", left->op);
|
||||
}
|
||||
|
||||
return expr_evaluate(ctx, right);
|
||||
@ -2965,7 +2965,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)
|
||||
"Use concatenations with sets and maps, not singleton values");
|
||||
break;
|
||||
default:
|
||||
BUG("invalid expression type %s\n", expr_name(right));
|
||||
BUG("invalid expression type %s", expr_name(right));
|
||||
}
|
||||
break;
|
||||
case OP_LT:
|
||||
@ -2996,7 +2996,7 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
BUG("invalid relational operation %u\n", rel->op);
|
||||
BUG("invalid relational operation %u", rel->op);
|
||||
}
|
||||
|
||||
if (binop_transfer(ctx, expr) < 0)
|
||||
@ -3232,7 +3232,7 @@ static int expr_evaluate(struct eval_ctx *ctx, struct expr **expr)
|
||||
case EXPR_RANGE_SYMBOL:
|
||||
return expr_evaluate_symbol_range(ctx, expr);
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(*expr));
|
||||
BUG("unknown expression type %s", expr_name(*expr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3393,7 +3393,7 @@ static int stmt_evaluate_verdict(struct eval_ctx *ctx, struct stmt *stmt)
|
||||
case EXPR_MAP:
|
||||
break;
|
||||
default:
|
||||
BUG("invalid verdict expression %s\n", expr_name(stmt->expr));
|
||||
BUG("invalid verdict expression %s", expr_name(stmt->expr));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -5094,7 +5094,7 @@ int stmt_evaluate(struct eval_ctx *ctx, struct stmt *stmt)
|
||||
case STMT_OPTSTRIP:
|
||||
return stmt_evaluate_optstrip(ctx, stmt);
|
||||
default:
|
||||
BUG("unknown statement type %d\n", stmt->type);
|
||||
BUG("unknown statement type %d", stmt->type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5485,7 +5485,7 @@ static struct expr *expr_set_to_list(struct eval_ctx *ctx, struct expr *dev_expr
|
||||
expr = key;
|
||||
break;
|
||||
default:
|
||||
BUG("invalid expression type %s\n", expr_name(expr));
|
||||
BUG("invalid expression type %s", expr_name(expr));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5537,7 +5537,7 @@ static bool evaluate_device_expr(struct eval_ctx *ctx, struct expr **dev_expr)
|
||||
case EXPR_VALUE:
|
||||
break;
|
||||
default:
|
||||
BUG("invalid expression type %s\n", expr_name(expr));
|
||||
BUG("invalid expression type %s", expr_name(expr));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5977,7 +5977,7 @@ static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
handle_merge(&cmd->object->handle, &cmd->handle);
|
||||
return obj_evaluate(ctx, cmd->object);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6148,7 +6148,7 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
obj_del_cache(ctx, cmd, NFT_OBJECT_TUNNEL);
|
||||
return 0;
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6158,7 +6158,7 @@ static int cmd_evaluate_get(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_ELEMENTS:
|
||||
return setelem_evaluate(ctx, cmd);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6313,7 +6313,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6342,7 +6342,7 @@ static int cmd_evaluate_reset(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_MAP:
|
||||
return cmd_evaluate_list(ctx, cmd);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6422,7 +6422,7 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
|
||||
return 0;
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -6444,7 +6444,7 @@ static int cmd_evaluate_rename(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
|
||||
break;
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -6634,5 +6634,5 @@ int cmd_evaluate(struct eval_ctx *ctx, struct cmd *cmd)
|
||||
break;
|
||||
};
|
||||
|
||||
BUG("invalid command operation %u\n", cmd->op);
|
||||
BUG("invalid command operation %u", cmd->op);
|
||||
}
|
||||
|
||||
@ -1774,7 +1774,7 @@ void range_expr_value_low(mpz_t rop, const struct expr *expr)
|
||||
case EXPR_SET_ELEM:
|
||||
return range_expr_value_low(rop, expr->key);
|
||||
default:
|
||||
BUG("invalid range expression type %s\n", expr_name(expr));
|
||||
BUG("invalid range expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1801,7 +1801,7 @@ void range_expr_value_high(mpz_t rop, const struct expr *expr)
|
||||
case EXPR_SET_ELEM:
|
||||
return range_expr_value_high(rop, expr->key);
|
||||
default:
|
||||
BUG("invalid range expression type %s\n", expr_name(expr));
|
||||
BUG("invalid range expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1852,7 +1852,7 @@ const struct expr_ops *expr_ops(const struct expr *e)
|
||||
|
||||
ops = __expr_ops_by_type(e->etype);
|
||||
if (!ops)
|
||||
BUG("Unknown expression type %d\n", e->etype);
|
||||
BUG("Unknown expression type %d", e->etype);
|
||||
|
||||
return ops;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ struct expr *fib_expr_alloc(const struct location *loc,
|
||||
type = &fib_addr_type;
|
||||
break;
|
||||
default:
|
||||
BUG("Unknown result %d\n", result);
|
||||
BUG("Unknown result %d", result);
|
||||
}
|
||||
|
||||
if (flags & NFTA_FIB_F_PRESENT) {
|
||||
|
||||
@ -70,7 +70,7 @@ static void setelem_expr_to_range(struct expr *expr)
|
||||
expr->key = key;
|
||||
break;
|
||||
default:
|
||||
BUG("unhandled key type %s\n", expr_name(expr->key));
|
||||
BUG("unhandled key type %s", expr_name(expr->key));
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ static struct expr *interval_expr_key(struct expr *i)
|
||||
elem = i;
|
||||
break;
|
||||
default:
|
||||
BUG("unhandled expression type %d\n", i->etype);
|
||||
BUG("unhandled expression type %d", i->etype);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -756,7 +756,7 @@ static struct expr *setelem_key(struct expr *expr)
|
||||
key = expr->key;
|
||||
break;
|
||||
default:
|
||||
BUG("unhandled expression type %d\n", expr->etype);
|
||||
BUG("unhandled expression type %d", expr->etype);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ int setelem_to_interval(const struct set *set, struct expr *elem,
|
||||
}
|
||||
|
||||
if (key->etype != EXPR_RANGE_VALUE)
|
||||
BUG("key must be RANGE_VALUE, not %s\n", expr_name(key));
|
||||
BUG("key must be RANGE_VALUE, not %s", expr_name(key));
|
||||
|
||||
assert(!next_key || next_key->etype == EXPR_RANGE_VALUE);
|
||||
|
||||
|
||||
@ -1117,7 +1117,7 @@ static json_t *datatype_json(const struct expr *expr, struct output_ctx *octx)
|
||||
}
|
||||
} while ((dtype = dtype->basetype));
|
||||
|
||||
BUG("datatype %s has no print method or symbol table\n",
|
||||
BUG("datatype %s has no print method or symbol table",
|
||||
expr->dtype->name);
|
||||
}
|
||||
|
||||
@ -2149,7 +2149,7 @@ int do_command_list_json(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
case CMD_OBJ_INVALID:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ static mpz_srcptr expr_msort_value(const struct expr *expr, mpz_t value)
|
||||
mpz_bitmask(value, expr->len);
|
||||
break;
|
||||
default:
|
||||
BUG("Unknown expression %s\n", expr_name(expr));
|
||||
BUG("Unknown expression %s", expr_name(expr));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -740,18 +740,18 @@ static void nft_dev_add(struct nft_dev *dev_array, const struct expr *expr, int
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
if (expr->etype != EXPR_VALUE)
|
||||
BUG("Must be a value, not %s\n", expr_name(expr));
|
||||
BUG("Must be a value, not %s", expr_name(expr));
|
||||
|
||||
ifname_len = div_round_up(expr->len, BITS_PER_BYTE);
|
||||
memset(ifname, 0, sizeof(ifname));
|
||||
|
||||
if (ifname_len > sizeof(ifname))
|
||||
BUG("Interface length %u exceeds limit\n", ifname_len);
|
||||
BUG("Interface length %u exceeds limit", ifname_len);
|
||||
|
||||
mpz_export_data(ifname, expr->value, BYTEORDER_HOST_ENDIAN, ifname_len);
|
||||
|
||||
if (strnlen(ifname, IFNAMSIZ) >= IFNAMSIZ)
|
||||
BUG("Interface length %zu exceeds limit, no NUL byte\n", strnlen(ifname, IFNAMSIZ));
|
||||
BUG("Interface length %zu exceeds limit, no NUL byte", strnlen(ifname, IFNAMSIZ));
|
||||
|
||||
dev_array[i].ifname = xstrdup(ifname);
|
||||
dev_array[i].location = &expr->location;
|
||||
@ -1734,7 +1734,7 @@ int mnl_nft_obj_add(struct netlink_ctx *ctx, struct cmd *cmd,
|
||||
obj_tunnel_add_opts(nlo, &obj->tunnel);
|
||||
break;
|
||||
default:
|
||||
BUG("Unknown type %d\n", obj->type);
|
||||
BUG("Unknown type %d", obj->type);
|
||||
break;
|
||||
}
|
||||
netlink_dump_obj(nlo, ctx);
|
||||
|
||||
@ -125,7 +125,7 @@ struct nftnl_set_elem *alloc_nftnl_setelem(const struct expr *set,
|
||||
elem = expr;
|
||||
}
|
||||
if (elem->etype != EXPR_SET_ELEM)
|
||||
BUG("Unexpected expression type: got %d\n", elem->etype);
|
||||
BUG("Unexpected expression type: got %d", elem->etype);
|
||||
|
||||
key = elem->key;
|
||||
|
||||
@ -221,7 +221,7 @@ struct nftnl_set_elem *alloc_nftnl_setelem(const struct expr *set,
|
||||
nld.value, nld.len);
|
||||
break;
|
||||
default:
|
||||
BUG("unexpected set element expression\n");
|
||||
BUG("unexpected set element expression");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,8 @@ static void nft_data_memcpy(struct nft_data_linearize *nld,
|
||||
const void *src, unsigned int len)
|
||||
{
|
||||
if (len > sizeof(nld->value))
|
||||
BUG("nld buffer overflow: want to copy %u, max %u\n", len, (unsigned int)sizeof(nld->value));
|
||||
BUG("nld buffer overflow: want to copy %u, max %u",
|
||||
len, (unsigned int)sizeof(nld->value));
|
||||
|
||||
memcpy(nld->value, src, len);
|
||||
nld->len = len;
|
||||
@ -575,7 +576,7 @@ static void netlink_gen_key(const struct expr *expr,
|
||||
case EXPR_PREFIX:
|
||||
return netlink_gen_prefix(expr, data);
|
||||
default:
|
||||
BUG("invalid data expression type %s\n", expr_name(expr));
|
||||
BUG("invalid data expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,7 +599,7 @@ static void __netlink_gen_data(const struct expr *expr,
|
||||
case EXPR_PREFIX:
|
||||
return netlink_gen_prefix(expr, data);
|
||||
default:
|
||||
BUG("invalid data expression type %s\n", expr_name(expr));
|
||||
BUG("invalid data expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2474,7 +2474,7 @@ static void binop_adjust_one(const struct expr *binop, struct expr *value,
|
||||
value->len = left->len;
|
||||
break;
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(left));
|
||||
BUG("unknown expression type %s", expr_name(left));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2505,7 +2505,8 @@ static void binop_adjust(const struct expr *binop, struct expr *right,
|
||||
binop_adjust(binop, i->key->key, shift);
|
||||
break;
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(i->key));
|
||||
BUG("unknown expression type %s",
|
||||
expr_name(i->key));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2514,7 +2515,7 @@ static void binop_adjust(const struct expr *binop, struct expr *right,
|
||||
binop_adjust_one(binop, right->right, shift);
|
||||
break;
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(right));
|
||||
BUG("unknown expression type %s", expr_name(right));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2645,7 +2646,7 @@ static void relational_binop_postprocess(struct rule_pp_ctx *ctx,
|
||||
expr->op = OP_NEG;
|
||||
break;
|
||||
default:
|
||||
BUG("unknown operation type %d\n", expr->op);
|
||||
BUG("unknown operation type %d", expr->op);
|
||||
}
|
||||
expr_free(binop);
|
||||
} else if (datatype_prefix_notation(binop->left->dtype) &&
|
||||
@ -3051,7 +3052,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, struct expr **exprp)
|
||||
ct_expr_update_type(&dl->pctx, expr);
|
||||
break;
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(expr));
|
||||
BUG("unknown expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ static enum nft_registers __get_register(struct netlink_linearize_ctx *ctx,
|
||||
|
||||
n = netlink_register_space(size);
|
||||
if (ctx->reg_low + n > NFT_REG_1 + NFT_REG32_15 - NFT_REG32_00 + 1)
|
||||
BUG("register reg_low %u invalid\n", ctx->reg_low);
|
||||
BUG("register reg_low %u invalid", ctx->reg_low);
|
||||
|
||||
reg = ctx->reg_low;
|
||||
ctx->reg_low += n;
|
||||
@ -90,7 +90,7 @@ static void __release_register(struct netlink_linearize_ctx *ctx,
|
||||
|
||||
n = netlink_register_space(size);
|
||||
if (ctx->reg_low < NFT_REG_1 + n)
|
||||
BUG("register reg_low %u invalid\n", ctx->reg_low);
|
||||
BUG("register reg_low %u invalid", ctx->reg_low);
|
||||
|
||||
ctx->reg_low -= n;
|
||||
}
|
||||
@ -457,7 +457,7 @@ static enum nft_cmp_ops netlink_gen_cmp_op(enum ops op)
|
||||
case OP_GTE:
|
||||
return NFT_CMP_GTE;
|
||||
default:
|
||||
BUG("invalid comparison operation %u\n", op);
|
||||
BUG("invalid comparison operation %u", op);
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ static void netlink_gen_range(struct netlink_linearize_ctx *ctx,
|
||||
nft_rule_add_expr(ctx, nle, &expr->location);
|
||||
break;
|
||||
default:
|
||||
BUG("invalid range operation %u\n", expr->op);
|
||||
BUG("invalid range operation %u", expr->op);
|
||||
|
||||
}
|
||||
|
||||
@ -600,7 +600,7 @@ static void netlink_gen_relational(struct netlink_linearize_ctx *ctx,
|
||||
case OP_NEG:
|
||||
break;
|
||||
default:
|
||||
BUG("invalid relational operation %u\n", expr->op);
|
||||
BUG("invalid relational operation %u", expr->op);
|
||||
}
|
||||
|
||||
switch (expr->right->etype) {
|
||||
@ -734,7 +734,7 @@ static void netlink_gen_bitwise_mask_xor(struct netlink_linearize_ctx *ctx,
|
||||
combine_binop(mask, xor, tmp, val);
|
||||
break;
|
||||
default:
|
||||
BUG("invalid binary operation %u\n", i->op);
|
||||
BUG("invalid binary operation %u", i->op);
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ static void netlink_gen_bitwise_bool(struct netlink_linearize_ctx *ctx,
|
||||
nftnl_expr_set_u32(nle, NFTNL_EXPR_BITWISE_OP, NFT_BITWISE_OR);
|
||||
break;
|
||||
default:
|
||||
BUG("invalid binary operation %u\n", expr->op);
|
||||
BUG("invalid binary operation %u", expr->op);
|
||||
}
|
||||
|
||||
netlink_gen_expr(ctx, expr->left, dreg);
|
||||
@ -824,7 +824,7 @@ static enum nft_byteorder_ops netlink_gen_unary_op(enum ops op)
|
||||
case OP_NTOH:
|
||||
return NFT_BYTEORDER_NTOH;
|
||||
default:
|
||||
BUG("invalid unary operation %u\n", op);
|
||||
BUG("invalid unary operation %u", op);
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,7 +951,7 @@ static void netlink_gen_expr(struct netlink_linearize_ctx *ctx,
|
||||
case EXPR_XFRM:
|
||||
return netlink_gen_xfrm(ctx, expr, dreg);
|
||||
default:
|
||||
BUG("unknown expression type %s\n", expr_name(expr));
|
||||
BUG("unknown expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -984,7 +984,7 @@ static void netlink_gen_objref_stmt(struct netlink_linearize_ctx *ctx,
|
||||
stmt->objref.type);
|
||||
break;
|
||||
default:
|
||||
BUG("unsupported expression %u\n", expr->etype);
|
||||
BUG("unsupported expression %u", expr->etype);
|
||||
}
|
||||
nft_rule_add_expr(ctx, nle, &expr->location);
|
||||
}
|
||||
@ -1072,7 +1072,7 @@ struct nftnl_expr *netlink_gen_stmt_stateful(const struct stmt *stmt)
|
||||
case STMT_LAST:
|
||||
return netlink_gen_last_stmt(stmt);
|
||||
default:
|
||||
BUG("unknown stateful statement type %d\n", stmt->type);
|
||||
BUG("unknown stateful statement type %d", stmt->type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1231,7 +1231,7 @@ static unsigned int nat_addrlen(uint8_t family)
|
||||
case NFPROTO_IPV6: return 128;
|
||||
}
|
||||
|
||||
BUG("invalid nat family %u\n", family);
|
||||
BUG("invalid nat family %u", family);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1274,7 +1274,7 @@ static void netlink_gen_nat_stmt(struct netlink_linearize_ctx *ctx,
|
||||
nftnl_reg_pmax = NFTNL_EXPR_REDIR_REG_PROTO_MAX;
|
||||
break;
|
||||
default:
|
||||
BUG("unknown nat type %d\n", stmt->nat.type);
|
||||
BUG("unknown nat type %d", stmt->nat.type);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1762,7 +1762,7 @@ static void netlink_gen_stmt(struct netlink_linearize_ctx *ctx,
|
||||
case STMT_OPTSTRIP:
|
||||
return netlink_gen_optstrip_stmt(ctx, stmt);
|
||||
default:
|
||||
BUG("unknown statement type %d\n", stmt->type);
|
||||
BUG("unknown statement type %d", stmt->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1181,7 +1181,7 @@ static void rule_optimize_print(struct output_ctx *octx,
|
||||
case INDESC_NETLINK:
|
||||
break;
|
||||
default:
|
||||
BUG("invalid input descriptor type %u\n", indesc->type);
|
||||
BUG("invalid input descriptor type %u", indesc->type);
|
||||
}
|
||||
|
||||
print_location(octx->error_fp, indesc, loc);
|
||||
|
||||
20
src/rule.c
20
src/rule.c
@ -1460,7 +1460,7 @@ void cmd_free(struct cmd *cmd)
|
||||
flowtable_free(cmd->flowtable);
|
||||
break;
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
free(cmd->attr);
|
||||
@ -1559,7 +1559,7 @@ static int do_command_add(struct netlink_ctx *ctx, struct cmd *cmd, bool excl)
|
||||
case CMD_OBJ_FLOWTABLE:
|
||||
return mnl_nft_flowtable_add(ctx, cmd, flags);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1570,7 +1570,7 @@ static int do_command_replace(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_RULE:
|
||||
return mnl_nft_rule_replace(ctx, cmd);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1586,7 +1586,7 @@ static int do_command_insert(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_RULE:
|
||||
return mnl_nft_rule_add(ctx, cmd, flags);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1640,7 +1640,7 @@ static int do_command_delete(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_FLOWTABLE:
|
||||
return mnl_nft_flowtable_del(ctx, cmd);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2668,7 +2668,7 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2708,7 +2708,7 @@ static int do_command_get(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_ELEMENTS:
|
||||
return do_get_setelems(ctx, cmd, false);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2739,7 +2739,7 @@ static int do_command_flush(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_OBJ_RULESET:
|
||||
return mnl_nft_table_del(ctx, cmd);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2757,7 +2757,7 @@ static int do_command_rename(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
|
||||
return mnl_nft_chain_rename(ctx, cmd, chain);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2844,7 +2844,7 @@ int do_command(struct netlink_ctx *ctx, struct cmd *cmd)
|
||||
case CMD_DESCRIBE:
|
||||
return do_command_describe(ctx, cmd, &ctx->nft->output);
|
||||
default:
|
||||
BUG("invalid command object type %u\n", cmd->obj);
|
||||
BUG("invalid command object type %u", cmd->obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ static struct expr *expr_value(struct expr *expr)
|
||||
case EXPR_VALUE:
|
||||
return expr;
|
||||
default:
|
||||
BUG("invalid expression type %s\n", expr_name(expr));
|
||||
BUG("invalid expression type %s", expr_name(expr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1138,7 +1138,7 @@ const struct stmt_ops *stmt_ops(const struct stmt *stmt)
|
||||
|
||||
ops = __stmt_ops_by_type(stmt->type);
|
||||
if (!ops)
|
||||
BUG("Unknown statement type %d\n", stmt->type);
|
||||
BUG("Unknown statement type %d", stmt->type);
|
||||
|
||||
return ops;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user