Function signature for targets stayed the same since 3.7.
}
}
-static unsigned int ipt_acc_target(struct sk_buff **pskb, const struct xt_action_param *par)
+static unsigned int
+ipt_acc_target(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ipt_acc_info *info =
par->targinfo;
- __be32 src_ip = ip_hdr(*pskb)->saddr;
- __be32 dst_ip = ip_hdr(*pskb)->daddr;
- uint32_t size = ntohs(ip_hdr(*pskb)->tot_len);
+ __be32 src_ip = ip_hdr(skb)->saddr;
+ __be32 dst_ip = ip_hdr(skb)->daddr;
+ uint32_t size = ntohs(ip_hdr(skb)->tot_len);
spin_lock_bh(&ipt_acc_lock);
# define WITH_IPV6 1
#endif
-static unsigned int
-xtnu_target_run(struct sk_buff *skb, const struct xt_action_param *par)
-{
- struct xtnu_target *nt = xtcompat_nutarget(par->target);
-
- return nt->target(&skb, par);
-}
-
-int xtnu_register_target(struct xtnu_target *nt)
-{
- struct xt_target *ct;
- char *tmp;
- int ret;
-
- ct = kzalloc(sizeof(struct xt_target), GFP_KERNEL);
- if (ct == NULL)
- return -ENOMEM;
-
- tmp = (char *)ct->name;
- memcpy(tmp, nt->name, sizeof(nt->name));
- tmp = (char *)(ct->name + sizeof(ct->name) - sizeof(void *));
- *(tmp-1) = '\0';
- memcpy(tmp, &nt, sizeof(void *));
-
- ct->revision = nt->revision;
- ct->family = nt->family;
- ct->table = (char *)nt->table;
- ct->hooks = nt->hooks;
- ct->proto = nt->proto;
- ct->target = xtnu_target_run;
- ct->checkentry = nt->checkentry;
- ct->destroy = nt->destroy;
- ct->targetsize = nt->targetsize;
- ct->me = nt->me;
-
- nt->__compat_target = ct;
- ret = xt_register_target(ct);
- if (ret != 0)
- kfree(ct);
- return ret;
-}
-EXPORT_SYMBOL_GPL(xtnu_register_target);
-
-int xtnu_register_targets(struct xtnu_target *nt, unsigned int num)
-{
- unsigned int i;
- int ret;
-
- for (i = 0; i < num; ++i) {
- ret = xtnu_register_target(&nt[i]);
- if (ret < 0) {
- if (i > 0)
- xtnu_unregister_targets(nt, i);
- return ret;
- }
- }
- return 0;
-}
-EXPORT_SYMBOL_GPL(xtnu_register_targets);
-
-void xtnu_unregister_target(struct xtnu_target *nt)
-{
- xt_unregister_target(nt->__compat_target);
- kfree(nt->__compat_target);
-}
-EXPORT_SYMBOL_GPL(xtnu_unregister_target);
-
-void xtnu_unregister_targets(struct xtnu_target *nt, unsigned int num)
-{
- unsigned int i;
-
- for (i = 0; i < num; ++i)
- xtnu_unregister_target(&nt[i]);
-}
-EXPORT_SYMBOL_GPL(xtnu_unregister_targets);
-
void *HX_memmem(const void *space, size_t spacesize,
const void *point, size_t pointsize)
{
# define NIPQUAD_FMT "%u.%u.%u.%u"
#endif
-#define xt_target xtnu_target
-#define xt_register_target xtnu_register_target
-#define xt_unregister_target xtnu_unregister_target
-#define xt_register_targets xtnu_register_targets
-#define xt_unregister_targets xtnu_unregister_targets
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
static inline struct inode *file_inode(struct file *f)
{
}
static unsigned int
-chaos_tg(struct sk_buff **pskb, const struct xt_action_param *par)
+chaos_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
/*
* Equivalent to:
* -A chaos -j DROP;
*/
const struct xt_chaos_tginfo *info = par->targinfo;
- struct sk_buff *skb = *pskb;
const struct iphdr *iph = ip_hdr(skb);
if ((unsigned int)net_random() <= reject_percentage) {
}
static unsigned int
-delude_tg(struct sk_buff **pskb, const struct xt_action_param *par)
+delude_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
/*
* Sending the reset causes reentrancy within iptables - and should not pose
* a problem, as that is supported since Linux 2.6.35. But since we do not
* actually want to have a connection open, we are still going to drop it.
*/
- delude_send_reset(*pskb, par->hooknum);
+ delude_send_reset(skb, par->hooknum);
return NF_DROP;
}
}
static unsigned int
-dhcpmac_tg(struct sk_buff **pskb, const struct xt_action_param *par)
+dhcpmac_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct dhcpmac_info *info = par->targinfo;
struct dhcp_message dhcpbuf, *dh;
struct udphdr udpbuf, *udph;
- struct sk_buff *skb = *pskb;
unsigned int i;
if (!skb_make_writable(skb, 0))
}
static unsigned int
-dnetmap_tg(struct sk_buff **pskb, const struct xt_action_param *par)
+dnetmap_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
- struct sk_buff *skb = *pskb;
struct net *net = dev_net(par->in ? par->in : par->out);
struct dnetmap_net *dnetmap_net = dnetmap_pernet(net);
struct nf_conn *ct;
#include "compat_xtables.h"
static unsigned int
-echo_tg6(struct sk_buff **poldskb, const struct xt_action_param *par)
+echo_tg6(struct sk_buff *oldskb, const struct xt_action_param *par)
{
- const struct sk_buff *oldskb = *poldskb;
const struct udphdr *oldudp;
const struct ipv6hdr *oldip;
struct udphdr *newudp, oldudp_buf;
struct net *net = dev_net((par->in != NULL) ? par->in : par->out);
/* This allows us to do the copy operation in fewer lines of code. */
- if (skb_linearize(*poldskb) < 0)
+ if (skb_linearize(oldskb) < 0)
return NF_DROP;
oldip = ipv6_hdr(oldskb);
if (newskb->len > dst_mtu(skb_dst(newskb)))
goto free_nskb;
- nf_ct_attach(newskb, *poldskb);
+ nf_ct_attach(newskb, oldskb);
ip6_local_out(newskb);
return NF_DROP;
}
static unsigned int
-echo_tg4(struct sk_buff **poldskb, const struct xt_action_param *par)
+echo_tg4(struct sk_buff *oldskb, const struct xt_action_param *par)
{
- const struct sk_buff *oldskb = *poldskb;
const struct udphdr *oldudp;
const struct iphdr *oldip;
struct udphdr *newudp, oldudp_buf;
void *payload;
/* This allows us to do the copy operation in fewer lines of code. */
- if (skb_linearize(*poldskb) < 0)
+ if (skb_linearize(oldskb) < 0)
return NF_DROP;
oldip = ip_hdr(oldskb);
if (newskb->len > dst_mtu(skb_dst(newskb)))
goto free_nskb;
- nf_ct_attach(newskb, *poldskb);
+ nf_ct_attach(newskb, oldskb);
ip_local_out(newskb);
return NF_DROP;
MODULE_ALIAS("ip6t_IPMARK");
static unsigned int
-ipmark_tg4(struct sk_buff **pskb, const struct xt_action_param *par)
+ipmark_tg4(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_ipmark_tginfo *ipmarkinfo = par->targinfo;
- const struct sk_buff *skb = *pskb;
const struct iphdr *iph = ip_hdr(skb);
__u32 mark;
}
static unsigned int
-ipmark_tg6(struct sk_buff **pskb, const struct xt_action_param *par)
+ipmark_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_ipmark_tginfo *info = par->targinfo;
- const struct sk_buff *skb = *pskb;
const struct ipv6hdr *iph = ipv6_hdr(skb);
__u32 mark;
}
static unsigned int
-logmark_tg(struct sk_buff **pskb, const struct xt_action_param *par)
+logmark_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
- const struct sk_buff *skb = *pskb;
const struct xt_logmark_tginfo *info = par->targinfo;
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
#endif
static unsigned int
-sysrq_tg4(struct sk_buff **pskb, const struct xt_action_param *par)
+sysrq_tg4(struct sk_buff *skb, const struct xt_action_param *par)
{
- struct sk_buff *skb = *pskb;
const struct iphdr *iph;
const struct udphdr *udph;
uint16_t len;
#ifdef WITH_IPV6
static unsigned int
-sysrq_tg6(struct sk_buff **pskb, const struct xt_action_param *par)
+sysrq_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
- struct sk_buff *skb = *pskb;
const struct ipv6hdr *iph;
const struct udphdr *udph;
unsigned short frag_off;
#endif
static unsigned int
-tarpit_tg4(struct sk_buff **pskb, const struct xt_action_param *par)
+tarpit_tg4(struct sk_buff *skb, const struct xt_action_param *par)
{
- const struct sk_buff *skb = *pskb;
const struct iphdr *iph = ip_hdr(skb);
const struct rtable *rt = skb_rtable(skb);
const struct xt_tarpit_tginfo *info = par->targinfo;
if (iph->frag_off & htons(IP_OFFSET))
return NF_DROP;
- tarpit_tcp4(*pskb, par->hooknum, info->variant);
+ tarpit_tcp4(skb, par->hooknum, info->variant);
return NF_DROP;
}
#ifdef WITH_IPV6
static unsigned int
-tarpit_tg6(struct sk_buff **pskb, const struct xt_action_param *par)
+tarpit_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
- const struct sk_buff *skb = *pskb;
const struct ipv6hdr *iph = ipv6_hdr(skb);
const struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
const struct xt_tarpit_tginfo *info = par->targinfo;
return NF_DROP;
}
- tarpit_tcp6(*pskb, par->hooknum, info->variant);
+ tarpit_tcp6(skb, par->hooknum, info->variant);
return NF_DROP;
}
#endif