[Drbd-dev] user interface test of drbd.conf

Lars Ellenberg Lars.Ellenberg at linbit.com
Thu Oct 21 01:58:29 CEST 2004


/ 2004-10-20 18:17:27 +0200
\ Helmut Wollmersdorfer:

> Problem description: senseless values are accepted.

[ complains about missing range checks in the drbd.conf parser ]


/ 2004-10-21 01:50:59 +0200
\ svn at svn.drbd.org:
> Author: lars
> Date: 2004-10-21 01:50:56 +0200 (Thu, 21 Oct 2004)
> New Revision: 1609
> 
> Modified:
>    branches/drbd-0.7/documentation/drbd.conf.sgml
>    branches/drbd-0.7/scripts/drbd.conf
>    branches/drbd-0.7/user/drbdadm_parser.y
> Log:
> added range_check to drbdadm_parser.y,
>  now helmut can add rangechecks where neccessary

now, if you come up with more range checks you think should be in there,
just go to drbdadm_parser.y, and insert a
  range_check(value, name, min, max)
line at the appropriate location, like this:

> Modified: branches/drbd-0.7/user/drbdadm_parser.y
> ===================================================================
> --- branches/drbd-0.7/user/drbdadm_parser.y	2004-10-20 13:28:36 UTC (rev 1608)
> +++ branches/drbd-0.7/user/drbdadm_parser.y	2004-10-20 23:50:56 UTC (rev 1609)
> @@ -149,9 +159,15 @@
>  glob_stmt:	  TK_DISABLE_IO_HINTS
>  			{ global_options.disable_io_hints=1;   }
>  		| TK_MINOR_COUNT TK_INTEGER
> -			{ global_options.minor_count=atoi($2); }
> -		| TK_DIALOG_REFRESH TK_INTEGER   
> -                        { global_options.dialog_refresh=atoi($2); }
> +		{
> +			global_options.minor_count=atoi($2);
> +			range_check(global_options.minor_count,"minor_count",1,255);
> +		}
> +		| TK_DIALOG_REFRESH TK_INTEGER
> +		{
> +			global_options.dialog_refresh=atoi($2);
> +			range_check(global_options.dialog_refresh,"dialog_refresh",0,600);
> +		}
>  		;


More information about the drbd-dev mailing list