Skip to content

Commit 089af26

Browse files
laf0rgeDavid S. Miller
authored andcommitted
[NETFILTER]: Rename skb_ip_make_writable() to skb_make_writable()
There is nothing IPv4-specific in it. In fact, it was already used by IPv6, too... Upcoming nfnetlink_queue code will use it for any kind of packet. Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 373ac73 commit 089af26

15 files changed

Lines changed: 25 additions & 25 deletions

‎include/linux/netfilter.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
193193
/* FIXME: Before cache is ever used, this must be implemented for real. */
194194
extern void nf_invalidate_cache(int pf);
195195

196+
/* Call this before modifying an existing packet: ensures it is
197+
modifiable and linear to the point you care about (writable_len).
198+
Returns true or false. */
199+
extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
200+
196201
#else /* !CONFIG_NETFILTER */
197202
#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
198203
static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}

‎include/linux/netfilter_ipv4.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ enum nf_ip_hook_priorities {
8080
#ifdef __KERNEL__
8181
extern int ip_route_me_harder(struct sk_buff **pskb);
8282

83-
/* Call this before modifying an existing IP packet: ensures it is
84-
modifiable and linear to the point you care about (writable_len).
85-
Returns true or false. */
86-
extern int skb_ip_make_writable(struct sk_buff **pskb,
87-
unsigned int writable_len);
8883
#endif /*__KERNEL__*/
8984

9085
#endif /*__LINUX_IP_NETFILTER_H*/

‎net/core/netfilter.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,9 @@ int ip_route_me_harder(struct sk_buff **pskb)
512512
return 0;
513513
}
514514
EXPORT_SYMBOL(ip_route_me_harder);
515+
#endif /*CONFIG_INET*/
515516

516-
int skb_ip_make_writable(struct sk_buff **pskb, unsigned int writable_len)
517+
int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len)
517518
{
518519
struct sk_buff *nskb;
519520

@@ -540,8 +541,7 @@ int skb_ip_make_writable(struct sk_buff **pskb, unsigned int writable_len)
540541
*pskb = nskb;
541542
return 1;
542543
}
543-
EXPORT_SYMBOL(skb_ip_make_writable);
544-
#endif /*CONFIG_INET*/
544+
EXPORT_SYMBOL(skb_make_writable);
545545

546546
/* Internal logging interface, which relies on the real
547547
LOG target modules */

‎net/ipv4/netfilter/ip_nat_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ manip_pkt(u_int16_t proto,
359359
struct iphdr *iph;
360360
struct ip_nat_protocol *p;
361361

362-
if (!skb_ip_make_writable(pskb, iphdroff + sizeof(*iph)))
362+
if (!skb_make_writable(pskb, iphdroff + sizeof(*iph)))
363363
return 0;
364364

365365
iph = (void *)(*pskb)->data + iphdroff;
@@ -431,7 +431,7 @@ int icmp_reply_translation(struct sk_buff **pskb,
431431
struct ip_conntrack_tuple inner, target;
432432
int hdrlen = (*pskb)->nh.iph->ihl * 4;
433433

434-
if (!skb_ip_make_writable(pskb, hdrlen + sizeof(*inside)))
434+
if (!skb_make_writable(pskb, hdrlen + sizeof(*inside)))
435435
return 0;
436436

437437
inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4;

‎net/ipv4/netfilter/ip_nat_helper.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb,
168168
struct tcphdr *tcph;
169169
int datalen;
170170

171-
if (!skb_ip_make_writable(pskb, (*pskb)->len))
171+
if (!skb_make_writable(pskb, (*pskb)->len))
172172
return 0;
173173

174174
if (rep_len > match_len
@@ -228,7 +228,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb,
228228
match_offset + match_len)
229229
return 0;
230230

231-
if (!skb_ip_make_writable(pskb, (*pskb)->len))
231+
if (!skb_make_writable(pskb, (*pskb)->len))
232232
return 0;
233233

234234
if (rep_len > match_len
@@ -315,7 +315,7 @@ ip_nat_sack_adjust(struct sk_buff **pskb,
315315
optoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct tcphdr);
316316
optend = (*pskb)->nh.iph->ihl*4 + tcph->doff*4;
317317

318-
if (!skb_ip_make_writable(pskb, optend))
318+
if (!skb_make_writable(pskb, optend))
319319
return 0;
320320

321321
dir = CTINFO2DIR(ctinfo);
@@ -363,7 +363,7 @@ ip_nat_seq_adjust(struct sk_buff **pskb,
363363
this_way = &ct->nat.info.seq[dir];
364364
other_way = &ct->nat.info.seq[!dir];
365365

366-
if (!skb_ip_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(*tcph)))
366+
if (!skb_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(*tcph)))
367367
return 0;
368368

369369
tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4;

‎net/ipv4/netfilter/ip_nat_proto_icmp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ icmp_manip_pkt(struct sk_buff **pskb,
6262
struct icmphdr *hdr;
6363
unsigned int hdroff = iphdroff + iph->ihl*4;
6464

65-
if (!skb_ip_make_writable(pskb, hdroff + sizeof(*hdr)))
65+
if (!skb_make_writable(pskb, hdroff + sizeof(*hdr)))
6666
return 0;
6767

6868
hdr = (struct icmphdr *)((*pskb)->data + hdroff);

‎net/ipv4/netfilter/ip_nat_proto_tcp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ tcp_manip_pkt(struct sk_buff **pskb,
103103
if ((*pskb)->len >= hdroff + sizeof(struct tcphdr))
104104
hdrsize = sizeof(struct tcphdr);
105105

106-
if (!skb_ip_make_writable(pskb, hdroff + hdrsize))
106+
if (!skb_make_writable(pskb, hdroff + hdrsize))
107107
return 0;
108108

109109
iph = (struct iphdr *)((*pskb)->data + iphdroff);

‎net/ipv4/netfilter/ip_nat_proto_udp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ udp_manip_pkt(struct sk_buff **pskb,
9494
u32 oldip, newip;
9595
u16 *portptr, newport;
9696

97-
if (!skb_ip_make_writable(pskb, hdroff + sizeof(*hdr)))
97+
if (!skb_make_writable(pskb, hdroff + sizeof(*hdr)))
9898
return 0;
9999

100100
iph = (struct iphdr *)((*pskb)->data + iphdroff);

‎net/ipv4/netfilter/ip_nat_snmp_basic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ static int help(struct sk_buff **pskb,
12751275
return NF_DROP;
12761276
}
12771277

1278-
if (!skb_ip_make_writable(pskb, (*pskb)->len))
1278+
if (!skb_make_writable(pskb, (*pskb)->len))
12791279
return NF_DROP;
12801280

12811281
spin_lock_bh(&snmp_lock);

‎net/ipv4/netfilter/ip_queue.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
388388
}
389389
skb_put(e->skb, diff);
390390
}
391-
if (!skb_ip_make_writable(&e->skb, v->data_len))
391+
if (!skb_make_writable(&e->skb, v->data_len))
392392
return -ENOMEM;
393393
memcpy(e->skb->data, v->payload, v->data_len);
394394
e->skb->ip_summed = CHECKSUM_NONE;

0 commit comments

Comments
 (0)