Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Harald Welte and committed by
David S. Miller
089af26c 373ac735

+25 -25
+5
include/linux/netfilter.h
··· 193 193 /* FIXME: Before cache is ever used, this must be implemented for real. */ 194 194 extern void nf_invalidate_cache(int pf); 195 195 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 + 196 201 #else /* !CONFIG_NETFILTER */ 197 202 #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 198 203 static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
-5
include/linux/netfilter_ipv4.h
··· 80 80 #ifdef __KERNEL__ 81 81 extern int ip_route_me_harder(struct sk_buff **pskb); 82 82 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); 88 83 #endif /*__KERNEL__*/ 89 84 90 85 #endif /*__LINUX_IP_NETFILTER_H*/
+3 -3
net/core/netfilter.c
··· 512 512 return 0; 513 513 } 514 514 EXPORT_SYMBOL(ip_route_me_harder); 515 + #endif /*CONFIG_INET*/ 515 516 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) 517 518 { 518 519 struct sk_buff *nskb; 519 520 ··· 541 540 *pskb = nskb; 542 541 return 1; 543 542 } 544 - EXPORT_SYMBOL(skb_ip_make_writable); 545 - #endif /*CONFIG_INET*/ 543 + EXPORT_SYMBOL(skb_make_writable); 546 544 547 545 /* Internal logging interface, which relies on the real 548 546 LOG target modules */
+2 -2
net/ipv4/netfilter/ip_nat_core.c
··· 359 359 struct iphdr *iph; 360 360 struct ip_nat_protocol *p; 361 361 362 - if (!skb_ip_make_writable(pskb, iphdroff + sizeof(*iph))) 362 + if (!skb_make_writable(pskb, iphdroff + sizeof(*iph))) 363 363 return 0; 364 364 365 365 iph = (void *)(*pskb)->data + iphdroff; ··· 431 431 struct ip_conntrack_tuple inner, target; 432 432 int hdrlen = (*pskb)->nh.iph->ihl * 4; 433 433 434 - if (!skb_ip_make_writable(pskb, hdrlen + sizeof(*inside))) 434 + if (!skb_make_writable(pskb, hdrlen + sizeof(*inside))) 435 435 return 0; 436 436 437 437 inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4;
+4 -4
net/ipv4/netfilter/ip_nat_helper.c
··· 168 168 struct tcphdr *tcph; 169 169 int datalen; 170 170 171 - if (!skb_ip_make_writable(pskb, (*pskb)->len)) 171 + if (!skb_make_writable(pskb, (*pskb)->len)) 172 172 return 0; 173 173 174 174 if (rep_len > match_len ··· 228 228 match_offset + match_len) 229 229 return 0; 230 230 231 - if (!skb_ip_make_writable(pskb, (*pskb)->len)) 231 + if (!skb_make_writable(pskb, (*pskb)->len)) 232 232 return 0; 233 233 234 234 if (rep_len > match_len ··· 315 315 optoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct tcphdr); 316 316 optend = (*pskb)->nh.iph->ihl*4 + tcph->doff*4; 317 317 318 - if (!skb_ip_make_writable(pskb, optend)) 318 + if (!skb_make_writable(pskb, optend)) 319 319 return 0; 320 320 321 321 dir = CTINFO2DIR(ctinfo); ··· 363 363 this_way = &ct->nat.info.seq[dir]; 364 364 other_way = &ct->nat.info.seq[!dir]; 365 365 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))) 367 367 return 0; 368 368 369 369 tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4;
+1 -1
net/ipv4/netfilter/ip_nat_proto_icmp.c
··· 62 62 struct icmphdr *hdr; 63 63 unsigned int hdroff = iphdroff + iph->ihl*4; 64 64 65 - if (!skb_ip_make_writable(pskb, hdroff + sizeof(*hdr))) 65 + if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) 66 66 return 0; 67 67 68 68 hdr = (struct icmphdr *)((*pskb)->data + hdroff);
+1 -1
net/ipv4/netfilter/ip_nat_proto_tcp.c
··· 103 103 if ((*pskb)->len >= hdroff + sizeof(struct tcphdr)) 104 104 hdrsize = sizeof(struct tcphdr); 105 105 106 - if (!skb_ip_make_writable(pskb, hdroff + hdrsize)) 106 + if (!skb_make_writable(pskb, hdroff + hdrsize)) 107 107 return 0; 108 108 109 109 iph = (struct iphdr *)((*pskb)->data + iphdroff);
+1 -1
net/ipv4/netfilter/ip_nat_proto_udp.c
··· 94 94 u32 oldip, newip; 95 95 u16 *portptr, newport; 96 96 97 - if (!skb_ip_make_writable(pskb, hdroff + sizeof(*hdr))) 97 + if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) 98 98 return 0; 99 99 100 100 iph = (struct iphdr *)((*pskb)->data + iphdroff);
+1 -1
net/ipv4/netfilter/ip_nat_snmp_basic.c
··· 1275 1275 return NF_DROP; 1276 1276 } 1277 1277 1278 - if (!skb_ip_make_writable(pskb, (*pskb)->len)) 1278 + if (!skb_make_writable(pskb, (*pskb)->len)) 1279 1279 return NF_DROP; 1280 1280 1281 1281 spin_lock_bh(&snmp_lock);
+1 -1
net/ipv4/netfilter/ip_queue.c
··· 388 388 } 389 389 skb_put(e->skb, diff); 390 390 } 391 - if (!skb_ip_make_writable(&e->skb, v->data_len)) 391 + if (!skb_make_writable(&e->skb, v->data_len)) 392 392 return -ENOMEM; 393 393 memcpy(e->skb->data, v->payload, v->data_len); 394 394 e->skb->ip_summed = CHECKSUM_NONE;
+1 -1
net/ipv4/netfilter/ipt_DSCP.c
··· 39 39 if (((*pskb)->nh.iph->tos & IPT_DSCP_MASK) != sh_dscp) { 40 40 u_int16_t diffs[2]; 41 41 42 - if (!skb_ip_make_writable(pskb, sizeof(struct iphdr))) 42 + if (!skb_make_writable(pskb, sizeof(struct iphdr))) 43 43 return NF_DROP; 44 44 45 45 diffs[0] = htons((*pskb)->nh.iph->tos) ^ 0xFFFF;
+2 -2
net/ipv4/netfilter/ipt_ECN.c
··· 31 31 != (einfo->ip_ect & IPT_ECN_IP_MASK)) { 32 32 u_int16_t diffs[2]; 33 33 34 - if (!skb_ip_make_writable(pskb, sizeof(struct iphdr))) 34 + if (!skb_make_writable(pskb, sizeof(struct iphdr))) 35 35 return 0; 36 36 37 37 diffs[0] = htons((*pskb)->nh.iph->tos) ^ 0xFFFF; ··· 66 66 tcph->cwr == einfo->proto.tcp.cwr))) 67 67 return 1; 68 68 69 - if (!skb_ip_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(*tcph))) 69 + if (!skb_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(*tcph))) 70 70 return 0; 71 71 tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; 72 72
+1 -1
net/ipv4/netfilter/ipt_TCPMSS.c
··· 58 58 unsigned int i; 59 59 u_int8_t *opt; 60 60 61 - if (!skb_ip_make_writable(pskb, (*pskb)->len)) 61 + if (!skb_make_writable(pskb, (*pskb)->len)) 62 62 return NF_DROP; 63 63 64 64 if ((*pskb)->ip_summed == CHECKSUM_HW &&
+1 -1
net/ipv4/netfilter/ipt_TOS.c
··· 33 33 if (((*pskb)->nh.iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { 34 34 u_int16_t diffs[2]; 35 35 36 - if (!skb_ip_make_writable(pskb, sizeof(struct iphdr))) 36 + if (!skb_make_writable(pskb, sizeof(struct iphdr))) 37 37 return NF_DROP; 38 38 39 39 diffs[0] = htons((*pskb)->nh.iph->tos) ^ 0xFFFF;
+1 -1
net/ipv6/netfilter/ip6_queue.c
··· 384 384 } 385 385 skb_put(e->skb, diff); 386 386 } 387 - if (!skb_ip_make_writable(&e->skb, v->data_len)) 387 + if (!skb_make_writable(&e->skb, v->data_len)) 388 388 return -ENOMEM; 389 389 memcpy(e->skb->data, v->payload, v->data_len); 390 390 e->skb->ip_summed = CHECKSUM_NONE;