[NETFILTER]: Replace sk_buff ** with sk_buff *
With all the users of the double pointers removed, this patch mops up by finally replacing all occurances of sk_buff ** in the netfilter API by sk_buff *. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
2ca7b0ac02
commit
3db05fea51
@@ -205,7 +205,7 @@ ip6_checkentry(const struct ip6t_ip6 *ipv6)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
ip6t_error(struct sk_buff **pskb,
|
||||
ip6t_error(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
@@ -350,7 +350,7 @@ static void trace_packet(struct sk_buff *skb,
|
||||
|
||||
/* Returns one of the generic firewall policies, like NF_ACCEPT. */
|
||||
unsigned int
|
||||
ip6t_do_table(struct sk_buff **pskb,
|
||||
ip6t_do_table(struct sk_buff *skb,
|
||||
unsigned int hook,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
@@ -389,17 +389,17 @@ ip6t_do_table(struct sk_buff **pskb,
|
||||
do {
|
||||
IP_NF_ASSERT(e);
|
||||
IP_NF_ASSERT(back);
|
||||
if (ip6_packet_match(*pskb, indev, outdev, &e->ipv6,
|
||||
if (ip6_packet_match(skb, indev, outdev, &e->ipv6,
|
||||
&protoff, &offset, &hotdrop)) {
|
||||
struct ip6t_entry_target *t;
|
||||
|
||||
if (IP6T_MATCH_ITERATE(e, do_match,
|
||||
*pskb, in, out,
|
||||
skb, in, out,
|
||||
offset, protoff, &hotdrop) != 0)
|
||||
goto no_match;
|
||||
|
||||
ADD_COUNTER(e->counters,
|
||||
ntohs(ipv6_hdr(*pskb)->payload_len)
|
||||
ntohs(ipv6_hdr(skb)->payload_len)
|
||||
+ IPV6_HDR_LEN,
|
||||
1);
|
||||
|
||||
@@ -409,8 +409,8 @@ ip6t_do_table(struct sk_buff **pskb,
|
||||
#if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \
|
||||
defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE)
|
||||
/* The packet is traced: log it */
|
||||
if (unlikely((*pskb)->nf_trace))
|
||||
trace_packet(*pskb, hook, in, out,
|
||||
if (unlikely(skb->nf_trace))
|
||||
trace_packet(skb, hook, in, out,
|
||||
table->name, private, e);
|
||||
#endif
|
||||
/* Standard target? */
|
||||
@@ -448,7 +448,7 @@ ip6t_do_table(struct sk_buff **pskb,
|
||||
((struct ip6t_entry *)table_base)->comefrom
|
||||
= 0xeeeeeeec;
|
||||
#endif
|
||||
verdict = t->u.kernel.target->target(pskb,
|
||||
verdict = t->u.kernel.target->target(skb,
|
||||
in, out,
|
||||
hook,
|
||||
t->u.kernel.target,
|
||||
|
@@ -18,7 +18,7 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
|
||||
MODULE_DESCRIPTION("IP6 tables Hop Limit modification module");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static unsigned int ip6t_hl_target(struct sk_buff **pskb,
|
||||
static unsigned int ip6t_hl_target(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
@@ -29,10 +29,10 @@ static unsigned int ip6t_hl_target(struct sk_buff **pskb,
|
||||
const struct ip6t_HL_info *info = targinfo;
|
||||
int new_hl;
|
||||
|
||||
if (!skb_make_writable(*pskb, (*pskb)->len))
|
||||
if (!skb_make_writable(skb, skb->len))
|
||||
return NF_DROP;
|
||||
|
||||
ip6h = ipv6_hdr(*pskb);
|
||||
ip6h = ipv6_hdr(skb);
|
||||
|
||||
switch (info->mode) {
|
||||
case IP6T_HL_SET:
|
||||
|
@@ -431,7 +431,7 @@ ip6t_log_packet(unsigned int pf,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
ip6t_log_target(struct sk_buff **pskb,
|
||||
ip6t_log_target(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
@@ -445,8 +445,7 @@ ip6t_log_target(struct sk_buff **pskb,
|
||||
li.u.log.level = loginfo->level;
|
||||
li.u.log.logflags = loginfo->logflags;
|
||||
|
||||
ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,
|
||||
loginfo->prefix);
|
||||
ip6t_log_packet(PF_INET6, hooknum, skb, in, out, &li, loginfo->prefix);
|
||||
return XT_CONTINUE;
|
||||
}
|
||||
|
||||
|
@@ -172,7 +172,7 @@ send_unreach(struct sk_buff *skb_in, unsigned char code, unsigned int hooknum)
|
||||
icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0, NULL);
|
||||
}
|
||||
|
||||
static unsigned int reject6_target(struct sk_buff **pskb,
|
||||
static unsigned int reject6_target(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
@@ -187,25 +187,25 @@ static unsigned int reject6_target(struct sk_buff **pskb,
|
||||
must return an absolute verdict. --RR */
|
||||
switch (reject->with) {
|
||||
case IP6T_ICMP6_NO_ROUTE:
|
||||
send_unreach(*pskb, ICMPV6_NOROUTE, hooknum);
|
||||
send_unreach(skb, ICMPV6_NOROUTE, hooknum);
|
||||
break;
|
||||
case IP6T_ICMP6_ADM_PROHIBITED:
|
||||
send_unreach(*pskb, ICMPV6_ADM_PROHIBITED, hooknum);
|
||||
send_unreach(skb, ICMPV6_ADM_PROHIBITED, hooknum);
|
||||
break;
|
||||
case IP6T_ICMP6_NOT_NEIGHBOUR:
|
||||
send_unreach(*pskb, ICMPV6_NOT_NEIGHBOUR, hooknum);
|
||||
send_unreach(skb, ICMPV6_NOT_NEIGHBOUR, hooknum);
|
||||
break;
|
||||
case IP6T_ICMP6_ADDR_UNREACH:
|
||||
send_unreach(*pskb, ICMPV6_ADDR_UNREACH, hooknum);
|
||||
send_unreach(skb, ICMPV6_ADDR_UNREACH, hooknum);
|
||||
break;
|
||||
case IP6T_ICMP6_PORT_UNREACH:
|
||||
send_unreach(*pskb, ICMPV6_PORT_UNREACH, hooknum);
|
||||
send_unreach(skb, ICMPV6_PORT_UNREACH, hooknum);
|
||||
break;
|
||||
case IP6T_ICMP6_ECHOREPLY:
|
||||
/* Do nothing */
|
||||
break;
|
||||
case IP6T_TCP_RESET:
|
||||
send_reset(*pskb);
|
||||
send_reset(skb);
|
||||
break;
|
||||
default:
|
||||
if (net_ratelimit())
|
||||
|
@@ -60,32 +60,32 @@ static struct xt_table packet_filter = {
|
||||
/* The work comes in here from netfilter.c. */
|
||||
static unsigned int
|
||||
ip6t_hook(unsigned int hook,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
return ip6t_do_table(pskb, hook, in, out, &packet_filter);
|
||||
return ip6t_do_table(skb, hook, in, out, &packet_filter);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
ip6t_local_out_hook(unsigned int hook,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
#if 0
|
||||
/* root is playing with raw sockets. */
|
||||
if ((*pskb)->len < sizeof(struct iphdr)
|
||||
|| ip_hdrlen(*pskb) < sizeof(struct iphdr)) {
|
||||
if (skb->len < sizeof(struct iphdr)
|
||||
|| ip_hdrlen(skb) < sizeof(struct iphdr)) {
|
||||
if (net_ratelimit())
|
||||
printk("ip6t_hook: happy cracking.\n");
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ip6t_do_table(pskb, hook, in, out, &packet_filter);
|
||||
return ip6t_do_table(skb, hook, in, out, &packet_filter);
|
||||
}
|
||||
|
||||
static struct nf_hook_ops ip6t_ops[] = {
|
||||
|
@@ -68,17 +68,17 @@ static struct xt_table packet_mangler = {
|
||||
/* The work comes in here from netfilter.c. */
|
||||
static unsigned int
|
||||
ip6t_route_hook(unsigned int hook,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
return ip6t_do_table(pskb, hook, in, out, &packet_mangler);
|
||||
return ip6t_do_table(skb, hook, in, out, &packet_mangler);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
ip6t_local_hook(unsigned int hook,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
@@ -91,8 +91,8 @@ ip6t_local_hook(unsigned int hook,
|
||||
|
||||
#if 0
|
||||
/* root is playing with raw sockets. */
|
||||
if ((*pskb)->len < sizeof(struct iphdr)
|
||||
|| ip_hdrlen(*pskb) < sizeof(struct iphdr)) {
|
||||
if (skb->len < sizeof(struct iphdr)
|
||||
|| ip_hdrlen(skb) < sizeof(struct iphdr)) {
|
||||
if (net_ratelimit())
|
||||
printk("ip6t_hook: happy cracking.\n");
|
||||
return NF_ACCEPT;
|
||||
@@ -100,22 +100,22 @@ ip6t_local_hook(unsigned int hook,
|
||||
#endif
|
||||
|
||||
/* save source/dest address, mark, hoplimit, flowlabel, priority, */
|
||||
memcpy(&saddr, &ipv6_hdr(*pskb)->saddr, sizeof(saddr));
|
||||
memcpy(&daddr, &ipv6_hdr(*pskb)->daddr, sizeof(daddr));
|
||||
mark = (*pskb)->mark;
|
||||
hop_limit = ipv6_hdr(*pskb)->hop_limit;
|
||||
memcpy(&saddr, &ipv6_hdr(skb)->saddr, sizeof(saddr));
|
||||
memcpy(&daddr, &ipv6_hdr(skb)->daddr, sizeof(daddr));
|
||||
mark = skb->mark;
|
||||
hop_limit = ipv6_hdr(skb)->hop_limit;
|
||||
|
||||
/* flowlabel and prio (includes version, which shouldn't change either */
|
||||
flowlabel = *((u_int32_t *)ipv6_hdr(*pskb));
|
||||
flowlabel = *((u_int32_t *)ipv6_hdr(skb));
|
||||
|
||||
ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
|
||||
ret = ip6t_do_table(skb, hook, in, out, &packet_mangler);
|
||||
|
||||
if (ret != NF_DROP && ret != NF_STOLEN
|
||||
&& (memcmp(&ipv6_hdr(*pskb)->saddr, &saddr, sizeof(saddr))
|
||||
|| memcmp(&ipv6_hdr(*pskb)->daddr, &daddr, sizeof(daddr))
|
||||
|| (*pskb)->mark != mark
|
||||
|| ipv6_hdr(*pskb)->hop_limit != hop_limit))
|
||||
return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP;
|
||||
&& (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr))
|
||||
|| memcmp(&ipv6_hdr(skb)->daddr, &daddr, sizeof(daddr))
|
||||
|| skb->mark != mark
|
||||
|| ipv6_hdr(skb)->hop_limit != hop_limit))
|
||||
return ip6_route_me_harder(skb) == 0 ? ret : NF_DROP;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -46,12 +46,12 @@ static struct xt_table packet_raw = {
|
||||
/* The work comes in here from netfilter.c. */
|
||||
static unsigned int
|
||||
ip6t_hook(unsigned int hook,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
return ip6t_do_table(pskb, hook, in, out, &packet_raw);
|
||||
return ip6t_do_table(skb, hook, in, out, &packet_raw);
|
||||
}
|
||||
|
||||
static struct nf_hook_ops ip6t_ops[] = {
|
||||
|
@@ -145,7 +145,7 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
|
||||
}
|
||||
|
||||
static unsigned int ipv6_confirm(unsigned int hooknum,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
@@ -155,12 +155,12 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
|
||||
struct nf_conntrack_helper *helper;
|
||||
enum ip_conntrack_info ctinfo;
|
||||
unsigned int ret, protoff;
|
||||
unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
|
||||
unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
|
||||
unsigned int extoff = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
|
||||
unsigned char pnum = ipv6_hdr(skb)->nexthdr;
|
||||
|
||||
|
||||
/* This is where we call the helper: as the packet goes out. */
|
||||
ct = nf_ct_get(*pskb, &ctinfo);
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
|
||||
goto out;
|
||||
|
||||
@@ -172,23 +172,23 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
|
||||
if (!helper)
|
||||
goto out;
|
||||
|
||||
protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
|
||||
(*pskb)->len - extoff);
|
||||
if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) {
|
||||
protoff = nf_ct_ipv6_skip_exthdr(skb, extoff, &pnum,
|
||||
skb->len - extoff);
|
||||
if (protoff > skb->len || pnum == NEXTHDR_FRAGMENT) {
|
||||
pr_debug("proto header not found\n");
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
ret = helper->help(pskb, protoff, ct, ctinfo);
|
||||
ret = helper->help(skb, protoff, ct, ctinfo);
|
||||
if (ret != NF_ACCEPT)
|
||||
return ret;
|
||||
out:
|
||||
/* We've seen it coming out the other side: confirm it */
|
||||
return nf_conntrack_confirm(pskb);
|
||||
return nf_conntrack_confirm(skb);
|
||||
}
|
||||
|
||||
static unsigned int ipv6_defrag(unsigned int hooknum,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
@@ -196,17 +196,17 @@ static unsigned int ipv6_defrag(unsigned int hooknum,
|
||||
struct sk_buff *reasm;
|
||||
|
||||
/* Previously seen (loopback)? */
|
||||
if ((*pskb)->nfct)
|
||||
if (skb->nfct)
|
||||
return NF_ACCEPT;
|
||||
|
||||
reasm = nf_ct_frag6_gather(*pskb);
|
||||
reasm = nf_ct_frag6_gather(skb);
|
||||
|
||||
/* queued */
|
||||
if (reasm == NULL)
|
||||
return NF_STOLEN;
|
||||
|
||||
/* error occured or not fragmented */
|
||||
if (reasm == *pskb)
|
||||
if (reasm == skb)
|
||||
return NF_ACCEPT;
|
||||
|
||||
nf_ct_frag6_output(hooknum, reasm, (struct net_device *)in,
|
||||
@@ -216,12 +216,12 @@ static unsigned int ipv6_defrag(unsigned int hooknum,
|
||||
}
|
||||
|
||||
static unsigned int ipv6_conntrack_in(unsigned int hooknum,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
struct sk_buff *reasm = (*pskb)->nfct_reasm;
|
||||
struct sk_buff *reasm = skb->nfct_reasm;
|
||||
|
||||
/* This packet is fragmented and has reassembled packet. */
|
||||
if (reasm) {
|
||||
@@ -229,32 +229,32 @@ static unsigned int ipv6_conntrack_in(unsigned int hooknum,
|
||||
if (!reasm->nfct) {
|
||||
unsigned int ret;
|
||||
|
||||
ret = nf_conntrack_in(PF_INET6, hooknum, &reasm);
|
||||
ret = nf_conntrack_in(PF_INET6, hooknum, reasm);
|
||||
if (ret != NF_ACCEPT)
|
||||
return ret;
|
||||
}
|
||||
nf_conntrack_get(reasm->nfct);
|
||||
(*pskb)->nfct = reasm->nfct;
|
||||
(*pskb)->nfctinfo = reasm->nfctinfo;
|
||||
skb->nfct = reasm->nfct;
|
||||
skb->nfctinfo = reasm->nfctinfo;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
return nf_conntrack_in(PF_INET6, hooknum, pskb);
|
||||
return nf_conntrack_in(PF_INET6, hooknum, skb);
|
||||
}
|
||||
|
||||
static unsigned int ipv6_conntrack_local(unsigned int hooknum,
|
||||
struct sk_buff **pskb,
|
||||
struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
/* root is playing with raw sockets. */
|
||||
if ((*pskb)->len < sizeof(struct ipv6hdr)) {
|
||||
if (skb->len < sizeof(struct ipv6hdr)) {
|
||||
if (net_ratelimit())
|
||||
printk("ipv6_conntrack_local: packet too short\n");
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
return ipv6_conntrack_in(hooknum, pskb, in, out, okfn);
|
||||
return ipv6_conntrack_in(hooknum, skb, in, out, okfn);
|
||||
}
|
||||
|
||||
static struct nf_hook_ops ipv6_conntrack_ops[] = {
|
||||
|
Reference in New Issue
Block a user