# define WITH_IPV6 1
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static bool xtnu_match_run(const struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- const struct xt_match *cm, const void *matchinfo, int offset,
- unsigned int protoff, bool *hotdrop)
-{
- struct xtnu_match *nm = xtcompat_numatch(cm);
- bool lo_ret;
- struct xt_action_param local_par;
- local_par.in = in;
- local_par.out = out;
- local_par.match = cm;
- local_par.matchinfo = matchinfo;
- local_par.fragoff = offset;
- local_par.thoff = protoff;
- local_par.hotdrop = false;
- local_par.family = NFPROTO_UNSPEC; /* don't have that info */
-
- if (nm == NULL || nm->match == NULL)
- return false;
- lo_ret = nm->match(skb, &local_par);
- *hotdrop = local_par.hotdrop;
- return lo_ret;
-}
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) && \
LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
static bool xtnu_match_run(const struct sk_buff *skb,
}
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static bool xtnu_match_check(const char *table, const void *entry,
- const struct xt_match *cm, void *matchinfo, unsigned int hook_mask)
-{
- struct xtnu_match *nm = xtcompat_numatch(cm);
- struct xt_mtchk_param local_par = {
- .table = table,
- .entryinfo = entry,
- .match = cm,
- .matchinfo = matchinfo,
- .hook_mask = hook_mask,
- .family = NFPROTO_UNSPEC,
- };
-
- if (nm == NULL)
- return false;
- if (nm->checkentry == NULL)
- return true;
- return nm->checkentry(&local_par) == 0;
-}
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) && \
LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
static bool xtnu_match_check(const struct xt_mtchk_param *par)
}
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static void xtnu_match_destroy(const struct xt_match *cm, void *matchinfo)
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-{
- struct xtnu_match *nm = xtcompat_numatch(cm);
- struct xt_mtdtor_param local_par = {
- .match = cm,
- .matchinfo = matchinfo,
- .family = NFPROTO_UNSPEC,
- };
-
- if (nm != NULL && nm->destroy != NULL)
- nm->destroy(&local_par);
-}
-#endif
-
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
int xtnu_register_match(struct xtnu_match *nt)
{
ct->table = (char *)nt->table;
ct->hooks = nt->hooks;
ct->proto = nt->proto;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
- ct->match = xtnu_match_run;
- ct->checkentry = xtnu_match_check;
- ct->destroy = xtnu_match_destroy;
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
ct->match = xtnu_match_run;
ct->checkentry = xtnu_match_check;
ct->destroy = nt->destroy;
EXPORT_SYMBOL_GPL(xtnu_unregister_matches);
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static unsigned int xtnu_target_run(struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- unsigned int hooknum, const struct xt_target *ct, const void *targinfo)
-{
- struct xtnu_target *nt = xtcompat_nutarget(ct);
- struct xt_action_param local_par;
-
- local_par.in = in;
- local_par.out = out;
- local_par.hooknum = hooknum;
- local_par.target = ct;
- local_par.targinfo = targinfo;
- local_par.family = NFPROTO_UNSPEC;
-
- if (nt != NULL && nt->target != NULL)
- return nt->target(&skb, &local_par);
- return XT_CONTINUE;
-}
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) && \
LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
static unsigned int
}
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static bool xtnu_target_check(const char *table, const void *entry,
- const struct xt_target *ct, void *targinfo, unsigned int hook_mask)
-{
- struct xtnu_target *nt = xtcompat_nutarget(ct);
- struct xt_tgchk_param local_par = {
- .table = table,
- .entryinfo = entry,
- .target = ct,
- .targinfo = targinfo,
- .hook_mask = hook_mask,
- .family = NFPROTO_UNSPEC,
- };
-
- if (nt == NULL)
- return false;
- if (nt->checkentry == NULL)
- /* this is valid, just like if there was no function */
- return true;
- return nt->checkentry(&local_par) == 0;
-}
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) && \
LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
static bool xtnu_target_check(const struct xt_tgchk_param *par)
}
#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static void xtnu_target_destroy(const struct xt_target *ct, void *targinfo)
-{
- struct xtnu_target *nt = xtcompat_nutarget(ct);
- struct xt_tgdtor_param local_par = {
- .target = ct,
- .targinfo = targinfo,
- .family = NFPROTO_UNSPEC,
- };
-
- if (nt != NULL && nt->destroy != NULL)
- nt->destroy(&local_par);
-}
-#endif
-
int xtnu_register_target(struct xtnu_target *nt)
{
struct xt_target *ct;
ct->hooks = nt->hooks;
ct->proto = nt->proto;
ct->target = xtnu_target_run;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
- ct->checkentry = xtnu_target_check;
- ct->destroy = xtnu_target_destroy;
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
ct->checkentry = xtnu_target_check;
ct->destroy = nt->destroy;
#else
bool ret;
bool hotdrop = false;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
- ret = xm_tcp->match(skb, par->in, par->out, xm_tcp, &tcp_params,
- fragoff, thoff, &hotdrop);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
{
struct xt_match_param local_par = {
.in = par->in,
return;
destiny = (info->variant == XTCHAOS_TARPIT) ? xt_tarpit : xt_delude;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
- destiny->target(skb, par->in, par->out, par->hooknum, destiny, NULL);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
{
struct xt_target_param local_par = {
.in = par->in,
const struct iphdr *iph = ip_hdr(skb);
if ((unsigned int)net_random() <= reject_percentage) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
- return xt_reject->target(skb, par->in, par->out, par->hooknum,
- xt_reject, &reject_params);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
struct xt_target_param local_par = {
.in = par->in,
.out = par->out,