From 8ddadd978a7b246c9a446e05ff9f5e8e474604f3 Mon Sep 17 00:00:00 2001 From: Christian Giese Date: Wed, 27 Apr 2022 16:45:12 +0200 Subject: [PATCH 1/2] fix stack error --- code/bngblaster/src/bbl_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/bngblaster/src/bbl_ctrl.c b/code/bngblaster/src/bbl_ctrl.c index 559274df..c424c31f 100644 --- a/code/bngblaster/src/bbl_ctrl.c +++ b/code/bngblaster/src/bbl_ctrl.c @@ -357,7 +357,7 @@ bbl_ctrl_zapping_stats(int fd, bbl_ctx_s *ctx, uint32_t session_id __attribute__ json_t *root; bbl_stats_t stats = {0}; - bool reset = false; + int reset = 0; json_unpack(arguments, "{s:b}", "reset", &reset); bbl_stats_generate_multicast(ctx, &stats, reset); From 71c471377eaffc722fd7d82e385fcaa7c1e3c741 Mon Sep 17 00:00:00 2001 From: Christian Giese Date: Mon, 2 May 2022 10:33:13 +0200 Subject: [PATCH 2/2] fix session-traffic autostart --- code/bngblaster/src/bbl_config.c | 148 +++++++++++++++---------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/code/bngblaster/src/bbl_config.c b/code/bngblaster/src/bbl_config.c index 5945437f..453232a1 100644 --- a/code/bngblaster/src/bbl_config.c +++ b/code/bngblaster/src/bbl_config.c @@ -1690,6 +1690,80 @@ json_parse_config(json_t *root, bbl_ctx_s *ctx) { } } + /* Access Line Profiles Configuration */ + section = json_object_get(root, "access-line-profiles"); + if (json_is_array(section)) { + /* Config is provided as array (multiple access-line-profiles) */ + size = json_array_size(section); + for (i = 0; i < size; i++) { + if (!access_line_profile) { + ctx->config.access_line_profile = calloc(1, sizeof(bbl_access_line_profile_s)); + access_line_profile = ctx->config.access_line_profile; + } else { + access_line_profile->next = calloc(1, sizeof(bbl_access_line_profile_s)); + access_line_profile = access_line_profile->next; + } + if (!json_parse_access_line_profile(json_array_get(section, i), access_line_profile)) { + return false; + } + } + } + + /* Global Traffic Configuration */ + section = json_object_get(root, "traffic"); + if (json_is_object(section)) { + value = json_object_get(section, "autostart"); + if (json_is_boolean(value)) { + ctx->config.traffic_autostart = json_boolean_value(value); + } + value = json_object_get(section, "stop-verified"); + if (json_is_boolean(value)) { + ctx->config.traffic_stop_verified = json_boolean_value(value); + } + } + + /* Session Traffic Configuration */ + section = json_object_get(root, "session-traffic"); + if (json_is_object(section)) { + value = json_object_get(section, "autostart"); + if (json_is_boolean(value)) { + ctx->config.session_traffic_autostart = json_boolean_value(value); + } + value = json_object_get(section, "ipv4-pps"); + if (json_is_number(value)) { + ctx->config.session_traffic_ipv4_pps = json_number_value(value); + } + value = json_object_get(section, "ipv6-pps"); + if (json_is_number(value)) { + ctx->config.session_traffic_ipv6_pps = json_number_value(value); + } + value = json_object_get(section, "ipv6pd-pps"); + if (json_is_number(value)) { + ctx->config.session_traffic_ipv6pd_pps = json_number_value(value); + } + value = json_object_get(section, "ipv4-label"); + if (json_is_number(value)) { + ctx->config.session_traffic_ipv4_label = json_number_value(value); + } + if (json_unpack(section, "{s:s}", "ipv4-address", &s) == 0) { + if (!inet_pton(AF_INET, s, &ipv4)) { + fprintf(stderr, "JSON config error: Invalid value for session-traffic->ipv4-address\n"); + return false; + } + ctx->config.session_traffic_ipv4_address = ipv4; + } + value = json_object_get(section, "ipv6-label"); + if (json_is_number(value)) { + ctx->config.session_traffic_ipv6_label = json_number_value(value); + } + if (json_unpack(section, "{s:s}", "ipv6-address", &s) == 0) { + if (!inet_pton(AF_INET6, s, &ctx->config.session_traffic_ipv6_address)) { + fprintf(stderr, "JSON config error: Invalid value for session-traffic->ipv6-address\n"); + return false; + } + } + } + /* BGP Configuration */ sub = json_object_get(root, "bgp"); if (json_is_array(sub)) { @@ -1990,61 +2064,6 @@ json_parse_config(json_t *root, bbl_ctx_s *ctx) { fprintf(stderr, "JSON config error: List expected in L2TP server configuration but dictionary found\n"); } - /* Global Traffic Configuration */ - section = json_object_get(root, "traffic"); - if (json_is_object(section)) { - value = json_object_get(section, "autostart"); - if (json_is_boolean(value)) { - ctx->config.traffic_autostart = json_boolean_value(value); - } - value = json_object_get(section, "stop-verified"); - if (json_is_boolean(value)) { - ctx->config.traffic_stop_verified = json_boolean_value(value); - } - } - - /* Session Traffic Configuration */ - section = json_object_get(root, "session-traffic"); - if (json_is_object(section)) { - value = json_object_get(section, "autostart"); - if (json_is_boolean(value)) { - ctx->config.session_traffic_autostart = json_boolean_value(value); - } - value = json_object_get(section, "ipv4-pps"); - if (json_is_number(value)) { - ctx->config.session_traffic_ipv4_pps = json_number_value(value); - } - value = json_object_get(section, "ipv6-pps"); - if (json_is_number(value)) { - ctx->config.session_traffic_ipv6_pps = json_number_value(value); - } - value = json_object_get(section, "ipv6pd-pps"); - if (json_is_number(value)) { - ctx->config.session_traffic_ipv6pd_pps = json_number_value(value); - } - value = json_object_get(section, "ipv4-label"); - if (json_is_number(value)) { - ctx->config.session_traffic_ipv4_label = json_number_value(value); - } - if (json_unpack(section, "{s:s}", "ipv4-address", &s) == 0) { - if (!inet_pton(AF_INET, s, &ipv4)) { - fprintf(stderr, "JSON config error: Invalid value for session-traffic->ipv4-address\n"); - return false; - } - ctx->config.session_traffic_ipv4_address = ipv4; - } - value = json_object_get(section, "ipv6-label"); - if (json_is_number(value)) { - ctx->config.session_traffic_ipv6_label = json_number_value(value); - } - if (json_unpack(section, "{s:s}", "ipv6-address", &s) == 0) { - if (!inet_pton(AF_INET6, s, &ctx->config.session_traffic_ipv6_address)) { - fprintf(stderr, "JSON config error: Invalid value for session-traffic->ipv6-address\n"); - return false; - } - } - } - /* Traffic Streams Configuration */ section = json_object_get(root, "streams"); if (json_is_array(section)) { @@ -2064,25 +2083,6 @@ json_parse_config(json_t *root, bbl_ctx_s *ctx) { } } - /* Access Line Profiles Configuration */ - section = json_object_get(root, "access-line-profiles"); - if (json_is_array(section)) { - /* Config is provided as array (multiple access-line-profiles) */ - size = json_array_size(section); - for (i = 0; i < size; i++) { - if (!access_line_profile) { - ctx->config.access_line_profile = calloc(1, sizeof(bbl_access_line_profile_s)); - access_line_profile = ctx->config.access_line_profile; - } else { - access_line_profile->next = calloc(1, sizeof(bbl_access_line_profile_s)); - access_line_profile = access_line_profile->next; - } - if (!json_parse_access_line_profile(json_array_get(section, i), access_line_profile)) { - return false; - } - } - } - return true; }