netfilter: xtables: move extension arguments into compound structure (4/6)
This patch does this for target extensions' target functions. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
committed by
Patrick McHardy
parent
6be3d8598e
commit
7eb3558655
@@ -27,11 +27,9 @@ MODULE_ALIAS("ipt_CLASSIFY");
|
||||
MODULE_ALIAS("ip6t_CLASSIFY");
|
||||
|
||||
static unsigned int
|
||||
classify_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
classify_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_classify_target_info *clinfo = targinfo;
|
||||
const struct xt_classify_target_info *clinfo = par->targinfo;
|
||||
|
||||
skb->priority = clinfo->priority;
|
||||
return XT_CONTINUE;
|
||||
|
@@ -36,11 +36,9 @@ MODULE_ALIAS("ip6t_CONNMARK");
|
||||
#include <net/netfilter/nf_conntrack_ecache.h>
|
||||
|
||||
static unsigned int
|
||||
connmark_tg_v0(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
connmark_tg_v0(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_connmark_target_info *markinfo = targinfo;
|
||||
const struct xt_connmark_target_info *markinfo = par->targinfo;
|
||||
struct nf_conn *ct;
|
||||
enum ip_conntrack_info ctinfo;
|
||||
u_int32_t diff;
|
||||
@@ -77,11 +75,9 @@ connmark_tg_v0(struct sk_buff *skb, const struct net_device *in,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
connmark_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
connmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_connmark_tginfo1 *info = targinfo;
|
||||
const struct xt_connmark_tginfo1 *info = par->targinfo;
|
||||
enum ip_conntrack_info ctinfo;
|
||||
struct nf_conn *ct;
|
||||
u_int32_t newmark;
|
||||
|
@@ -65,11 +65,9 @@ static void secmark_restore(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
connsecmark_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
connsecmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_connsecmark_target_info *info = targinfo;
|
||||
const struct xt_connsecmark_target_info *info = par->targinfo;
|
||||
|
||||
switch (info->mode) {
|
||||
case CONNSECMARK_SAVE:
|
||||
|
@@ -29,11 +29,9 @@ MODULE_ALIAS("ipt_TOS");
|
||||
MODULE_ALIAS("ip6t_TOS");
|
||||
|
||||
static unsigned int
|
||||
dscp_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
dscp_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_DSCP_info *dinfo = targinfo;
|
||||
const struct xt_DSCP_info *dinfo = par->targinfo;
|
||||
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
|
||||
|
||||
if (dscp != dinfo->dscp) {
|
||||
@@ -48,11 +46,9 @@ dscp_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
dscp_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
dscp_tg6(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_DSCP_info *dinfo = targinfo;
|
||||
const struct xt_DSCP_info *dinfo = par->targinfo;
|
||||
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
|
||||
|
||||
if (dscp != dinfo->dscp) {
|
||||
@@ -80,11 +76,9 @@ dscp_tg_check(const char *tablename, const void *e_void,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
tos_tg_v0(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tos_tg_v0(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct ipt_tos_target_info *info = targinfo;
|
||||
const struct ipt_tos_target_info *info = par->targinfo;
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
u_int8_t oldtos;
|
||||
|
||||
@@ -119,11 +113,9 @@ tos_tg_check_v0(const char *tablename, const void *e_void,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
tos_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tos_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_tos_target_info *info = targinfo;
|
||||
const struct xt_tos_target_info *info = par->targinfo;
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
u_int8_t orig, nv;
|
||||
|
||||
@@ -141,11 +133,9 @@ tos_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
tos_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tos_tg6(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_tos_target_info *info = targinfo;
|
||||
const struct xt_tos_target_info *info = par->targinfo;
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
u_int8_t orig, nv;
|
||||
|
||||
|
@@ -25,22 +25,18 @@ MODULE_ALIAS("ipt_MARK");
|
||||
MODULE_ALIAS("ip6t_MARK");
|
||||
|
||||
static unsigned int
|
||||
mark_tg_v0(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
mark_tg_v0(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_mark_target_info *markinfo = targinfo;
|
||||
const struct xt_mark_target_info *markinfo = par->targinfo;
|
||||
|
||||
skb->mark = markinfo->mark;
|
||||
return XT_CONTINUE;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
mark_tg_v1(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
mark_tg_v1(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_mark_target_info_v1 *markinfo = targinfo;
|
||||
const struct xt_mark_target_info_v1 *markinfo = par->targinfo;
|
||||
int mark = 0;
|
||||
|
||||
switch (markinfo->mode) {
|
||||
@@ -62,11 +58,9 @@ mark_tg_v1(struct sk_buff *skb, const struct net_device *in,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
mark_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
mark_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_mark_tginfo2 *info = targinfo;
|
||||
const struct xt_mark_tginfo2 *info = par->targinfo;
|
||||
|
||||
skb->mark = (skb->mark & ~info->mask) ^ info->mark;
|
||||
return XT_CONTINUE;
|
||||
|
@@ -21,11 +21,9 @@ MODULE_ALIAS("ipt_NFLOG");
|
||||
MODULE_ALIAS("ip6t_NFLOG");
|
||||
|
||||
static unsigned int
|
||||
nflog_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
nflog_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_nflog_info *info = targinfo;
|
||||
const struct xt_nflog_info *info = par->targinfo;
|
||||
struct nf_loginfo li;
|
||||
|
||||
li.type = NF_LOG_TYPE_ULOG;
|
||||
@@ -33,8 +31,8 @@ nflog_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
li.u.ulog.group = info->group;
|
||||
li.u.ulog.qthreshold = info->threshold;
|
||||
|
||||
nf_log_packet(target->family, hooknum, skb, in, out, &li,
|
||||
"%s", info->prefix);
|
||||
nf_log_packet(par->target->family, par->hooknum, skb, par->in,
|
||||
par->out, &li, "%s", info->prefix);
|
||||
return XT_CONTINUE;
|
||||
}
|
||||
|
||||
|
@@ -24,11 +24,9 @@ MODULE_ALIAS("ip6t_NFQUEUE");
|
||||
MODULE_ALIAS("arpt_NFQUEUE");
|
||||
|
||||
static unsigned int
|
||||
nfqueue_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
nfqueue_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_NFQ_info *tinfo = targinfo;
|
||||
const struct xt_NFQ_info *tinfo = par->targinfo;
|
||||
|
||||
return NF_QUEUE_NR(tinfo->queuenum);
|
||||
}
|
||||
|
@@ -13,9 +13,7 @@ MODULE_ALIAS("ipt_NOTRACK");
|
||||
MODULE_ALIAS("ip6t_NOTRACK");
|
||||
|
||||
static unsigned int
|
||||
notrack_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
notrack_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
/* Previously seen (loopback)? Ignore. */
|
||||
if (skb->nfct != NULL)
|
||||
|
@@ -71,14 +71,9 @@ void xt_rateest_put(struct xt_rateest *est)
|
||||
EXPORT_SYMBOL_GPL(xt_rateest_put);
|
||||
|
||||
static unsigned int
|
||||
xt_rateest_tg(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
const struct xt_target *target,
|
||||
const void *targinfo)
|
||||
xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct xt_rateest_target_info *info = targinfo;
|
||||
const struct xt_rateest_target_info *info = par->targinfo;
|
||||
struct gnet_stats_basic *stats = &info->est->bstats;
|
||||
|
||||
spin_lock_bh(&info->est->lock);
|
||||
|
@@ -29,12 +29,10 @@ MODULE_ALIAS("ip6t_SECMARK");
|
||||
static u8 mode;
|
||||
|
||||
static unsigned int
|
||||
secmark_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
secmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
u32 secmark = 0;
|
||||
const struct xt_secmark_target_info *info = targinfo;
|
||||
const struct xt_secmark_target_info *info = par->targinfo;
|
||||
|
||||
BUG_ON(info->mode != mode);
|
||||
|
||||
|
@@ -174,15 +174,13 @@ static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tcpmss_tg4(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
__be16 newlen;
|
||||
int ret;
|
||||
|
||||
ret = tcpmss_mangle_packet(skb, targinfo,
|
||||
ret = tcpmss_mangle_packet(skb, par->targinfo,
|
||||
tcpmss_reverse_mtu(skb, PF_INET),
|
||||
iph->ihl * 4,
|
||||
sizeof(*iph) + sizeof(struct tcphdr));
|
||||
@@ -199,9 +197,7 @@ tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
|
||||
|
||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||
static unsigned int
|
||||
tcpmss_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tcpmss_tg6(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||
u8 nexthdr;
|
||||
@@ -212,7 +208,7 @@ tcpmss_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
|
||||
if (tcphoff < 0)
|
||||
return NF_DROP;
|
||||
ret = tcpmss_mangle_packet(skb, targinfo,
|
||||
ret = tcpmss_mangle_packet(skb, par->targinfo,
|
||||
tcpmss_reverse_mtu(skb, PF_INET6),
|
||||
tcphoff,
|
||||
sizeof(*ipv6h) + sizeof(struct tcphdr));
|
||||
|
@@ -75,19 +75,15 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
tcpoptstrip_tg4(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tcpoptstrip_tg4(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
return tcpoptstrip_mangle_packet(skb, targinfo, ip_hdrlen(skb),
|
||||
return tcpoptstrip_mangle_packet(skb, par->targinfo, ip_hdrlen(skb),
|
||||
sizeof(struct iphdr) + sizeof(struct tcphdr));
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IP6_NF_MANGLE) || defined(CONFIG_IP6_NF_MANGLE_MODULE)
|
||||
static unsigned int
|
||||
tcpoptstrip_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
tcpoptstrip_tg6(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||
int tcphoff;
|
||||
@@ -98,7 +94,7 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
if (tcphoff < 0)
|
||||
return NF_DROP;
|
||||
|
||||
return tcpoptstrip_mangle_packet(skb, targinfo, tcphoff,
|
||||
return tcpoptstrip_mangle_packet(skb, par->targinfo, tcphoff,
|
||||
sizeof(*ipv6h) + sizeof(struct tcphdr));
|
||||
}
|
||||
#endif
|
||||
|
@@ -25,15 +25,10 @@
|
||||
#include <net/netfilter/nf_tproxy_core.h>
|
||||
|
||||
static unsigned int
|
||||
tproxy_tg(struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
unsigned int hooknum,
|
||||
const struct xt_target *target,
|
||||
const void *targinfo)
|
||||
tproxy_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
const struct xt_tproxy_target_info *tgi = targinfo;
|
||||
const struct xt_tproxy_target_info *tgi = par->targinfo;
|
||||
struct udphdr _hdr, *hp;
|
||||
struct sock *sk;
|
||||
|
||||
@@ -44,7 +39,7 @@ tproxy_tg(struct sk_buff *skb,
|
||||
sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), iph->protocol,
|
||||
iph->saddr, tgi->laddr ? tgi->laddr : iph->daddr,
|
||||
hp->source, tgi->lport ? tgi->lport : hp->dest,
|
||||
in, true);
|
||||
par->in, true);
|
||||
|
||||
/* NOTE: assign_sock consumes our sk reference */
|
||||
if (sk && nf_tproxy_assign_sock(skb, sk)) {
|
||||
|
@@ -11,9 +11,7 @@ MODULE_ALIAS("ipt_TRACE");
|
||||
MODULE_ALIAS("ip6t_TRACE");
|
||||
|
||||
static unsigned int
|
||||
trace_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
const struct net_device *out, unsigned int hooknum,
|
||||
const struct xt_target *target, const void *targinfo)
|
||||
trace_tg(struct sk_buff *skb, const struct xt_target_param *par)
|
||||
{
|
||||
skb->nf_trace = 1;
|
||||
return XT_CONTINUE;
|
||||
|
Reference in New Issue
Block a user