From 3dcab09047df69a73d3d9d88fc81166727e4ab9b Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Tue, 15 Sep 2026 19:40:16 +0200 Subject: [PATCH] web: keep stored config lines and per-port ingress when saving Save to flash ran the stored config through the same filter as the command log, so stored lines the page does not know were dropped. The stored lines are now carried over as they are and only the log is filtered. ingress only changes the ports it lists, but the merge replaced every stored ingress line. It now merges per port; "ingress t|u|a" still replaces everything, and per-port settings an all-ports line already overrode are not revived. Write from the config editor no longer clears the command log or the unsaved marker, since the edited text does not hold the changes made on other pages; only Save, which merges them, clears the log. The command log grows from 1 kB to 2 kB, which still fits the 2500 byte output buffer, and send_cmd_log() stops at the end of that buffer. --- html/app.js | 36 ++++++++++++++++++++++++++---------- httpd/page_impl.c | 2 +- rtl837x_common.h | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/html/app.js b/html/app.js index 0a50b322..75152fbb 100644 --- a/html/app.js +++ b/html/app.js @@ -1614,7 +1614,7 @@ var CONF_OVERWRITE=[ /^ip\b/,/^gw\b/,/^netmask\b/,/^hostname\b/, /^syslog\s+ip\b/,/^syslog\s+port\b/,/^passwd\b/, /^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/, - /^pvid\s+\d{1,2}\b/,/^ingress\b/, + /^pvid\s+\d{1,2}\b/, /^port\s+\d{1,2}(?!\s+name\b)/,/^port\s+\d{1,2}\s+name\b/, /^eee\s+\d{1,2}\b/,/^eee\b/,/^mirror\b/, /^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/, @@ -1635,6 +1635,21 @@ function mergeConf(base,texts){ if((m=line.match(/^lag (\d) d$/))){drop(new RegExp("^lag(hash)? "+m[1]+"( |$)"));return;} if(line==="mirror off"){drop(/^mirror /);return;} if(!isConfCmd(line))return; + if((m=line.match(/^ingress (.+)$/))){ + if(/^[tua]$/.test(m[1])){drop(/^ingress /);conf.push(line);return;} + var ports={},order=[],last=-1; + conf.forEach(function(c,i){if(/^ingress [tua]$/.test(c))last=i;}); + conf.forEach(function(c,i){ + var cm=c.match(/^ingress (.+)$/); + if(!cm||/^[tua]$/.test(cm[1])||i