Ticket refs #4279: AddressingType and Origin parameters not IPCP when proto is PPPoE

This commit is contained in:
Amin Ben Ramdhane 2021-01-26 17:56:54 +01:00
parent 4631504931
commit 3258396176
2 changed files with 19 additions and 5 deletions

View file

@ -1838,8 +1838,15 @@ static int set_IPInterfaceIPv4Address_SubnetMask(char *refparam, struct dmctx *c
/*#Device.IP.Interface.{i}.IPv4Address.{i}.AddressingType!UCI:network/interface,@i-1/proto*/
static int get_IPInterfaceIPv4Address_AddressingType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", value);
*value = (strcmp(*value, "static") == 0) ? "Static" : "DHCP";
char *proto = NULL;
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
if (proto && strcmp(proto, "static") == 0)
*value = "Static";
else if (proto && strncmp(proto, "ppp", 3) == 0)
*value = "IPCP";
else
*value = "DHCP";
return 0;
}

View file

@ -31,7 +31,6 @@ struct routingfwdargs
{
char *permission;
struct uci_section *routefwdsection;
struct proc_routing *proute;
int type;
};
@ -630,8 +629,16 @@ static int get_router_ipv4forwarding_origin(char *refparam, struct dmctx *ctx, v
{
if (((struct routingfwdargs *)data)->type != ROUTE_DYNAMIC)
*value = "Static";
else
*value = "DHCPv4";
else {
json_object *res = NULL;
char *interface;
dmuci_get_value_by_section_string(((struct routingfwdargs *)data)->routefwdsection, "interface", &interface);
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", interface, String}}, 1, &res);
DM_ASSERT(res, *value = "DHCPv4");
char *proto = dmjson_get_value(res, 1, "proto");
*value = (proto && strncmp(proto, "ppp", 3) == 0) ? "IPCP" : "DHCPv4";
}
return 0;
}