netdev
[Top] [All Lists]

[PATCH 2.6] 1/2: Rename NAT helper structures

To: Netfilter Development Mailinglist <netfilter-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [PATCH 2.6] 1/2: Rename NAT helper structures
From: Harald Welte <laforge@xxxxxxxxxxxxx>
Date: Fri, 3 Sep 2004 09:05:47 +0200
Cc: netdev@xxxxxxxxxxx
Mail-followup-to: Harald Welte <laforge@xxxxxxxxxxxxx>, Netfilter Development Mailinglist <netfilter-devel@xxxxxxxxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040818i
I forgot to Cc' the lists with this part of the patchset, here is the
forwarded message:

-- 
- Harald Welte <laforge@xxxxxxxxxxxxx>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
--- Begin Message ---
To: David Miller <davem@xxxxxxxxxxxxx>
Subject: [PATCH 2.6] 1/2: Rename NAT helper structures
From: Harald Welte <laforge@xxxxxxxxxxxxx>
Date: Fri, 3 Sep 2004 09:00:17 +0200
User-agent: Mutt/1.5.6+20040818i
Hi Dave!

This is the first of a two part patch.

Part one fixes confusing naming of some NAT helper data structures
(ct_ are part of ip_conntrack, exp_ are part of ip_conntrack_expect).

This patch is required to make the second apply, which fixes NAT helper
locking.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/07 23:30:12+02:00 kaber@xxxxxxxxxxxx 
#   [NETFILTER]: Fix confusing naming in NAT-helpers
#
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
#   Signed-off-by: Harald Welte <laforge@xxxxxxxxxxxxx>
# 
# net/ipv4/netfilter/ip_nat_irc.c
#   2004/08/07 23:29:48+02:00 kaber@xxxxxxxxxxxx +9 -9
#   [NETFILTER]: Fix confusing naming in NAT-helpers
# 
# net/ipv4/netfilter/ip_nat_ftp.c
#   2004/08/07 23:29:48+02:00 kaber@xxxxxxxxxxxx +12 -12
#   [NETFILTER]: Fix confusing naming in NAT-helpers
# 
diff -Nru a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c
--- a/net/ipv4/netfilter/ip_nat_ftp.c   2004-08-08 01:41:06 +02:00
+++ b/net/ipv4/netfilter/ip_nat_ftp.c   2004-08-08 01:41:06 +02:00
@@ -177,7 +177,7 @@
     [IP_CT_FTP_EPSV] = mangle_epsv_packet
 };
 
