netfilter: x_tables: use NFPROTO_* in extensions
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
7e9c6eeb13
commit
ee999d8b95
@ -39,7 +39,7 @@ classify_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
|
||||
static struct xt_target classify_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "CLASSIFY",
|
||||
.target = classify_tg,
|
||||
.targetsize = sizeof(struct xt_classify_target_info),
|
||||
@ -51,7 +51,7 @@ static struct xt_target classify_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "CLASSIFY",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = classify_tg,
|
||||
.targetsize = sizeof(struct xt_classify_target_info),
|
||||
.table = "mangle",
|
||||
|
@ -197,7 +197,7 @@ static struct xt_target connmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "CONNMARK",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connmark_tg_check_v0,
|
||||
.destroy = connmark_tg_destroy,
|
||||
.target = connmark_tg_v0,
|
||||
@ -212,7 +212,7 @@ static struct xt_target connmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "CONNMARK",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connmark_tg_check_v0,
|
||||
.destroy = connmark_tg_destroy,
|
||||
.target = connmark_tg_v0,
|
||||
@ -227,7 +227,7 @@ static struct xt_target connmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "CONNMARK",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connmark_tg_check,
|
||||
.target = connmark_tg,
|
||||
.targetsize = sizeof(struct xt_connmark_tginfo1),
|
||||
@ -237,7 +237,7 @@ static struct xt_target connmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "CONNMARK",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connmark_tg_check,
|
||||
.target = connmark_tg,
|
||||
.targetsize = sizeof(struct xt_connmark_tginfo1),
|
||||
|
@ -127,7 +127,7 @@ connsecmark_tg_destroy(const struct xt_target *target, void *targinfo)
|
||||
static struct xt_target connsecmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "CONNSECMARK",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connsecmark_tg_check,
|
||||
.destroy = connsecmark_tg_destroy,
|
||||
.target = connsecmark_tg,
|
||||
@ -136,7 +136,7 @@ static struct xt_target connsecmark_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "CONNSECMARK",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connsecmark_tg_check,
|
||||
.destroy = connsecmark_tg_destroy,
|
||||
.target = connsecmark_tg,
|
||||
|
@ -165,7 +165,7 @@ tos_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_target dscp_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "DSCP",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = dscp_tg_check,
|
||||
.target = dscp_tg,
|
||||
.targetsize = sizeof(struct xt_DSCP_info),
|
||||
@ -174,7 +174,7 @@ static struct xt_target dscp_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "DSCP",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = dscp_tg_check,
|
||||
.target = dscp_tg6,
|
||||
.targetsize = sizeof(struct xt_DSCP_info),
|
||||
@ -184,7 +184,7 @@ static struct xt_target dscp_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "TOS",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.table = "mangle",
|
||||
.target = tos_tg_v0,
|
||||
.targetsize = sizeof(struct ipt_tos_target_info),
|
||||
@ -194,7 +194,7 @@ static struct xt_target dscp_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "TOS",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.table = "mangle",
|
||||
.target = tos_tg,
|
||||
.targetsize = sizeof(struct xt_tos_target_info),
|
||||
@ -203,7 +203,7 @@ static struct xt_target dscp_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "TOS",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.table = "mangle",
|
||||
.target = tos_tg6,
|
||||
.targetsize = sizeof(struct xt_tos_target_info),
|
||||
|
@ -161,7 +161,7 @@ static int mark_tg_compat_to_user_v1(void __user *dst, void *src)
|
||||
static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "MARK",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.revision = 0,
|
||||
.checkentry = mark_tg_check_v0,
|
||||
.target = mark_tg_v0,
|
||||
@ -176,7 +176,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "MARK",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.revision = 1,
|
||||
.checkentry = mark_tg_check_v1,
|
||||
.target = mark_tg_v1,
|
||||
@ -191,7 +191,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "MARK",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.revision = 0,
|
||||
.checkentry = mark_tg_check_v0,
|
||||
.target = mark_tg_v0,
|
||||
@ -206,7 +206,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "MARK",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.revision = 1,
|
||||
.checkentry = mark_tg_check_v1,
|
||||
.target = mark_tg_v1,
|
||||
@ -222,7 +222,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "MARK",
|
||||
.revision = 2,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = mark_tg,
|
||||
.targetsize = sizeof(struct xt_mark_tginfo2),
|
||||
.me = THIS_MODULE,
|
||||
@ -230,7 +230,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "MARK",
|
||||
.revision = 2,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = mark_tg,
|
||||
.targetsize = sizeof(struct xt_mark_tginfo2),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -55,7 +55,7 @@ nflog_tg_check(const char *tablename, const void *entry,
|
||||
static struct xt_target nflog_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "NFLOG",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = nflog_tg_check,
|
||||
.target = nflog_tg,
|
||||
.targetsize = sizeof(struct xt_nflog_info),
|
||||
@ -63,7 +63,7 @@ static struct xt_target nflog_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "NFLOG",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = nflog_tg_check,
|
||||
.target = nflog_tg,
|
||||
.targetsize = sizeof(struct xt_nflog_info),
|
||||
|
@ -36,14 +36,14 @@ nfqueue_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_target nfqueue_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "NFQUEUE",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = nfqueue_tg,
|
||||
.targetsize = sizeof(struct xt_NFQ_info),
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "NFQUEUE",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = nfqueue_tg,
|
||||
.targetsize = sizeof(struct xt_NFQ_info),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -35,14 +35,14 @@ notrack_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_target notrack_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "NOTRACK",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = notrack_tg,
|
||||
.table = "raw",
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "NOTRACK",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = notrack_tg,
|
||||
.table = "raw",
|
||||
.me = THIS_MODULE,
|
||||
|
@ -159,7 +159,7 @@ static void xt_rateest_tg_destroy(const struct xt_target *target,
|
||||
|
||||
static struct xt_target xt_rateest_target[] __read_mostly = {
|
||||
{
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "RATEEST",
|
||||
.target = xt_rateest_tg,
|
||||
.checkentry = xt_rateest_tg_checkentry,
|
||||
@ -168,7 +168,7 @@ static struct xt_target xt_rateest_target[] __read_mostly = {
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.name = "RATEEST",
|
||||
.target = xt_rateest_tg,
|
||||
.checkentry = xt_rateest_tg_checkentry,
|
||||
|
@ -128,7 +128,7 @@ static void secmark_tg_destroy(const struct xt_target *target, void *targinfo)
|
||||
static struct xt_target secmark_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "SECMARK",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = secmark_tg_check,
|
||||
.destroy = secmark_tg_destroy,
|
||||
.target = secmark_tg,
|
||||
@ -137,7 +137,7 @@ static struct xt_target secmark_tg_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "SECMARK",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = secmark_tg_check,
|
||||
.destroy = secmark_tg_destroy,
|
||||
.target = secmark_tg,
|
||||
|
@ -289,7 +289,7 @@ tcpmss_tg6_check(const char *tablename, const void *entry,
|
||||
|
||||
static struct xt_target tcpmss_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "TCPMSS",
|
||||
.checkentry = tcpmss_tg4_check,
|
||||
.target = tcpmss_tg4,
|
||||
@ -299,7 +299,7 @@ static struct xt_target tcpmss_tg_reg[] __read_mostly = {
|
||||
},
|
||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||
{
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.name = "TCPMSS",
|
||||
.checkentry = tcpmss_tg6_check,
|
||||
.target = tcpmss_tg6,
|
||||
|
@ -106,7 +106,7 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_target tcpoptstrip_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "TCPOPTSTRIP",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.table = "mangle",
|
||||
.proto = IPPROTO_TCP,
|
||||
.target = tcpoptstrip_tg4,
|
||||
@ -116,7 +116,7 @@ static struct xt_target tcpoptstrip_tg_reg[] __read_mostly = {
|
||||
#if defined(CONFIG_IP6_NF_MANGLE) || defined(CONFIG_IP6_NF_MANGLE_MODULE)
|
||||
{
|
||||
.name = "TCPOPTSTRIP",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.table = "mangle",
|
||||
.proto = IPPROTO_TCP,
|
||||
.target = tcpoptstrip_tg6,
|
||||
|
@ -22,14 +22,14 @@ trace_tg(struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_target trace_tg_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "TRACE",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.target = trace_tg,
|
||||
.table = "raw",
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "TRACE",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.target = trace_tg,
|
||||
.table = "raw",
|
||||
.me = THIS_MODULE,
|
||||
|
@ -28,14 +28,14 @@ comment_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match comment_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "comment",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = comment_mt,
|
||||
.matchsize = sizeof(struct xt_comment_info),
|
||||
.me = THIS_MODULE
|
||||
},
|
||||
{
|
||||
.name = "comment",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = comment_mt,
|
||||
.matchsize = sizeof(struct xt_comment_info),
|
||||
.me = THIS_MODULE
|
||||
|
@ -130,7 +130,7 @@ connbytes_mt_destroy(const struct xt_match *match, void *matchinfo)
|
||||
static struct xt_match connbytes_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connbytes",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connbytes_mt_check,
|
||||
.match = connbytes_mt,
|
||||
.destroy = connbytes_mt_destroy,
|
||||
@ -139,7 +139,7 @@ static struct xt_match connbytes_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "connbytes",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connbytes_mt_check,
|
||||
.match = connbytes_mt,
|
||||
.destroy = connbytes_mt_destroy,
|
||||
|
@ -84,7 +84,7 @@ same_source_net(const union nf_inet_addr *addr,
|
||||
const union nf_inet_addr *mask,
|
||||
const union nf_inet_addr *u3, u_int8_t family)
|
||||
{
|
||||
if (family == AF_INET) {
|
||||
if (family == NFPROTO_IPV4) {
|
||||
return (addr->ip & mask->ip) == (u3->ip & mask->ip);
|
||||
} else {
|
||||
union nf_inet_addr lh, rh;
|
||||
@ -114,7 +114,7 @@ static int count_them(struct xt_connlimit_data *data,
|
||||
int matches = 0;
|
||||
|
||||
|
||||
if (match->family == AF_INET6)
|
||||
if (match->family == NFPROTO_IPV6)
|
||||
hash = &data->iphash[connlimit_iphash6(addr, mask)];
|
||||
else
|
||||
hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)];
|
||||
@ -198,7 +198,7 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
match->family, &tuple))
|
||||
goto hotdrop;
|
||||
|
||||
if (match->family == AF_INET6) {
|
||||
if (match->family == NFPROTO_IPV6) {
|
||||
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
memcpy(&addr.ip6, &iph->saddr, sizeof(iph->saddr));
|
||||
} else {
|
||||
@ -276,7 +276,7 @@ connlimit_mt_destroy(const struct xt_match *match, void *matchinfo)
|
||||
static struct xt_match connlimit_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connlimit",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connlimit_mt_check,
|
||||
.match = connlimit_mt,
|
||||
.matchsize = sizeof(struct xt_connlimit_info),
|
||||
@ -285,7 +285,7 @@ static struct xt_match connlimit_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "connlimit",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connlimit_mt_check,
|
||||
.match = connlimit_mt,
|
||||
.matchsize = sizeof(struct xt_connlimit_info),
|
||||
|
@ -140,7 +140,7 @@ static struct xt_match connmark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connmark",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connmark_mt_check_v0,
|
||||
.match = connmark_mt_v0,
|
||||
.destroy = connmark_mt_destroy,
|
||||
@ -155,7 +155,7 @@ static struct xt_match connmark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connmark",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connmark_mt_check_v0,
|
||||
.match = connmark_mt_v0,
|
||||
.destroy = connmark_mt_destroy,
|
||||
@ -170,7 +170,7 @@ static struct xt_match connmark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connmark",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = connmark_mt_check,
|
||||
.match = connmark_mt,
|
||||
.matchsize = sizeof(struct xt_connmark_mtinfo1),
|
||||
@ -180,7 +180,7 @@ static struct xt_match connmark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "connmark",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = connmark_mt_check,
|
||||
.match = connmark_mt,
|
||||
.matchsize = sizeof(struct xt_connmark_mtinfo1),
|
||||
|
@ -121,9 +121,9 @@ conntrack_addrcmp(const union nf_inet_addr *kaddr,
|
||||
const union nf_inet_addr *uaddr,
|
||||
const union nf_inet_addr *umask, unsigned int l3proto)
|
||||
{
|
||||
if (l3proto == AF_INET)
|
||||
if (l3proto == NFPROTO_IPV4)
|
||||
return ((kaddr->ip ^ uaddr->ip) & umask->ip) == 0;
|
||||
else if (l3proto == AF_INET6)
|
||||
else if (l3proto == NFPROTO_IPV6)
|
||||
return ipv6_masked_addr_cmp(&kaddr->in6, &umask->in6,
|
||||
&uaddr->in6) == 0;
|
||||
else
|
||||
@ -356,7 +356,7 @@ static struct xt_match conntrack_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "conntrack",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = conntrack_mt_v0,
|
||||
.checkentry = conntrack_mt_check,
|
||||
.destroy = conntrack_mt_destroy,
|
||||
@ -371,7 +371,7 @@ static struct xt_match conntrack_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "conntrack",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.matchsize = sizeof(struct xt_conntrack_mtinfo1),
|
||||
.match = conntrack_mt,
|
||||
.checkentry = conntrack_mt_check,
|
||||
@ -381,7 +381,7 @@ static struct xt_match conntrack_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "conntrack",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.matchsize = sizeof(struct xt_conntrack_mtinfo1),
|
||||
.match = conntrack_mt,
|
||||
.checkentry = conntrack_mt_check,
|
||||
|
@ -138,7 +138,7 @@ dccp_mt_check(const char *tablename, const void *inf,
|
||||
static struct xt_match dccp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "dccp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = dccp_mt_check,
|
||||
.match = dccp_mt,
|
||||
.matchsize = sizeof(struct xt_dccp_info),
|
||||
@ -147,7 +147,7 @@ static struct xt_match dccp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "dccp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = dccp_mt_check,
|
||||
.match = dccp_mt,
|
||||
.matchsize = sizeof(struct xt_dccp_info),
|
||||
|
@ -80,7 +80,7 @@ static bool tos_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
{
|
||||
const struct xt_tos_match_info *info = matchinfo;
|
||||
|
||||
if (match->family == AF_INET)
|
||||
if (match->family == NFPROTO_IPV4)
|
||||
return ((ip_hdr(skb)->tos & info->tos_mask) ==
|
||||
info->tos_value) ^ !!info->invert;
|
||||
else
|
||||
@ -91,7 +91,7 @@ static bool tos_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match dscp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "dscp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = dscp_mt_check,
|
||||
.match = dscp_mt,
|
||||
.matchsize = sizeof(struct xt_dscp_info),
|
||||
@ -99,7 +99,7 @@ static struct xt_match dscp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "dscp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = dscp_mt_check,
|
||||
.match = dscp_mt6,
|
||||
.matchsize = sizeof(struct xt_dscp_info),
|
||||
@ -108,7 +108,7 @@ static struct xt_match dscp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "tos",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = tos_mt_v0,
|
||||
.matchsize = sizeof(struct ipt_tos_info),
|
||||
.me = THIS_MODULE,
|
||||
@ -116,7 +116,7 @@ static struct xt_match dscp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "tos",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = tos_mt,
|
||||
.matchsize = sizeof(struct xt_tos_match_info),
|
||||
.me = THIS_MODULE,
|
||||
@ -124,7 +124,7 @@ static struct xt_match dscp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "tos",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = tos_mt,
|
||||
.matchsize = sizeof(struct xt_tos_match_info),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -88,7 +88,7 @@ esp_mt_check(const char *tablename, const void *ip_void,
|
||||
static struct xt_match esp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "esp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = esp_mt_check,
|
||||
.match = esp_mt,
|
||||
.matchsize = sizeof(struct xt_esp),
|
||||
@ -97,7 +97,7 @@ static struct xt_match esp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "esp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = esp_mt_check,
|
||||
.match = esp_mt,
|
||||
.matchsize = sizeof(struct xt_esp),
|
||||
|
@ -218,7 +218,7 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family)
|
||||
hinfo->cfg.gc_interval = minfo->cfg.gc_interval;
|
||||
hinfo->cfg.expire = minfo->cfg.expire;
|
||||
|
||||
if (family == AF_INET)
|
||||
if (family == NFPROTO_IPV4)
|
||||
hinfo->cfg.srcmask = hinfo->cfg.dstmask = 32;
|
||||
else
|
||||
hinfo->cfg.srcmask = hinfo->cfg.dstmask = 128;
|
||||
@ -237,11 +237,10 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family)
|
||||
hinfo->family = family;
|
||||
hinfo->rnd_initialized = 0;
|
||||
spin_lock_init(&hinfo->lock);
|
||||
hinfo->pde =
|
||||
proc_create_data(minfo->name, 0,
|
||||
family == AF_INET ? hashlimit_procdir4 :
|
||||
hashlimit_procdir6,
|
||||
&dl_file_ops, hinfo);
|
||||
hinfo->pde = proc_create_data(minfo->name, 0,
|
||||
(family == NFPROTO_IPV4) ?
|
||||
hashlimit_procdir4 : hashlimit_procdir6,
|
||||
&dl_file_ops, hinfo);
|
||||
if (!hinfo->pde) {
|
||||
vfree(hinfo);
|
||||
return -1;
|
||||
@ -300,11 +299,10 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, u_int8_t family)
|
||||
hinfo->rnd_initialized = 0;
|
||||
spin_lock_init(&hinfo->lock);
|
||||
|
||||
hinfo->pde =
|
||||
proc_create_data(minfo->name, 0,
|
||||
family == AF_INET ? hashlimit_procdir4 :
|
||||
hashlimit_procdir6,
|
||||
&dl_file_ops, hinfo);
|
||||
hinfo->pde = proc_create_data(minfo->name, 0,
|
||||
(family == NFPROTO_IPV4) ?
|
||||
hashlimit_procdir4 : hashlimit_procdir6,
|
||||
&dl_file_ops, hinfo);
|
||||
if (hinfo->pde == NULL) {
|
||||
vfree(hinfo);
|
||||
return -1;
|
||||
@ -370,7 +368,7 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
|
||||
|
||||
/* remove proc entry */
|
||||
remove_proc_entry(hinfo->pde->name,
|
||||
hinfo->family == AF_INET ? hashlimit_procdir4 :
|
||||
hinfo->family == NFPROTO_IPV4 ? hashlimit_procdir4 :
|
||||
hashlimit_procdir6);
|
||||
htable_selective_cleanup(hinfo, select_all);
|
||||
vfree(hinfo);
|
||||
@ -501,7 +499,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
|
||||
memset(dst, 0, sizeof(*dst));
|
||||
|
||||
switch (hinfo->family) {
|
||||
case AF_INET:
|
||||
case NFPROTO_IPV4:
|
||||
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
|
||||
dst->ip.dst = maskl(ip_hdr(skb)->daddr,
|
||||
hinfo->cfg.dstmask);
|
||||
@ -515,7 +513,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
|
||||
nexthdr = ip_hdr(skb)->protocol;
|
||||
break;
|
||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||
case AF_INET6:
|
||||
case NFPROTO_IPV6:
|
||||
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) {
|
||||
memcpy(&dst->ip6.dst, &ipv6_hdr(skb)->daddr,
|
||||
sizeof(dst->ip6.dst));
|
||||
@ -737,7 +735,7 @@ hashlimit_mt_check(const char *tablename, const void *inf,
|
||||
return false;
|
||||
if (info->name[sizeof(info->name)-1] != '\0')
|
||||
return false;
|
||||
if (match->family == AF_INET) {
|
||||
if (match->family == NFPROTO_IPV4) {
|
||||
if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32)
|
||||
return false;
|
||||
} else {
|
||||
@ -805,7 +803,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "hashlimit",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = hashlimit_mt_v0,
|
||||
.matchsize = sizeof(struct xt_hashlimit_info),
|
||||
#ifdef CONFIG_COMPAT
|
||||
@ -820,7 +818,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "hashlimit",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = hashlimit_mt,
|
||||
.matchsize = sizeof(struct xt_hashlimit_mtinfo1),
|
||||
.checkentry = hashlimit_mt_check,
|
||||
@ -830,7 +828,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||
{
|
||||
.name = "hashlimit",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = hashlimit_mt_v0,
|
||||
.matchsize = sizeof(struct xt_hashlimit_info),
|
||||
#ifdef CONFIG_COMPAT
|
||||
@ -845,7 +843,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "hashlimit",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = hashlimit_mt,
|
||||
.matchsize = sizeof(struct xt_hashlimit_mtinfo1),
|
||||
.checkentry = hashlimit_mt_check,
|
||||
@ -907,7 +905,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
|
||||
rateinfo_recalc(ent, jiffies);
|
||||
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
case NFPROTO_IPV4:
|
||||
return seq_printf(s, "%ld %u.%u.%u.%u:%u->"
|
||||
"%u.%u.%u.%u:%u %u %u %u\n",
|
||||
(long)(ent->expires - jiffies)/HZ,
|
||||
@ -918,7 +916,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
|
||||
ent->rateinfo.credit, ent->rateinfo.credit_cap,
|
||||
ent->rateinfo.cost);
|
||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||
case AF_INET6:
|
||||
case NFPROTO_IPV6:
|
||||
return seq_printf(s, "%ld " NIP6_FMT ":%u->"
|
||||
NIP6_FMT ":%u %u %u %u\n",
|
||||
(long)(ent->expires - jiffies)/HZ,
|
||||
|
@ -81,7 +81,7 @@ static void helper_mt_destroy(const struct xt_match *match, void *matchinfo)
|
||||
static struct xt_match helper_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "helper",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = helper_mt_check,
|
||||
.match = helper_mt,
|
||||
.destroy = helper_mt_destroy,
|
||||
@ -90,7 +90,7 @@ static struct xt_match helper_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "helper",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = helper_mt_check,
|
||||
.match = helper_mt,
|
||||
.destroy = helper_mt_destroy,
|
||||
|
@ -141,7 +141,7 @@ static struct xt_match iprange_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "iprange",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = iprange_mt_v0,
|
||||
.matchsize = sizeof(struct ipt_iprange_info),
|
||||
.me = THIS_MODULE,
|
||||
@ -149,7 +149,7 @@ static struct xt_match iprange_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "iprange",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = iprange_mt4,
|
||||
.matchsize = sizeof(struct xt_iprange_mtinfo),
|
||||
.me = THIS_MODULE,
|
||||
@ -157,7 +157,7 @@ static struct xt_match iprange_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "iprange",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = iprange_mt6,
|
||||
.matchsize = sizeof(struct xt_iprange_mtinfo),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -48,14 +48,14 @@ length_mt6(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match length_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "length",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = length_mt,
|
||||
.matchsize = sizeof(struct xt_length_info),
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "length",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = length_mt6,
|
||||
.matchsize = sizeof(struct xt_length_info),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -170,7 +170,7 @@ static int limit_mt_compat_to_user(void __user *dst, void *src)
|
||||
static struct xt_match limit_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "limit",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = limit_mt_check,
|
||||
.match = limit_mt,
|
||||
.matchsize = sizeof(struct xt_rateinfo),
|
||||
@ -183,7 +183,7 @@ static struct xt_match limit_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "limit",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = limit_mt_check,
|
||||
.match = limit_mt,
|
||||
.matchsize = sizeof(struct xt_rateinfo),
|
||||
|
@ -42,7 +42,7 @@ mac_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match mac_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "mac",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = mac_mt,
|
||||
.matchsize = sizeof(struct xt_mac_info),
|
||||
.hooks = (1 << NF_INET_PRE_ROUTING) |
|
||||
@ -52,7 +52,7 @@ static struct xt_match mac_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "mac",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = mac_mt,
|
||||
.matchsize = sizeof(struct xt_mac_info),
|
||||
.hooks = (1 << NF_INET_PRE_ROUTING) |
|
||||
|
@ -92,7 +92,7 @@ static struct xt_match mark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "mark",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = mark_mt_check_v0,
|
||||
.match = mark_mt_v0,
|
||||
.matchsize = sizeof(struct xt_mark_info),
|
||||
@ -106,7 +106,7 @@ static struct xt_match mark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "mark",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = mark_mt_check_v0,
|
||||
.match = mark_mt_v0,
|
||||
.matchsize = sizeof(struct xt_mark_info),
|
||||
@ -120,7 +120,7 @@ static struct xt_match mark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "mark",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = mark_mt,
|
||||
.matchsize = sizeof(struct xt_mark_mtinfo1),
|
||||
.me = THIS_MODULE,
|
||||
@ -128,7 +128,7 @@ static struct xt_match mark_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "mark",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = mark_mt,
|
||||
.matchsize = sizeof(struct xt_mark_mtinfo1),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -216,7 +216,7 @@ multiport_mt6_check(const char *tablename, const void *info,
|
||||
static struct xt_match multiport_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "multiport",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.revision = 0,
|
||||
.checkentry = multiport_mt_check_v0,
|
||||
.match = multiport_mt_v0,
|
||||
@ -225,7 +225,7 @@ static struct xt_match multiport_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "multiport",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.revision = 1,
|
||||
.checkentry = multiport_mt_check,
|
||||
.match = multiport_mt,
|
||||
@ -234,7 +234,7 @@ static struct xt_match multiport_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "multiport",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.revision = 0,
|
||||
.checkentry = multiport_mt6_check_v0,
|
||||
.match = multiport_mt_v0,
|
||||
@ -243,7 +243,7 @@ static struct xt_match multiport_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "multiport",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.revision = 1,
|
||||
.checkentry = multiport_mt6_check,
|
||||
.match = multiport_mt,
|
||||
|
@ -153,7 +153,7 @@ static struct xt_match owner_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "owner",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = owner_mt_v0,
|
||||
.matchsize = sizeof(struct ipt_owner_info),
|
||||
.checkentry = owner_mt_check_v0,
|
||||
@ -164,7 +164,7 @@ static struct xt_match owner_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "owner",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = owner_mt6_v0,
|
||||
.matchsize = sizeof(struct ip6t_owner_info),
|
||||
.checkentry = owner_mt6_check_v0,
|
||||
@ -175,7 +175,7 @@ static struct xt_match owner_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "owner",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = owner_mt,
|
||||
.matchsize = sizeof(struct xt_owner_match_info),
|
||||
.hooks = (1 << NF_INET_LOCAL_OUT) |
|
||||
@ -185,7 +185,7 @@ static struct xt_match owner_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "owner",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = owner_mt,
|
||||
.matchsize = sizeof(struct xt_owner_match_info),
|
||||
.hooks = (1 << NF_INET_LOCAL_OUT) |
|
||||
|
@ -121,7 +121,7 @@ physdev_mt_check(const char *tablename, const void *ip,
|
||||
static struct xt_match physdev_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "physdev",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = physdev_mt_check,
|
||||
.match = physdev_mt,
|
||||
.matchsize = sizeof(struct xt_physdev_info),
|
||||
@ -129,7 +129,7 @@ static struct xt_match physdev_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "physdev",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = physdev_mt_check,
|
||||
.match = physdev_mt,
|
||||
.matchsize = sizeof(struct xt_physdev_info),
|
||||
|
@ -33,10 +33,10 @@ pkttype_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
|
||||
if (skb->pkt_type != PACKET_LOOPBACK)
|
||||
type = skb->pkt_type;
|
||||
else if (match->family == AF_INET &&
|
||||
else if (match->family == NFPROTO_IPV4 &&
|
||||
ipv4_is_multicast(ip_hdr(skb)->daddr))
|
||||
type = PACKET_MULTICAST;
|
||||
else if (match->family == AF_INET6 &&
|
||||
else if (match->family == NFPROTO_IPV6 &&
|
||||
ipv6_hdr(skb)->daddr.s6_addr[0] == 0xFF)
|
||||
type = PACKET_MULTICAST;
|
||||
else
|
||||
@ -48,14 +48,14 @@ pkttype_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match pkttype_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "pkttype",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = pkttype_mt,
|
||||
.matchsize = sizeof(struct xt_pkttype_info),
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "pkttype",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = pkttype_mt,
|
||||
.matchsize = sizeof(struct xt_pkttype_info),
|
||||
.me = THIS_MODULE,
|
||||
|
@ -26,9 +26,9 @@ xt_addr_cmp(const union nf_inet_addr *a1, const union nf_inet_addr *m,
|
||||
const union nf_inet_addr *a2, unsigned short family)
|
||||
{
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
case NFPROTO_IPV4:
|
||||
return ((a1->ip ^ a2->ip) & m->ip) == 0;
|
||||
case AF_INET6:
|
||||
case NFPROTO_IPV6:
|
||||
return ipv6_masked_addr_cmp(&a1->in6, &m->in6, &a2->in6) == 0;
|
||||
}
|
||||
return false;
|
||||
@ -165,7 +165,7 @@ policy_mt_check(const char *tablename, const void *ip_void,
|
||||
static struct xt_match policy_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "policy",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = policy_mt_check,
|
||||
.match = policy_mt,
|
||||
.matchsize = sizeof(struct xt_policy_info),
|
||||
@ -173,7 +173,7 @@ static struct xt_match policy_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "policy",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = policy_mt_check,
|
||||
.match = policy_mt,
|
||||
.matchsize = sizeof(struct xt_policy_info),
|
||||
|
@ -57,7 +57,7 @@ quota_mt_check(const char *tablename, const void *entry,
|
||||
static struct xt_match quota_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "quota",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = quota_mt_check,
|
||||
.match = quota_mt,
|
||||
.matchsize = sizeof(struct xt_quota_info),
|
||||
@ -65,7 +65,7 @@ static struct xt_match quota_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "quota",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = quota_mt_check,
|
||||
.match = quota_mt,
|
||||
.matchsize = sizeof(struct xt_quota_info),
|
||||
|
@ -139,7 +139,7 @@ static void xt_rateest_mt_destroy(const struct xt_match *match,
|
||||
|
||||
static struct xt_match xt_rateest_match[] __read_mostly = {
|
||||
{
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "rateest",
|
||||
.match = xt_rateest_mt,
|
||||
.checkentry = xt_rateest_mt_checkentry,
|
||||
@ -148,7 +148,7 @@ static struct xt_match xt_rateest_match[] __read_mostly = {
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.name = "rateest",
|
||||
.match = xt_rateest_mt,
|
||||
.checkentry = xt_rateest_mt_checkentry,
|
||||
|
@ -39,7 +39,7 @@ static struct xt_match realm_mt_reg __read_mostly = {
|
||||
.matchsize = sizeof(struct xt_realm_info),
|
||||
.hooks = (1 << NF_INET_POST_ROUTING) | (1 << NF_INET_FORWARD) |
|
||||
(1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_LOCAL_IN),
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.me = THIS_MODULE
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,7 @@ recent_entry_lookup(const struct recent_table *table,
|
||||
struct recent_entry *e;
|
||||
unsigned int h;
|
||||
|
||||
if (family == AF_INET)
|
||||
if (family == NFPROTO_IPV4)
|
||||
h = recent_entry_hash4(addrp);
|
||||
else
|
||||
h = recent_entry_hash6(addrp);
|
||||
@ -165,7 +165,7 @@ recent_entry_init(struct recent_table *t, const union nf_inet_addr *addr,
|
||||
e->nstamps = 1;
|
||||
e->index = 1;
|
||||
e->family = family;
|
||||
if (family == AF_INET)
|
||||
if (family == NFPROTO_IPV4)
|
||||
list_add_tail(&e->list, &t->iphash[recent_entry_hash4(addr)]);
|
||||
else
|
||||
list_add_tail(&e->list, &t->iphash[recent_entry_hash6(addr)]);
|
||||
@ -216,7 +216,7 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
u_int8_t ttl;
|
||||
bool ret = info->invert;
|
||||
|
||||
if (match->family == AF_INET) {
|
||||
if (match->family == NFPROTO_IPV4) {
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
|
||||
if (info->side == XT_RECENT_DEST)
|
||||
@ -429,7 +429,7 @@ static int recent_seq_show(struct seq_file *seq, void *v)
|
||||
unsigned int i;
|
||||
|
||||
i = (e->index - 1) % ip_pkt_list_tot;
|
||||
if (e->family == AF_INET)
|
||||
if (e->family == NFPROTO_IPV4)
|
||||
seq_printf(seq, "src=" NIPQUAD_FMT " ttl: %u last_seen: %lu "
|
||||
"oldest_pkt: %u", NIPQUAD(e->addr.ip), e->ttl,
|
||||
e->stamps[i], e->index);
|
||||
@ -519,10 +519,11 @@ static ssize_t recent_old_proc_write(struct file *file,
|
||||
addr = in_aton(c);
|
||||
|
||||
spin_lock_bh(&recent_lock);
|
||||
e = recent_entry_lookup(t, (const void *)&addr, PF_INET, 0);
|
||||
e = recent_entry_lookup(t, (const void *)&addr, NFPROTO_IPV4, 0);
|
||||
if (e == NULL) {
|
||||
if (add)
|
||||
recent_entry_init(t, (const void *)&addr, PF_INET, 0);
|
||||
recent_entry_init(t, (const void *)&addr,
|
||||
NFPROTO_IPV4, 0);
|
||||
} else {
|
||||
if (add)
|
||||
recent_entry_update(t, e);
|
||||
@ -585,10 +586,10 @@ recent_mt_proc_write(struct file *file, const char __user *input,
|
||||
++c;
|
||||
--size;
|
||||
if (strnchr(c, size, ':') != NULL) {
|
||||
family = AF_INET6;
|
||||
family = NFPROTO_IPV6;
|
||||
succ = in6_pton(c, size, (void *)&addr, '\n', NULL);
|
||||
} else {
|
||||
family = AF_INET;
|
||||
family = NFPROTO_IPV4;
|
||||
succ = in4_pton(c, size, (void *)&addr, '\n', NULL);
|
||||
}
|
||||
|
||||
@ -628,7 +629,7 @@ static struct xt_match recent_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "recent",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = recent_mt,
|
||||
.matchsize = sizeof(struct xt_recent_mtinfo),
|
||||
.checkentry = recent_mt_check,
|
||||
@ -638,7 +639,7 @@ static struct xt_match recent_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "recent",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = recent_mt,
|
||||
.matchsize = sizeof(struct xt_recent_mtinfo),
|
||||
.checkentry = recent_mt_check,
|
||||
|
@ -169,7 +169,7 @@ sctp_mt_check(const char *tablename, const void *inf,
|
||||
static struct xt_match sctp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "sctp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = sctp_mt_check,
|
||||
.match = sctp_mt,
|
||||
.matchsize = sizeof(struct xt_sctp_info),
|
||||
@ -178,7 +178,7 @@ static struct xt_match sctp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "sctp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = sctp_mt_check,
|
||||
.match = sctp_mt,
|
||||
.matchsize = sizeof(struct xt_sctp_info),
|
||||
|
@ -61,7 +61,7 @@ static void state_mt_destroy(const struct xt_match *match, void *matchinfo)
|
||||
static struct xt_match state_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "state",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = state_mt_check,
|
||||
.match = state_mt,
|
||||
.destroy = state_mt_destroy,
|
||||
@ -70,7 +70,7 @@ static struct xt_match state_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "state",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = state_mt_check,
|
||||
.match = state_mt,
|
||||
.destroy = state_mt_destroy,
|
||||
|
@ -69,7 +69,7 @@ statistic_mt_check(const char *tablename, const void *entry,
|
||||
static struct xt_match statistic_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "statistic",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = statistic_mt_check,
|
||||
.match = statistic_mt,
|
||||
.matchsize = sizeof(struct xt_statistic_info),
|
||||
@ -77,7 +77,7 @@ static struct xt_match statistic_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "statistic",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = statistic_mt_check,
|
||||
.match = statistic_mt,
|
||||
.matchsize = sizeof(struct xt_statistic_info),
|
||||
|
@ -85,7 +85,7 @@ static struct xt_match string_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "string",
|
||||
.revision = 0,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = string_mt_check,
|
||||
.match = string_mt,
|
||||
.destroy = string_mt_destroy,
|
||||
@ -95,7 +95,7 @@ static struct xt_match string_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "string",
|
||||
.revision = 1,
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = string_mt_check,
|
||||
.match = string_mt,
|
||||
.destroy = string_mt_destroy,
|
||||
@ -105,7 +105,7 @@ static struct xt_match string_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "string",
|
||||
.revision = 0,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = string_mt_check,
|
||||
.match = string_mt,
|
||||
.destroy = string_mt_destroy,
|
||||
@ -115,7 +115,7 @@ static struct xt_match string_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "string",
|
||||
.revision = 1,
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = string_mt_check,
|
||||
.match = string_mt,
|
||||
.destroy = string_mt_destroy,
|
||||
|
@ -83,7 +83,7 @@ dropit:
|
||||
static struct xt_match tcpmss_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "tcpmss",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = tcpmss_mt,
|
||||
.matchsize = sizeof(struct xt_tcpmss_match_info),
|
||||
.proto = IPPROTO_TCP,
|
||||
@ -91,7 +91,7 @@ static struct xt_match tcpmss_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "tcpmss",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = tcpmss_mt,
|
||||
.matchsize = sizeof(struct xt_tcpmss_match_info),
|
||||
.proto = IPPROTO_TCP,
|
||||
|
@ -186,7 +186,7 @@ udp_mt_check(const char *tablename, const void *info,
|
||||
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "tcp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = tcp_mt_check,
|
||||
.match = tcp_mt,
|
||||
.matchsize = sizeof(struct xt_tcp),
|
||||
@ -195,7 +195,7 @@ static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "tcp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = tcp_mt_check,
|
||||
.match = tcp_mt,
|
||||
.matchsize = sizeof(struct xt_tcp),
|
||||
@ -204,7 +204,7 @@ static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "udp",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = udp_mt_check,
|
||||
.match = udp_mt,
|
||||
.matchsize = sizeof(struct xt_udp),
|
||||
@ -213,7 +213,7 @@ static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "udp",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = udp_mt_check,
|
||||
.match = udp_mt,
|
||||
.matchsize = sizeof(struct xt_udp),
|
||||
@ -222,7 +222,7 @@ static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "udplite",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.checkentry = udp_mt_check,
|
||||
.match = udp_mt,
|
||||
.matchsize = sizeof(struct xt_udp),
|
||||
@ -231,7 +231,7 @@ static struct xt_match tcpudp_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "udplite",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.checkentry = udp_mt_check,
|
||||
.match = udp_mt,
|
||||
.matchsize = sizeof(struct xt_udp),
|
||||
|
@ -240,7 +240,7 @@ time_mt_check(const char *tablename, const void *ip,
|
||||
static struct xt_match time_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "time",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = time_mt,
|
||||
.matchsize = sizeof(struct xt_time_info),
|
||||
.checkentry = time_mt_check,
|
||||
@ -248,7 +248,7 @@ static struct xt_match time_mt_reg[] __read_mostly = {
|
||||
},
|
||||
{
|
||||
.name = "time",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = time_mt,
|
||||
.matchsize = sizeof(struct xt_time_info),
|
||||
.checkentry = time_mt_check,
|
||||
|
@ -102,14 +102,14 @@ u32_mt(const struct sk_buff *skb, const struct net_device *in,
|
||||
static struct xt_match u32_mt_reg[] __read_mostly = {
|
||||
{
|
||||
.name = "u32",
|
||||
.family = AF_INET,
|
||||
.family = NFPROTO_IPV4,
|
||||
.match = u32_mt,
|
||||
.matchsize = sizeof(struct xt_u32),
|
||||
.me = THIS_MODULE,
|
||||
},
|
||||
{
|
||||
.name = "u32",
|
||||
.family = AF_INET6,
|
||||
.family = NFPROTO_IPV6,
|
||||
.match = u32_mt,
|
||||
.matchsize = sizeof(struct xt_u32),
|
||||
.me = THIS_MODULE,
|
||||
|
Reference in New Issue
Block a user