mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-03-14 21:20:28 +01:00
Modified set/get functionality of Ethernet.Link 'Enable' and 'Status' parameter
This commit is contained in:
parent
0ef1ad0dd7
commit
8e2c836767
1 changed files with 33 additions and 12 deletions
|
|
@ -356,6 +356,7 @@ static int addObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
|
||||||
/* Add device section */
|
/* Add device section */
|
||||||
dmuci_add_section("network", "interface", &s);
|
dmuci_add_section("network", "interface", &s);
|
||||||
dmuci_rename_section_by_section(s, interface_name);
|
dmuci_rename_section_by_section(s, interface_name);
|
||||||
|
dmuci_set_value_by_section(s, "disabled", "0");
|
||||||
|
|
||||||
/* Add link section in dmmap file */
|
/* Add link section in dmmap file */
|
||||||
dmuci_add_section_bbfdm(DMMAP, "link", &dmmap_link);
|
dmuci_add_section_bbfdm(DMMAP, "link", &dmmap_link);
|
||||||
|
|
@ -848,27 +849,47 @@ static int get_EthernetInterfaceStats_UnknownProtoPacketsReceived(char *refparam
|
||||||
|
|
||||||
static int get_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
*value = "true";
|
char *int_name;
|
||||||
|
struct uci_section *s = NULL;
|
||||||
|
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &int_name);
|
||||||
|
s = get_origin_section_from_config("network", "interface", int_name);
|
||||||
|
dmuci_get_value_by_section_string(s, "disabled", value);
|
||||||
|
*value = (strcmp(*value, "1") == 0) ? "False" : "True";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
static int set_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
{
|
{
|
||||||
switch (action) {
|
bool b;
|
||||||
case VALUECHECK:
|
char *int_name;
|
||||||
if (dm_validate_boolean(value))
|
struct uci_section *s = NULL;
|
||||||
return FAULT_9007;
|
|
||||||
break;
|
switch (action) {
|
||||||
case VALUESET:
|
case VALUECHECK:
|
||||||
break;
|
if (dm_validate_boolean(value))
|
||||||
}
|
return FAULT_9007;
|
||||||
return 0;
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
string_to_bool(value, &b);
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &int_name);
|
||||||
|
s = get_origin_section_from_config("network", "interface", int_name);
|
||||||
|
dmuci_set_value_by_section(s, "disabled", b ? "0" : "1");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_EthernetLink_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_EthernetLink_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
*value = "Up";
|
char *interface_name = NULL, *dev_name = NULL;
|
||||||
return 0;
|
struct uci_section *s = NULL;
|
||||||
|
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &interface_name);
|
||||||
|
s = get_origin_section_from_config("network", "interface", interface_name);
|
||||||
|
dmuci_get_value_by_section_string(s, "device", &dev_name);
|
||||||
|
return get_net_device_status(dev_name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue