Commit 0cc9501f authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso
Browse files

netfilter: x_tables: remove pr_info where possible



remove several pr_info messages that cannot be triggered with iptables,
the check is only to ensure input is sane.

iptables(8) already prints error messages in these cases.

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent db93a363
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -98,14 +98,12 @@ static int ecn_tg_check(const struct xt_tgchk_param *par)
	const struct ipt_ECN_info *einfo = par->targinfo;
	const struct ipt_entry *e = par->entryinfo;

	if (einfo->operation & IPT_ECN_OP_MASK) {
		pr_info("unsupported ECN operation %x\n", einfo->operation);
	if (einfo->operation & IPT_ECN_OP_MASK)
		return -EINVAL;
	}
	if (einfo->ip_ect & ~IPT_ECN_IP_MASK) {
		pr_info("new ECT codepoint %x out of mask\n", einfo->ip_ect);

	if (einfo->ip_ect & ~IPT_ECN_IP_MASK)
		return -EINVAL;
	}

	if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
	    (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
		pr_info("cannot use TCP operations on a non-tcp rule\n");
+2 −3
Original line number Diff line number Diff line
@@ -39,10 +39,9 @@ static int checksum_tg_check(const struct xt_tgchk_param *par)
		pr_info("unsupported CHECKSUM operation %x\n", einfo->operation);
		return -EINVAL;
	}
	if (!einfo->operation) {
		pr_info("no CHECKSUM operation enabled\n");
	if (!einfo->operation)
		return -EINVAL;
	}

	return 0;
}

+1 −3
Original line number Diff line number Diff line
@@ -66,10 +66,8 @@ static int dscp_tg_check(const struct xt_tgchk_param *par)
{
	const struct xt_DSCP_info *info = par->targinfo;

	if (info->dscp > XT_DSCP_MAX) {
		pr_info("dscp %x out of range\n", info->dscp);
	if (info->dscp > XT_DSCP_MAX)
		return -EDOM;
	}
	return 0;
}

+3 −10
Original line number Diff line number Diff line
@@ -105,10 +105,8 @@ static int ttl_tg_check(const struct xt_tgchk_param *par)
{
	const struct ipt_TTL_info *info = par->targinfo;

	if (info->mode > IPT_TTL_MAXMODE) {
		pr_info("TTL: invalid or unknown mode %u\n", info->mode);
	if (info->mode > IPT_TTL_MAXMODE)
		return -EINVAL;
	}
	if (info->mode != IPT_TTL_SET && info->ttl == 0)
		return -EINVAL;
	return 0;
@@ -118,15 +116,10 @@ static int hl_tg6_check(const struct xt_tgchk_param *par)
{
	const struct ip6t_HL_info *info = par->targinfo;

	if (info->mode > IP6T_HL_MAXMODE) {
		pr_info("invalid or unknown mode %u\n", info->mode);
	if (info->mode > IP6T_HL_MAXMODE)
		return -EINVAL;
	}
	if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {
		pr_info("increment/decrement does not "
			"make sense with value 0\n");
	if (info->mode != IP6T_HL_SET && info->hop_limit == 0)
		return -EINVAL;
	}
	return 0;
}

+4 −6
Original line number Diff line number Diff line
@@ -313,10 +313,9 @@ static int hmark_tg_check(const struct xt_tgchk_param *par)
{
	const struct xt_hmark_info *info = par->targinfo;

	if (!info->hmodulus) {
		pr_info("xt_HMARK: hash modulus can't be zero\n");
	if (!info->hmodulus)
		return -EINVAL;
	}

	if (info->proto_mask &&
	    (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3))) {
		pr_info("xt_HMARK: proto mask must be zero with L3 mode\n");
@@ -324,10 +323,9 @@ static int hmark_tg_check(const struct xt_tgchk_param *par)
	}
	if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI_MASK) &&
	    (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT_MASK) |
			     XT_HMARK_FLAG(XT_HMARK_DPORT_MASK)))) {
		pr_info("xt_HMARK: spi-mask and port-mask can't be combined\n");
			     XT_HMARK_FLAG(XT_HMARK_DPORT_MASK))))
		return -EINVAL;
	}

	if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI) &&
	    (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT) |
			     XT_HMARK_FLAG(XT_HMARK_DPORT)))) {
Loading