mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: nf_nat: replace u_int16_t with u16
@ 2026-10-02 20:10 Carlos Grillet
  2026-10-05 12:09 ` Fernando Fernandez Mancera
  0 siblings, 1 reply; 2+ messages in thread
From: Carlos Grillet @ 2026-10-02 20:10 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman
  Cc: netfilter-devel, coreteam, linux-kernel, netdev

Use the preferred kernel type u16 instead of the POSIX u_int16_t
variant across the NAT helpers.

No functional change.

Signed-off-by: Carlos Grillet <carlos@carlosgrillet.me>
---
This supersedes the nf_nat_amanda one-liner from batch 3, which was
dropped in favour of a larger changeset:

  https://lore.kernel.org/netfilter-devel/ak5lH1UnFth6oreP@strlen.de/

nf_nat is now converted in one patch, as suggested. The remaining
families (nfnetlink, nf_log, x_tables, ...) will follow the same way.

 include/linux/netfilter/nf_conntrack_sip.h |  2 +-
 net/ipv4/netfilter/nf_nat_h323.c           | 10 +++++-----
 net/ipv4/netfilter/nf_nat_pptp.c           |  4 ++--
 net/netfilter/nf_nat_amanda.c              |  2 +-
 net/netfilter/nf_nat_ftp.c                 |  2 +-
 net/netfilter/nf_nat_irc.c                 |  2 +-
 net/netfilter/nf_nat_sip.c                 |  6 +++---
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index aafa0c04f917..3b66ec4b20c8 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -143,7 +143,7 @@ struct nf_nat_sip_hooks {
 				 unsigned int *datalen,
 				 unsigned int matchoff,
 				 unsigned int matchlen,
-				 u_int16_t port);
+				 u16 port);
 
 	unsigned int (*sdp_session)(struct sk_buff *skb,
 				    unsigned int protoff,
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index 6bcd6734769b..265c1ba5b348 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -186,7 +186,7 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
 	struct nf_ct_h323_master *info = nfct_help_data(ct);
 	int dir = CTINFO2DIR(ctinfo);
 	int i;
-	u_int16_t nated_port;
+	u16 nated_port;
 
 	if (!info)
 		return -1;
@@ -282,7 +282,7 @@ static int nat_t120(struct sk_buff *skb, struct nf_conn *ct,
 		    struct nf_conntrack_expect *exp)
 {
 	int dir = CTINFO2DIR(ctinfo);
-	u_int16_t nated_port = ntohs(port);
+	u16 nated_port = ntohs(port);
 
 	/* Set expectations for NAT */
 	exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
@@ -321,7 +321,7 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct,
 {
 	struct nf_ct_h323_master *info = nfct_help_data(ct);
 	int dir = CTINFO2DIR(ctinfo);
-	u_int16_t nated_port = ntohs(port);
+	u16 nated_port = ntohs(port);
 
 	if (!info)
 		return -1;
@@ -402,7 +402,7 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct,
 {
 	struct nf_ct_h323_master *info = nfct_help_data(ct);
 	int dir = CTINFO2DIR(ctinfo);
-	u_int16_t nated_port = ntohs(port);
+	u16 nated_port = ntohs(port);
 	union nf_inet_addr addr;
 
 	if (!info)
@@ -488,7 +488,7 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct,
 			      struct nf_conntrack_expect *exp)
 {
 	int dir = CTINFO2DIR(ctinfo);
-	u_int16_t nated_port;
+	u16 nated_port;
 
 	/* Set expectations for NAT */
 	exp->saved_addr = exp->tuple.dst.u3;
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index fed5249001a4..5387c288c348 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -130,7 +130,7 @@ pptp_outbound_pkt(struct sk_buff *skb,
 	struct nf_ct_pptp_master *ct_pptp_info;
 	struct nf_conn_nat *nat = nfct_nat(ct);
 	struct nf_nat_pptp *nat_pptp_info;
-	u_int16_t msg;
+	u16 msg;
 	__be16 new_callid;
 	unsigned int cid_off;
 
@@ -243,7 +243,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
 {
 	const struct nf_nat_pptp *nat_pptp_info;
 	struct nf_conn_nat *nat = nfct_nat(ct);
-	u_int16_t msg;
+	u16 msg;
 	__be16 new_pcid;
 	unsigned int pcid_off;
 
diff --git a/net/netfilter/nf_nat_amanda.c b/net/netfilter/nf_nat_amanda.c
index 330415809425..17b0c1c8d4e1 100644
--- a/net/netfilter/nf_nat_amanda.c
+++ b/net/netfilter/nf_nat_amanda.c
@@ -34,7 +34,7 @@ static unsigned int help(struct sk_buff *skb,
 			 struct nf_conntrack_expect *exp)
 {
 	char buffer[sizeof("65535")];
-	u_int16_t port;
+	u16 port;
 
 	/* Connection comes from client. */
 	exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
diff --git a/net/netfilter/nf_nat_ftp.c b/net/netfilter/nf_nat_ftp.c
index 25d20e2970ae..0c90165040e0 100644
--- a/net/netfilter/nf_nat_ftp.c
+++ b/net/netfilter/nf_nat_ftp.c
@@ -70,7 +70,7 @@ static unsigned int nf_nat_ftp(struct sk_buff *skb,
 			       struct nf_conntrack_expect *exp)
 {
 	union nf_inet_addr newaddr;
-	u_int16_t port;
+	u16 port;
 	int dir = CTINFO2DIR(ctinfo);
 	char buffer[sizeof("|1||65535|") + INET6_ADDRSTRLEN];
 	unsigned int buflen;
diff --git a/net/netfilter/nf_nat_irc.c b/net/netfilter/nf_nat_irc.c
index 89b31fe932ba..140b7d99a887 100644
--- a/net/netfilter/nf_nat_irc.c
+++ b/net/netfilter/nf_nat_irc.c
@@ -39,7 +39,7 @@ static unsigned int help(struct sk_buff *skb,
 {
 	char buffer[sizeof("4294967296 65635")];
 	union nf_inet_addr newaddr;
-	u_int16_t port;
+	u16 port;
 
 	/* Reply comes from server. */
 	newaddr = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3;
diff --git a/net/netfilter/nf_nat_sip.c b/net/netfilter/nf_nat_sip.c
index 8c412bcf6cff..e27c9744054e 100644
--- a/net/netfilter/nf_nat_sip.c
+++ b/net/netfilter/nf_nat_sip.c
@@ -410,7 +410,7 @@ static unsigned int nf_nat_sip_expect(struct sk_buff *skb, unsigned int protoff,
 	enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
 	struct nf_ct_sip_master *ct_sip_info = nfct_help_data(ct);
 	union nf_inet_addr newaddr;
-	u_int16_t port;
+	u16 port;
 	__be16 srcport;
 	char buffer[INET6_ADDRSTRLEN + sizeof("[]:nnnnn")];
 	unsigned int buflen;
@@ -536,7 +536,7 @@ static unsigned int nf_nat_sdp_port(struct sk_buff *skb, unsigned int protoff,
 				    const char **dptr, unsigned int *datalen,
 				    unsigned int matchoff,
 				    unsigned int matchlen,
-				    u_int16_t port)
+				    u16 port)
 {
 	char buffer[sizeof("nnnnn")];
 	unsigned int buflen;
@@ -601,7 +601,7 @@ static unsigned int nf_nat_sdp_media(struct sk_buff *skb, unsigned int protoff,
 	enum ip_conntrack_info ctinfo;
 	struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
 	enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
-	u_int16_t port;
+	u16 port;
 
 	/* Connection will come from reply */
 	if (nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3,
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-05 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02 20:10 [PATCH nf-next] netfilter: nf_nat: replace u_int16_t with u16 Carlos Grillet
2026-10-05 12:09 ` Fernando Fernandez Mancera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®