From f17dfc929a2659679d73110f5022e1abff4e7d0c Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Thu, 28 Jan 2021 11:45:18 +0100 Subject: [PATCH] Device.IP.Interface.{i}.MaxMTUSize: read its value from sysfs --- dmtree/tr181/ip.c | 6 +++++- json/tr181.json | 13 ++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dmtree/tr181/ip.c b/dmtree/tr181/ip.c index 7d8b71ba..1e29902f 100644 --- a/dmtree/tr181/ip.c +++ b/dmtree/tr181/ip.c @@ -1558,9 +1558,13 @@ static int set_IPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, return 0; } -/*#Device.IP.Interface.{i}.MaxMTUSize!UCI:network/interface,@i-1/mtu*/ +/*#Device.IP.Interface.{i}.MaxMTUSize!SYSFS:/sys/class/net/@Name/mtu*/ static int get_IPInterface_MaxMTUSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { + get_ip_iface_sysfs(data, "mtu", value); + if (*value && **value != '0') + return 0; + *value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "mtu", "1500"); return 0; } diff --git a/json/tr181.json b/json/tr181.json index 05c57fea..b987aa0b 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -41116,17 +41116,8 @@ ], "mapping": [ { - "type": "uci", - "uci": { - "file": "network", - "section": { - "type": "interface", - "index": "@i-1" - }, - "option": { - "name": "mtu" - } - } + "type": "sysfs", + "file": "/sys/class/net/@Name/mtu" } ] },