-static int ftp_data_fixup(const struct ip_ct_ftp_expect *ct_ftp_info,
+static int ftp_data_fixup(const struct ip_ct_ftp_expect *exp_ftp_info,
                          struct ip_conntrack *ct,
                          struct sk_buff **pskb,
                          enum ip_conntrack_info ctinfo,
@@ -191,13 +191,13 @@
 
        MUST_BE_LOCKED(&ip_ftp_lock);
        DEBUGP("FTP_NAT: seq %u + %u in %u\n",
-              expect->seq, ct_ftp_info->len,
+              expect->seq, exp_ftp_info->len,
               ntohl(tcph->seq));
 
        /* Change address inside packet to match way we're mapping
           this connection. */
-       if (ct_ftp_info->ftptype == IP_CT_FTP_PASV
-           || ct_ftp_info->ftptype == IP_CT_FTP_EPSV) {
+       if (exp_ftp_info->ftptype == IP_CT_FTP_PASV
+           || exp_ftp_info->ftptype == IP_CT_FTP_EPSV) {
                /* PASV/EPSV response: must be where client thinks server
                   is */
                newip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip;
@@ -219,7 +219,7 @@
        newtuple.src.u.tcp.port = expect->tuple.src.u.tcp.port;
 
        /* Try to get same port: if not, try to change it. */
-       for (port = ct_ftp_info->port; port != 0; port++) {
+       for (port = exp_ftp_info->port; port != 0; port++) {
                newtuple.dst.u.tcp.port = htons(port);
 
                if (ip_conntrack_change_expect(expect, &newtuple) == 0)
@@ -228,9 +228,9 @@
        if (port == 0)
                return 0;
 
-       if (!mangle[ct_ftp_info->ftptype](pskb, newip, port,
+       if (!mangle[exp_ftp_info->ftptype](pskb, newip, port,
                                          expect->seq - ntohl(tcph->seq),
-                                         ct_ftp_info->len, ct, ctinfo))
+                                         exp_ftp_info->len, ct, ctinfo))
                return 0;
 
        return 1;
@@ -247,12 +247,12 @@
        struct tcphdr *tcph = (void *)iph + iph->ihl*4;
        unsigned int datalen;
        int dir;
-       struct ip_ct_ftp_expect *ct_ftp_info;
+       struct ip_ct_ftp_expect *exp_ftp_info;
 
        if (!exp)
                DEBUGP("ip_nat_ftp: no exp!!");
 
-       ct_ftp_info = &exp->help.exp_ftp_info;
+       exp_ftp_info = &exp->help.exp_ftp_info;
 
        /* Only mangle things once: original direction in POST_ROUTING
           and reply direction on PRE_ROUTING. */
@@ -270,10 +270,10 @@
        datalen = (*pskb)->len - iph->ihl * 4 - tcph->doff * 4;
        LOCK_BH(&ip_ftp_lock);
        /* If it's in the right range... */
-       if (between(exp->seq + ct_ftp_info->len,
+       if (between(exp->seq + exp_ftp_info->len,
                    ntohl(tcph->seq),
                    ntohl(tcph->seq) + datalen)) {
-               if (!ftp_data_fixup(ct_ftp_info, ct, pskb, ctinfo, exp)) {
+               if (!ftp_data_fixup(exp_ftp_info, ct, pskb, ctinfo, exp)) {
                        UNLOCK_BH(&ip_ftp_lock);
                        return NF_DROP;
                }
@@ -282,7 +282,7 @@
                   It's a cracker being funky. */
                if (net_ratelimit()) {
                        printk("FTP_NAT: partial packet %u/%u in %u/%u\n",
-                              exp->seq, ct_ftp_info->len,
+                              exp->seq, exp_ftp_info->len,
                               ntohl(tcph->seq),
                               ntohl(tcph->seq) + datalen);
                }
diff -Nru a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c
--- a/net/ipv4/netfilter/ip_nat_irc.c   2004-08-08 01:41:06 +02:00
+++ b/net/ipv4/netfilter/ip_nat_irc.c   2004-08-08 01:41:06 +02:00
@@ -87,7 +87,7 @@
        return ip_nat_setup_info(ct, &mr, hooknum);
 }
 
-static int irc_data_fixup(const struct ip_ct_irc_expect *ct_irc_info,
+static int irc_data_fixup(const struct ip_ct_irc_expect *exp_irc_info,
                          struct ip_conntrack *ct,
                          struct sk_buff **pskb,
                          enum ip_conntrack_info ctinfo,
@@ -105,7 +105,7 @@
        MUST_BE_LOCKED(&ip_irc_lock);
 
        DEBUGP("IRC_NAT: info (seq %u + %u) in %u\n",
-              expect->seq, ct_irc_info->len,
+              expect->seq, exp_irc_info->len,
               ntohl(tcph->seq));
 
        newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip;
@@ -118,7 +118,7 @@
 
        t = expect->tuple;
        t.dst.ip = newip;
-       for (port = ct_irc_info->port; port != 0; port++) {
+       for (port = exp_irc_info->port; port != 0; port++) {
                t.dst.u.tcp.port = htons(port);
                if (ip_conntrack_change_expect(expect, &t) == 0) {
                        DEBUGP("using port %d", port);
@@ -148,7 +148,7 @@
 
        return ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, 
                                        expect->seq - ntohl(tcph->seq),
-                                       ct_irc_info->len, buffer, 
+                                       exp_irc_info->len, buffer, 
                                        strlen(buffer));
 }
 
@@ -163,12 +163,12 @@
        struct tcphdr *tcph = (void *) iph + iph->ihl * 4;
        unsigned int datalen;
        int dir;
-       struct ip_ct_irc_expect *ct_irc_info;
+       struct ip_ct_irc_expect *exp_irc_info;
 
        if (!exp)
                DEBUGP("ip_nat_irc: no exp!!");
                
-       ct_irc_info = &exp->help.exp_irc_info;
+       exp_irc_info = &exp->help.exp_irc_info;
 
        /* Only mangle things once: original direction in POST_ROUTING
           and reply direction on PRE_ROUTING. */
@@ -187,10 +187,10 @@
        datalen = (*pskb)->len - iph->ihl * 4 - tcph->doff * 4;
        LOCK_BH(&ip_irc_lock);
        /* Check whether the whole IP/address pattern is carried in the payload 
*/
-       if (between(exp->seq + ct_irc_info->len,
+       if (between(exp->seq + exp_irc_info->len,
                    ntohl(tcph->seq),
                    ntohl(tcph->seq) + datalen)) {
-               if (!irc_data_fixup(ct_irc_info, ct, pskb, ctinfo, exp)) {
+               if (!irc_data_fixup(exp_irc_info, ct, pskb, ctinfo, exp)) {
                        UNLOCK_BH(&ip_irc_lock);
                        return NF_DROP;
                }
@@ -200,7 +200,7 @@
                if (net_ratelimit()) {
                        printk
                            ("IRC_NAT: partial packet %u/%u in %u/%u\n",
-                            exp->seq, ct_irc_info->len,
+                            exp->seq, exp_irc_info->len,
                             ntohl(tcph->seq),
                             ntohl(tcph->seq) + datalen);
                }
-- 
- Harald Welte <laforge@xxxxxxxxxxxxx>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 2.6] 1/2: Rename NAT helper structures, Harald Welte <=