bbf: extend igmp snooping

Add support for configuration of immediate leave and last member
query interval in snooping as well.
This commit is contained in:
Rahul 2021-01-12 18:06:41 +05:30 committed by Amin Ben Ramdhane
parent 196d11e8df
commit a2f4b759f1
2 changed files with 54 additions and 0 deletions

View file

@ -836,6 +836,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)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "robustness", value);
@ -2109,6 +2157,8 @@ DMLEAF X_IOPSYS_EU_IGMPSnoopingParams[] = {
{"Aggregation", &DMWRITE, DMT_BOOL, get_mcast_snooping_aggregation, set_mcast_snooping_aggregation, NULL, NULL, BBFDM_BOTH},
{"Interface", &DMWRITE, DMT_STRING, get_mcast_snooping_interface, set_mcast_snooping_interface, NULL, NULL, BBFDM_BOTH},
{"Mode", &DMWRITE, DMT_STRING, get_mcast_snooping_mode, set_mcast_snooping_mode, NULL, NULL, BBFDM_BOTH},
{"LastMemberQueryInterval", &DMWRITE, DMT_UNINT, get_mcasts_last_mq_interval, set_mcasts_last_mq_interval, NULL, NULL, BBFDM_BOTH},
{"ImmediateLeave", &DMWRITE, DMT_BOOL, get_mcasts_fast_leave, set_mcasts_fast_leave, NULL, NULL, BBFDM_BOTH},
{"FilterNumberOfEntries", &DMREAD, DMT_UNINT, get_mcasts_filter_no_of_entries, NULL, NULL, NULL, BBFDM_BOTH},
{"ClientGroupNumberOfEntries", &DMREAD, DMT_UNINT, get_igmp_cgrps_no_of_entries, NULL, NULL, NULL, BBFDM_BOTH},
{0}

View file

@ -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);