netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Gargi Sharma <gs051095@gmail.com>
Cc: gsoc2013@lists.netfilter.org, netfilter-devel@vger.kernel.org
Subject: Re: [RFC v2] extensions: libxt_TOS: Add translation to nft
Date: Fri, 7 Apr 2017 00:43:24 +0200	[thread overview]
Message-ID: <20170406224324.GA1661@salvia> (raw)
In-Reply-To: <1490727018-25703-1-git-send-email-gs051095@gmail.com>

On Wed, Mar 29, 2017 at 12:20:18AM +0530, Gargi Sharma wrote:
> Add translation for TOS to nftables. TOS is deprecated
> ans DSCP is ued in place of it. The first 6 bits of
> TOS specify the DSCP value.
> 
> Examples:
> 
> $ iptables-translate -t mangle -A PREROUTING -p TCP --dport 22 -j TOS --set-tos 0x10
> nft add rule ip mangle PREROUTING tcp dport 22 counter  ip6 dscp set 0x04

Applied, but I had to mangle this patch.

Coding style is not correct, for two reason, see below.

> diff --git a/extensions/libxt_TOS.c b/extensions/libxt_TOS.c
> index cef5876..f284d83 100644
> --- a/extensions/libxt_TOS.c
> +++ b/extensions/libxt_TOS.c
> @@ -183,6 +183,30 @@ static void tos_tg_save(const void *ip, const struct xt_entry_target *target)
>  	printf(" --set-tos 0x%02x/0x%02x", info->tos_value, info->tos_mask);
>  }
>  
> +static int tos_xlate(struct xt_xlate *xl,
> +		     const struct xt_xlate_tg_params *params)
> +{
> +	const struct ipt_tos_target_info *info =
> +			(struct ipt_tos_target_info *) params->target->data;
> +
^^^
No need for new line here.

> +	__u8 dscp = (info->tos)>>2;

Missing space here between declaration and code.
You can just use uint8_t from stdint.h BTW.
And the parens are not required, plus missing spaces:

	__u8 dscp = info->tos >> 2;

  reply	other threads:[~2017-04-06 22:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 18:50 [RFC v2] extensions: libxt_TOS: Add translation to nft Gargi Sharma
2017-04-06 22:43 ` Pablo Neira Ayuso [this message]
2017-04-07 18:59   ` Gargi Sharma
2017-04-06 22:49 ` Pablo Neira Ayuso
2017-04-07 19:00   ` Gargi Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170406224324.GA1661@salvia \
    --to=pablo@netfilter.org \
    --cc=gs051095@gmail.com \
    --cc=gsoc2013@lists.netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).