diff --git a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt
index 196b43f2d5..badb7165f0 100644
--- a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt
+++ b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_log.volt
@@ -526,8 +526,13 @@
if (!hostnames.get(record.dst)) hostnames.set(record.dst, null);
// make sure the hostname key exists
- record['srchostname'] = hostnames.get(record.src) || '';
- record['dsthostname'] = hostnames.get(record.dst) || '';
+ ['src', 'dst'].forEach(addr => {
+ if (hostnames.get(record[addr]) !== '') {
+ record[`${addr}hostname`] = hostnames.get(record.src) || '';
+ } else {
+ record[`${addr}hostname`] = '';
+ }
+ });
}
resolve(data);
@@ -948,44 +953,35 @@
});
}
+ const updateRecords = () => {
+ lookup().then(() => {
+ buffer.map((record) => {
+ if (hostnames.get(record.src) !== '') {
+ record['srchostname'] = hostnames.get(record.src);
+ }
+ if (hostnames.get(record.dst) !== '') {
+ record['dsthostname'] = hostnames.get(record.dst);
+ }
+ return record;
+ });
+
+ filterVM.reset();
+ });
+ }
+
bufferDataUnsubscribe = buffer.subscribe((event) => {
// register to active data feed (all data), apply hostnames as they come
if (event.type === "push" || event.type === "pushMany") {
let records = Array.isArray(event.data) ? event.data : [event.data];
filterVM.updateTable(records);
- lookup().then(() => {
- records = records.map((record) => {
- if (hostnames.get(record.src) !== '') {
- record['srchostname'] = hostnames.get(record.src);
- }
- if (hostnames.get(record.dst) !== '') {
- record['dsthostname'] = hostnames.get(record.dst);
- }
- return record;
- });
-
- filterVM.updateTable(records);
- })
+ updateRecords();
}
});
// initial hostname lookup
tableWrapper.bootgrid('setColumns', ['srchostname', 'dsthostname']);
- lookup().then(() => {
- // operate on entire buffer
- buffer.map((record) => {
- if (hostnames.get(record.src) !== '') {
- record['srchostname'] = hostnames.get(record.src);
- }
- if (hostnames.get(record.dst) !== '') {
- record['dsthostname'] = hostnames.get(record.dst);
- }
- return record;
- });
-
- filterVM.reset();
- });
+ updateRecords();
} else {
if (bufferDataUnsubscribe !== null) {
bufferDataUnsubscribe();