Re: [PATCH 10/13] libxt_rateest: avoid optional arguments

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

 



On 23.05.2011 16:39, Jan Engelhardt wrote:
> Optional arguments make parsing unnecessarily harder - even more so
> than two-args. Right now, rateest even crashes because of it.
> 
>  static const struct option rateest_opts[] = {
>  	{.name = "rateest1",      .has_arg = true,  .val = OPT_RATEEST1},
>  	{.name = "rateest",       .has_arg = true,  .val = OPT_RATEEST1}, /* alias for absolute mode */
>  	{.name = "rateest2",      .has_arg = true,  .val = OPT_RATEEST2},
> -	{.name = "rateest-bps1",  .has_arg = false, .val = OPT_RATEEST_BPS1},
> -	{.name = "rateest-pps1",  .has_arg = false, .val = OPT_RATEEST_PPS1},
> -	{.name = "rateest-bps2",  .has_arg = false, .val = OPT_RATEEST_BPS2},
> -	{.name = "rateest-pps2",  .has_arg = false, .val = OPT_RATEEST_PPS2},
> -	{.name = "rateest-bps",   .has_arg = false, .val = OPT_RATEEST_BPS2}, /* alias for absolute mode */
> -	{.name = "rateest-pps",   .has_arg = false, .val = OPT_RATEEST_PPS2}, /* alias for absolute mode */
> +	{.name = "rateest-bps1",  .has_arg = true, .val = OPT_RATEEST_BPS1},
> +	{.name = "rateest-pps1",  .has_arg = true, .val = OPT_RATEEST_PPS1},
> +	{.name = "rateest-bps2",  .has_arg = true, .val = OPT_RATEEST_BPS2},
> +	{.name = "rateest-pps2",  .has_arg = true, .val = OPT_RATEEST_PPS2},
> +	{.name = "rateest-bps",   .has_arg = true, .val = OPT_RATEEST_BPS2}, /* alias for absolute mode */
> +	{.name = "rateest-pps",   .has_arg = true, .val = OPT_RATEEST_PPS2}, /* alias for absolute mode */
>  	{.name = "rateest-delta", .has_arg = false, .val = OPT_RATEEST_DELTA},
>  	{.name = "rateest-lt",    .has_arg = false, .val = OPT_RATEEST_LT},
>  	{.name = "rateest-gt",    .has_arg = false, .val = OPT_RATEEST_GT},
>  	{.name = "rateest-eq",    .has_arg = false, .val = OPT_RATEEST_EQ},
> +	{.name = "bytes",   .has_arg = false, .val = OPT_RATEEST_BYTES},
> +	{.name = "packets", .has_arg = false, .val = OPT_RATEEST_PACKETS},
>  	XT_GETOPT_TABLEEND,
>  };

This appears to be breaking backwards compatibility.
--
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