From 14e91c87bc4dcf0f95c7331e06b22c4c1c5f0e5d Mon Sep 17 00:00:00 2001 From: Daniel Danzberger Date: Mon, 1 Jun 2020 11:08:15 +0200 Subject: [PATCH] tr181: Add UCI path option for management server request URL Add Uci option to specify a path for the connection request URL cwmp.cpe.path Signed-off-by: Daniel Danzberger --- dmtree/tr181/managementserver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dmtree/tr181/managementserver.c b/dmtree/tr181/managementserver.c index a0753705..cedf66a4 100644 --- a/dmtree/tr181/managementserver.c +++ b/dmtree/tr181/managementserver.c @@ -181,12 +181,14 @@ static int get_management_server_connection_request_url(char *refparam, struct d char *ip, *port, *iface; dmuci_get_option_value_string("cwmp", "cpe", "default_wan_interface", &iface); - network_get_ipaddr(&ip, iface); + network_get_ipaddr(&ip, iface); dmuci_get_option_value_string("cwmp", "cpe", "port", &port); + if (ip[0] != '\0' && port[0] != '\0') { - char buf[64]; - snprintf(buf, sizeof(buf), "http://%s:%s/", ip, port); - *value = dmstrdup(buf); // MEM WILL BE FREED IN DMMEMCLEAN + char *path; + + dmuci_get_option_value_string("cwmp", "cpe", "path", &path); + dmasprintf(value, "http://%s:%s/%s", ip, port, path ? path : ""); } return 0; }