Skip to content

Firewall: DNat: Display effective port when local-port is omitted#10237

Open
TomWalraven wants to merge 1 commit into
opnsense:masterfrom
TomWalraven:show-effective-port
Open

Firewall: DNat: Display effective port when local-port is omitted#10237
TomWalraven wants to merge 1 commit into
opnsense:masterfrom
TomWalraven:show-effective-port

Conversation

@TomWalraven
Copy link
Copy Markdown
Contributor

Important notices

Before you submit a pull request, we ask you kindly to acknowledge the following:


Describe the problem

Currently when selecting any/skipping local-port field, it's unclear which port is effective.


Describe the proposed solution

Display the selected destination port in the local-port field. Local-port will only display "*" if both destination port and local-port are omitted.


Related issue
Closes: #9677

@Monviech
Copy link
Copy Markdown
Member

@TomWalraven

I think we can take the chance and wrap this into elseif since the number of conditions grow.

I imagine the formatter like this:

                    alias: function(column, row) {
                        if (row.isGroup) {
                            return "";
                        }
                        const value = row[column.id] || "";
                        // DNAT uses network, SNAT and ONAT uses net
                        const isNegated = (row[column.id.replace(/network|net/, 'not')] == 1) ? "! " : "";

                        if (typeof value !== 'string') {
                            return '';
                        } else if (value === "local-port") {
                            // DNAT: mirror destination port into local-port for better visibility
                            return (!row["local-port"] ? row["destination.port"] : row["local-port"]) || "*";
                        } else if (!value || value === "any") {
                            return isNegated + '*';
                        }

                        const aliasMetadataList = row["alias_meta_" + column.id] || [];

                        ...

@Monviech Monviech self-assigned this May 19, 2026
@Monviech Monviech added the cleanup Low impact changes label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Low impact changes

Development

Successfully merging this pull request may close these issues.

Firewall: NAT: Destination NAT: Should local-port be required?

2 participants