@@ -2693,7 +2693,8 @@ static int
26932693bbl_stream_ctrl_args (int fd , uint32_t session_id , json_t * arguments , bbl_stream_args_s * args )
26942694{
26952695 const char * s = NULL ;
2696- int intv ;
2696+ json_int_t number ;
2697+ int value ;
26972698
26982699 /* Init defaults */
26992700 args -> session_group_id = -1 ;
@@ -2707,47 +2708,49 @@ bbl_stream_ctrl_args(int fd, uint32_t session_id, json_t *arguments, bbl_stream_
27072708 }
27082709 }
27092710
2710- if (json_unpack (arguments , "{s:i }" , "flow-id" , & intv ) == 0 ) {
2711- if (intv < 0 ) {
2711+ if (json_unpack (arguments , "{s:I }" , "flow-id" , & number ) == 0 ) {
2712+ if (number < 1 ) {
27122713 return bbl_ctrl_status (fd , "warning" , 400 , "invalid flow-id" );
27132714 }
2714- args -> flow_id = intv ;
2715+ args -> flow_id = number ;
27152716 args -> stream = bbl_stream_index_get (args -> flow_id );
2716- if (args -> stream ) return 0 ;
2717+ if (args -> stream ) {
2718+ return 1 ;
2719+ }
27172720 return bbl_ctrl_status (fd , "warning" , 404 , "stream not found" );
27182721 }
27192722
27202723 args -> flows = json_object_get (arguments , "flows" );
27212724 if (args -> flows ) {
27222725 if (json_is_array (args -> flows )) {
27232726 args -> flows_array_len = json_array_size (args -> flows );
2724- return 0 ;
2727+ return 1 ;
27252728 }
27262729 return bbl_ctrl_status (fd , "error" , 400 , "flows must be of type array e.g. [1,2,3]" );
27272730 }
27282731
2729- if (json_unpack (arguments , "{s:i }" , "flow-id-min" , & intv ) == 0 ) {
2730- if (intv < 0 ) {
2732+ if (json_unpack (arguments , "{s:I }" , "flow-id-min" , & number ) == 0 ) {
2733+ if (number < 0 ) {
27312734 return bbl_ctrl_status (fd , "warning" , 400 , "invalid flow-id-min" );
27322735 }
2733- args -> flow_id_min = intv ;
2736+ args -> flow_id_min = number ;
27342737 }
27352738
2736- if (json_unpack (arguments , "{s:i }" , "flow-id-max" , & intv ) == 0 ) {
2737- if (intv < 0 ) {
2739+ if (json_unpack (arguments , "{s:I }" , "flow-id-max" , & number ) == 0 ) {
2740+ if (number < 0 ) {
27382741 return bbl_ctrl_status (fd , "warning" , 400 , "invalid flow-id-max" );
27392742 }
2740- args -> flow_id_max = intv ;
2743+ args -> flow_id_max = number ;
27412744 if (args -> flow_id_min > args -> flow_id_max ) {
27422745 return bbl_ctrl_status (fd , "warning" , 400 , "flow-id-min > max" );
27432746 }
27442747 }
27452748
2746- if (json_unpack (arguments , "{s:i }" , "session-group-id" , & intv ) == 0 ) {
2747- if (intv < 0 || intv > UINT16_MAX ) {
2749+ if (json_unpack (arguments , "{s:I }" , "session-group-id" , & number ) == 0 ) {
2750+ if (number < 0 || number > UINT16_MAX ) {
27482751 return bbl_ctrl_status (fd , "error" , 400 , "invalid session-group-id" );
27492752 }
2750- args -> session_group_id = intv ;
2753+ args -> session_group_id = number ;
27512754 }
27522755
27532756 if (json_unpack (arguments , "{s:s}" , "direction" , & s ) == 0 ) {
@@ -2765,17 +2768,17 @@ bbl_stream_ctrl_args(int fd, uint32_t session_id, json_t *arguments, bbl_stream_
27652768 json_unpack (arguments , "{s:s}" , "name" , & args -> name );
27662769 json_unpack (arguments , "{s:s}" , "interface" , & args -> interface );
27672770
2768- intv = 0 ;
2769- json_unpack (arguments , "{s:b}" , "verified-only" , & intv );
2770- if (intv ) args -> state = STREAM_STATE_VERIFIED ;
2771+ value = 0 ;
2772+ json_unpack (arguments , "{s:b}" , "verified-only" , & value );
2773+ if (value ) args -> state = STREAM_STATE_VERIFIED ;
27712774
2772- intv = 0 ;
2773- json_unpack (arguments , "{s:b}" , "bidirectional-verified-only" , & intv );
2774- if (intv ) args -> state = STREAM_STATE_BIVERIFIED ;
2775+ value = 0 ;
2776+ json_unpack (arguments , "{s:b}" , "bidirectional-verified-only" , & value );
2777+ if (value ) args -> state = STREAM_STATE_BIVERIFIED ;
27752778
2776- intv = 0 ;
2777- json_unpack (arguments , "{s:b}" , "pending-only" , & intv );
2778- if (intv ) args -> state = STREAM_STATE_PENDING ;
2779+ value = 0 ;
2780+ json_unpack (arguments , "{s:b}" , "pending-only" , & value );
2781+ if (value ) args -> state = STREAM_STATE_PENDING ;
27792782
27802783 return 1 ;
27812784}
@@ -2849,13 +2852,19 @@ bbl_stream_ctrl_info(int fd, uint32_t session_id __attribute__((unused)), json_t
28492852 json_t * json_stream = NULL ;
28502853
28512854 bbl_stream_s * stream ;
2852- json_int_t flow_id ;
2853-
2855+ json_int_t number ;
2856+ uint64_t flow_id ;
2857+
28542858 /* Unpack further arguments */
2855- if (json_unpack (arguments , "{s:i}" , "flow-id" , & flow_id ) != 0 ) {
2859+ json_unpack (arguments , "{s:b}" , "debug" , & debug );
2860+ if (json_unpack (arguments , "{s:I}" , "flow-id" , & number ) != 0 ) {
28562861 return bbl_ctrl_status (fd , "error" , 400 , "missing flow-id" );
28572862 }
2858- json_unpack (arguments , "{s:b}" , "debug" , & debug );
2863+ if (number < 1 ) {
2864+ return bbl_ctrl_status (fd , "error" , 400 , "invalid flow-id" );
2865+ }
2866+ flow_id = number ;
2867+
28592868 stream = bbl_stream_index_get (flow_id );
28602869 if (stream ) {
28612870 json_stream = bbl_stream_json (stream , debug );
0 commit comments