@@ -128,6 +128,7 @@ lyplg_type_store_ipv4_address_prefix(const struct ly_ctx *ctx, const struct lysc
128128 struct lyd_value * storage , struct lys_glob_unres * UNUSED (unres ), struct ly_err_item * * err )
129129{
130130 LY_ERR ret = LY_SUCCESS ;
131+ const struct lysc_type_str * type_str = (struct lysc_type_str * )type ;
131132 struct lyd_value_ipv4_prefix * val ;
132133 uint32_t value_size ;
133134
@@ -166,6 +167,18 @@ lyplg_type_store_ipv4_address_prefix(const struct ly_ctx *ctx, const struct lysc
166167 ret = lyplg_type_check_hints (hints , value , value_size , type -> basetype , NULL , err );
167168 LY_CHECK_GOTO (ret , cleanup );
168169
170+ if (!(options & LYPLG_TYPE_STORE_ONLY )) {
171+ /* length restriction of the string */
172+ if (type_str -> length ) {
173+ ret = lyplg_type_validate_range (LY_TYPE_STRING , type_str -> length , value_size , value , value_size , err );
174+ LY_CHECK_GOTO (ret , cleanup );
175+ }
176+
177+ /* validate patterns */
178+ ret = lyplg_type_validate_patterns (ctx , type_str -> patterns , value , value_size , err );
179+ LY_CHECK_GOTO (ret , cleanup );
180+ }
181+
169182 /* get the mask in network-byte order */
170183 ret = ipv4prefix_str2ip (value , value_size , & val -> addr , & val -> prefix , err );
171184 LY_CHECK_GOTO (ret , cleanup );
0 commit comments