From 2eb6b27e8caf167a7b5346e12997b675eb7db282 Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 12 Jan 2021 18:06:41 +0530 Subject: [PATCH] bbf: extend igmp snooping Add support for configuration of immediate leave and last member query interval in snooping as well. --- dmtree/tr181/x_iopsys_eu_igmp.c | 50 +++++++++++++++++++++++++++++++++ dmtree/tr181/x_iopsys_eu_igmp.h | 4 +++ 2 files changed, 54 insertions(+) diff --git a/dmtree/tr181/x_iopsys_eu_igmp.c b/dmtree/tr181/x_iopsys_eu_igmp.c index 49f1e567..88358102 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.c +++ b/dmtree/tr181/x_iopsys_eu_igmp.c @@ -826,6 +826,54 @@ int set_mcast_snooping_mode(char *refparam, struct dmctx *ctx, void *data, char return 0; } +int get_mcasts_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "last_member_query_interval", value); + return 0; +} + +int set_mcasts_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "last_member_query_interval", value); + break; + } + + return 0; +} + +int get_mcasts_fast_leave(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *val = NULL; + + dmuci_get_value_by_section_string((struct uci_section *)data, "fast_leave", &val); + *value = (val && strcmp(val, "1") == 0) ? "true" : "false"; + return 0; +} + +int set_mcasts_fast_leave(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + + switch (action) { + case VALUECHECK: + if (dm_validate_boolean(value)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "fast_leave", (b) ? "1" : "0"); + break; + } + + return 0; +} + int get_mcast_snooping_robustness(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "robustness", "0"); @@ -1990,6 +2038,8 @@ DMLEAF X_IOPSYS_EU_IGMPSnoopingParams[] = { {"Aggregation", &DMWRITE, DMT_BOOL, get_mcast_snooping_aggregation, set_mcast_snooping_aggregation, BBFDM_BOTH}, {"Interface", &DMWRITE, DMT_STRING, get_mcast_snooping_interface, set_mcast_snooping_interface, BBFDM_BOTH}, {"Mode", &DMWRITE, DMT_STRING, get_mcast_snooping_mode, set_mcast_snooping_mode, BBFDM_BOTH}, +{"LastMemberQueryInterval", &DMWRITE, DMT_UNINT, get_mcasts_last_mq_interval, set_mcasts_last_mq_interval, BBFDM_BOTH}, +{"ImmediateLeave", &DMWRITE, DMT_BOOL, get_mcasts_fast_leave, set_mcasts_fast_leave, BBFDM_BOTH}, {"FilterNumberOfEntries", &DMREAD, DMT_UNINT, get_mcasts_filter_no_of_entries, NULL, BBFDM_BOTH}, {"ClientGroupNumberOfEntries", &DMREAD, DMT_UNINT, get_igmp_cgrps_no_of_entries, NULL, BBFDM_BOTH}, {0} diff --git a/dmtree/tr181/x_iopsys_eu_igmp.h b/dmtree/tr181/x_iopsys_eu_igmp.h index 14b6baab..00b501fd 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.h +++ b/dmtree/tr181/x_iopsys_eu_igmp.h @@ -52,6 +52,10 @@ int get_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data, int set_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); int get_mcast_snooping_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int set_mcast_snooping_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_mcasts_fast_leave(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_mcasts_fast_leave(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_mcasts_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_mcasts_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); int get_mcastp_query_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); int set_mcastp_query_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);