aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-03-25 23:17:13 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-25 23:17:13 -0400
commit212440a7d04a12ee13787afecc6c86c7fc4e6184 (patch)
treeaaf903166f76a5c6d3cabe74465202b5441fee45 /net/ipv4
parent2a6cfb22ae002330d445f734668d9158db9e90de (diff)
[NETFILTER]: nf_conntrack_sip: remove redundant function arguments
The conntrack reference and ctinfo can be derived from the packet. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index e77122e65283..acaa7d4569fa 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -78,11 +78,12 @@ static unsigned int mangle_packet(struct sk_buff *skb,
78 return 1; 78 return 1;
79} 79}
80 80
81static int map_sip_addr(struct sk_buff *skb, enum ip_conntrack_info ctinfo, 81static int map_sip_addr(struct sk_buff *skb,
82 struct nf_conn *ct,
83 const char **dptr, unsigned int *datalen, 82 const char **dptr, unsigned int *datalen,
84 enum sip_header_pos pos, struct addr_map *map) 83 enum sip_header_pos pos, struct addr_map *map)
85{ 84{
85 enum ip_conntrack_info ctinfo;
86 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
86 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 87 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
87 unsigned int matchlen, matchoff, addrlen; 88 unsigned int matchlen, matchoff, addrlen;
88 char *addr; 89 char *addr;
@@ -109,10 +110,10 @@ static int map_sip_addr(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
109} 110}
110 111
111static unsigned int ip_nat_sip(struct sk_buff *skb, 112static unsigned int ip_nat_sip(struct sk_buff *skb,
112 enum ip_conntrack_info ctinfo,
113 struct nf_conn *ct,
114 const char **dptr, unsigned int *datalen) 113 const char **dptr, unsigned int *datalen)
115{ 114{
115 enum ip_conntrack_info ctinfo;
116 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
116 enum sip_header_pos pos; 117 enum sip_header_pos pos;
117 struct addr_map map; 118 struct addr_map map;
118 119
@@ -134,25 +135,25 @@ static unsigned int ip_nat_sip(struct sk_buff *skb,
134 else 135 else
135 pos = POS_REQ_URI; 136 pos = POS_REQ_URI;
136 137
137 if (!map_sip_addr(skb, ctinfo, ct, dptr, datalen, pos, &map)) 138 if (!map_sip_addr(skb, dptr, datalen, pos, &map))
138 return NF_DROP; 139 return NF_DROP;
139 } 140 }
140 141
141 if (!map_sip_addr(skb, ctinfo, ct, dptr, datalen, POS_FROM, &map) || 142 if (!map_sip_addr(skb, dptr, datalen, POS_FROM, &map) ||
142 !map_sip_addr(skb, ctinfo, ct, dptr, datalen, POS_TO, &map) || 143 !map_sip_addr(skb, dptr, datalen, POS_TO, &map) ||
143 !map_sip_addr(skb, ctinfo, ct, dptr, datalen, POS_VIA, &map) || 144 !map_sip_addr(skb, dptr, datalen, POS_VIA, &map) ||
144 !map_sip_addr(skb, ctinfo, ct, dptr, datalen, POS_CONTACT, &map)) 145 !map_sip_addr(skb, dptr, datalen, POS_CONTACT, &map))
145 return NF_DROP; 146 return NF_DROP;
146 return NF_ACCEPT; 147 return NF_ACCEPT;
147} 148}
148 149
149static unsigned int mangle_sip_packet(struct sk_buff *skb, 150static unsigned int mangle_sip_packet(struct sk_buff *skb,
150 enum ip_conntrack_info ctinfo,
151 struct nf_conn *ct,
152 const char **dptr, unsigned int *datalen, 151 const char **dptr, unsigned int *datalen,
153 char *buffer, int bufflen, 152 char *buffer, int bufflen,
154 enum sip_header_pos pos) 153 enum sip_header_pos pos)
155{ 154{
155 enum ip_conntrack_info ctinfo;
156 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
156 unsigned int matchlen, matchoff; 157 unsigned int matchlen, matchoff;
157 158
158 if (ct_sip_get_info(ct, *dptr, *datalen, &matchoff, &matchlen, 159 if (ct_sip_get_info(ct, *dptr, *datalen, &matchoff, &matchlen,
@@ -164,10 +165,10 @@ static unsigned int mangle_sip_packet(struct sk_buff *skb,
164} 165}
165 166
166static int mangle_content_len(struct sk_buff *skb, 167static int mangle_content_len(struct sk_buff *skb,
167 enum ip_conntrack_info ctinfo,
168 struct nf_conn *ct,
169 const char **dptr, unsigned int *datalen) 168 const char **dptr, unsigned int *datalen)
170{ 169{
170 enum ip_conntrack_info ctinfo;
171 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
171 unsigned int matchoff, matchlen; 172 unsigned int matchoff, matchlen;
172 char buffer[sizeof("65536")]; 173 char buffer[sizeof("65536")];
173 int bufflen; 174 int bufflen;
@@ -204,21 +205,21 @@ static unsigned int mangle_sdp(struct sk_buff *skb,
204 205
205 /* Mangle owner and contact info. */ 206 /* Mangle owner and contact info. */
206 bufflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(newip)); 207 bufflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(newip));
207 if (!mangle_sip_packet(skb, ctinfo, ct, dptr, datalen, 208 if (!mangle_sip_packet(skb, dptr, datalen, buffer, bufflen,
208 buffer, bufflen, POS_OWNER_IP4)) 209 POS_OWNER_IP4))
209 return 0; 210 return 0;
210 211
211 if (!mangle_sip_packet(skb, ctinfo, ct, dptr, datalen, 212 if (!mangle_sip_packet(skb, dptr, datalen, buffer, bufflen,
212 buffer, bufflen, POS_CONNECTION_IP4)) 213 POS_CONNECTION_IP4))
213 return 0; 214 return 0;
214 215
215 /* Mangle media port. */ 216 /* Mangle media port. */
216 bufflen = sprintf(buffer, "%u", port); 217 bufflen = sprintf(buffer, "%u", port);
217 if (!mangle_sip_packet(skb, ctinfo, ct, dptr, datalen, 218 if (!mangle_sip_packet(skb, dptr, datalen, buffer, bufflen,
218 buffer, bufflen, POS_MEDIA)) 219 POS_MEDIA))
219 return 0; 220 return 0;
220 221
221 return mangle_content_len(skb, ctinfo, ct, dptr, datalen); 222 return mangle_content_len(skb, dptr, datalen);
222} 223}
223 224
224static void ip_nat_sdp_expect(struct nf_conn *ct, 225static void ip_nat_sdp_expect(struct nf_conn *ct,
@@ -245,11 +246,11 @@ static void ip_nat_sdp_expect(struct nf_conn *ct,
245/* So, this packet has hit the connection tracking matching code. 246/* So, this packet has hit the connection tracking matching code.
246 Mangle it, and change the expectation to match the new version. */ 247 Mangle it, and change the expectation to match the new version. */
247static unsigned int ip_nat_sdp(struct sk_buff *skb, 248static unsigned int ip_nat_sdp(struct sk_buff *skb,
248 enum ip_conntrack_info ctinfo, 249 const char **dptr, unsigned int *datalen,
249 struct nf_conntrack_expect *exp, 250 struct nf_conntrack_expect *exp)
250 const char **dptr, unsigned int *datalen)
251{ 251{
252 struct nf_conn *ct = exp->master; 252 enum ip_conntrack_info ctinfo;
253 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
253 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 254 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
254 __be32 newip; 255 __be32 newip;
255 u_int16_t port; 256 u_int16_t port;