提交 bf3a46aa 编写于 作者: H Harald Welte 提交者: David S. Miller

[NETFILTER]: convert nfmark and conntrack mark to 32bit

As discussed at netconf'05, we convert nfmark and conntrack-mark to be
32bits even on 64bit architectures.
Signed-off-by: NHarald Welte <laforge@netfilter.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8f3d17fb
...@@ -171,7 +171,7 @@ struct ip_conntrack ...@@ -171,7 +171,7 @@ struct ip_conntrack
#endif /* CONFIG_IP_NF_NAT_NEEDED */ #endif /* CONFIG_IP_NF_NAT_NEEDED */
#if defined(CONFIG_IP_NF_CONNTRACK_MARK) #if defined(CONFIG_IP_NF_CONNTRACK_MARK)
unsigned long mark; u_int32_t mark;
#endif #endif
/* Traversed often, so hopefully in different cacheline to top */ /* Traversed often, so hopefully in different cacheline to top */
......
...@@ -259,7 +259,7 @@ struct sk_buff { ...@@ -259,7 +259,7 @@ struct sk_buff {
void (*destructor)(struct sk_buff *skb); void (*destructor)(struct sk_buff *skb);
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
unsigned long nfmark; __u32 nfmark;
__u32 nfcache; __u32 nfcache;
__u32 nfctinfo; __u32 nfctinfo;
struct nf_conntrack *nfct; struct nf_conntrack *nfct;
......
...@@ -185,7 +185,7 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -185,7 +185,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
return -ENOSPC; return -ENOSPC;
#if defined(CONFIG_IP_NF_CONNTRACK_MARK) #if defined(CONFIG_IP_NF_CONNTRACK_MARK)
if (seq_printf(s, "mark=%lu ", conntrack->mark)) if (seq_printf(s, "mark=%u ", conntrack->mark))
return -ENOSPC; return -ENOSPC;
#endif #endif
......
...@@ -367,7 +367,7 @@ target(struct sk_buff **pskb, ...@@ -367,7 +367,7 @@ target(struct sk_buff **pskb,
#ifdef DEBUG_CLUSTERP #ifdef DEBUG_CLUSTERP
DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
#endif #endif
DEBUGP("hash=%u ct_hash=%lu ", hash, ct->mark); DEBUGP("hash=%u ct_hash=%u ", hash, ct->mark);
if (!clusterip_responsible(cipinfo->config, hash)) { if (!clusterip_responsible(cipinfo->config, hash)) {
DEBUGP("not responsible\n"); DEBUGP("not responsible\n");
return NF_DROP; return NF_DROP;
......
...@@ -40,9 +40,9 @@ target(struct sk_buff **pskb, ...@@ -40,9 +40,9 @@ target(struct sk_buff **pskb,
void *userinfo) void *userinfo)
{ {
const struct ipt_connmark_target_info *markinfo = targinfo; const struct ipt_connmark_target_info *markinfo = targinfo;
unsigned long diff; u_int32_t diff;
unsigned long nfmark; u_int32_t nfmark;
unsigned long newmark; u_int32_t newmark;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
struct ip_conntrack *ct = ip_conntrack_get((*pskb), &ctinfo); struct ip_conntrack *ct = ip_conntrack_get((*pskb), &ctinfo);
...@@ -94,6 +94,11 @@ checkentry(const char *tablename, ...@@ -94,6 +94,11 @@ checkentry(const char *tablename,
} }
} }
if (matchinfo->mark > 0xffffffff || matchinfo->mask > 0xffffffff) {
printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n");
return 0;
}
return 1; return 1;
} }
......
...@@ -76,6 +76,8 @@ checkentry_v0(const char *tablename, ...@@ -76,6 +76,8 @@ checkentry_v0(const char *tablename,
unsigned int targinfosize, unsigned int targinfosize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
struct ipt_mark_target_info *markinfo = targinfo;
if (targinfosize != IPT_ALIGN(sizeof(struct ipt_mark_target_info))) { if (targinfosize != IPT_ALIGN(sizeof(struct ipt_mark_target_info))) {
printk(KERN_WARNING "MARK: targinfosize %u != %Zu\n", printk(KERN_WARNING "MARK: targinfosize %u != %Zu\n",
targinfosize, targinfosize,
...@@ -88,6 +90,11 @@ checkentry_v0(const char *tablename, ...@@ -88,6 +90,11 @@ checkentry_v0(const char *tablename,
return 0; return 0;
} }
if (markinfo->mark > 0xffffffff) {
printk(KERN_WARNING "MARK: Only supports 32bit wide mark\n");
return 0;
}
return 1; return 1;
} }
...@@ -120,6 +127,11 @@ checkentry_v1(const char *tablename, ...@@ -120,6 +127,11 @@ checkentry_v1(const char *tablename,
return 0; return 0;
} }
if (markinfo->mark > 0xffffffff) {
printk(KERN_WARNING "MARK: Only supports 32bit wide mark\n");
return 0;
}
return 1; return 1;
} }
......
...@@ -54,9 +54,16 @@ checkentry(const char *tablename, ...@@ -54,9 +54,16 @@ checkentry(const char *tablename,
unsigned int matchsize, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
struct ipt_connmark_info *cm =
(struct ipt_connmark_info *)matchinfo;
if (matchsize != IPT_ALIGN(sizeof(struct ipt_connmark_info))) if (matchsize != IPT_ALIGN(sizeof(struct ipt_connmark_info)))
return 0; return 0;
if (cm->mark > 0xffffffff || cm->mask > 0xffffffff) {
printk(KERN_WARNING "connmark: only support 32bit mark\n");
return 0;
}
return 1; return 1;
} }
......
...@@ -37,9 +37,16 @@ checkentry(const char *tablename, ...@@ -37,9 +37,16 @@ checkentry(const char *tablename,
unsigned int matchsize, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
struct ipt_mark_info *minfo = (struct ipt_mark_info *) matchinfo;
if (matchsize != IPT_ALIGN(sizeof(struct ipt_mark_info))) if (matchsize != IPT_ALIGN(sizeof(struct ipt_mark_info)))
return 0; return 0;
if (minfo->mark > 0xffffffff || minfo->mask > 0xffffffff) {
printk(KERN_WARNING "mark: only supports 32bit mark\n");
return 0;
}
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册