Re: [RFC v2] extensions: libxt_TOS: Add translation to nft

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 7, 2017 at 4:13 AM, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> 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;

In hindsight, I should have ran checkpatch before submitting this
patch. I forgot, and would not do this in future.

Thanks,
Gargi
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux