git: f2d4370fbbe6 - main - ipfw: declare the ipfw_nat module

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Tue, 27 Oct 2026 20:56:22 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=f2d4370fbbe6a24b663a4151e3a462e8e2c306c6

commit f2d4370fbbe6a24b663a4151e3a462e8e2c306c6
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-10-27 20:53:26 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-10-27 20:53:26 +0000

    ipfw: declare the ipfw_nat module
    
    The module declaration is necessary for 'kldstat -m' to see it,
    and the rc(8) uses that to detect presence of ipfw_nat.
    
    NB: the module(9) KPI lacks a way to declare a module without
    providing an empty handler and no SYSINITs.
    
    Reported by:    ambrisko
    Fixes:          9bcc1e97dda8e926483b81874884211bbe4f36e9
---
 sys/netpfil/ipfw/ip_fw_nat.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c
index 1131cd75afbd..ab624ce7b430 100644
--- a/sys/netpfil/ipfw/ip_fw_nat.c
+++ b/sys/netpfil/ipfw/ip_fw_nat.c
@@ -1194,6 +1194,24 @@ ipfw_nat_destroy(void *dummy __unused)
 	ipfw_nat_get_log_ptr = NULL;
 }
 
+static int
+ipfw_nat_modevent(module_t mod, int type, void *unused)
+{
+	switch (type) {
+	case MOD_LOAD:
+	case MOD_UNLOAD:
+		return (0);
+	default:
+		return (EOPNOTSUPP);
+	}
+}
+
+static moduledata_t ipfw_nat_mod = {
+	.name = "ipfw_nat",
+	.evhand = ipfw_nat_modevent,
+};
+
+DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND);
 MODULE_DEPEND(ipfw_nat, libalias, 1, 1, 1);
 MODULE_DEPEND(ipfw_nat, ipfw, 3, 3, 3);
 MODULE_VERSION(ipfw_nat, 1);