aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-01-14 07:36:42 -0500
committerPatrick McHardy <kaber@trash.net>2011-01-14 07:36:42 -0500
commitc7066f70d9610df0b9406cc635fc09e86136e714 (patch)
treece98855b2c1ba2da15b7b47fc7a447d1903c4d89 /net/ipv4
parentae90bdeaeac6b964b7a1e853a90a19f358a9ac20 (diff)
netfilter: fix Kconfig dependencies
Fix dependencies of netfilter realm match: it depends on NET_CLS_ROUTE, which itself depends on NET_SCHED; this dependency is missing from netfilter. Since matching on realms is also useful without having NET_SCHED enabled and the option really only controls whether the tclassid member is included in route and dst entries, rename the config option to IP_ROUTE_CLASSID and move it outside of traffic scheduling context to get rid of the NET_SCHED dependeny. Reported-by: Vladis Kletnieks <Valdis.Kletnieks@vt.edu> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/Kconfig4
-rw-r--r--net/ipv4/fib_rules.c10
-rw-r--r--net/ipv4/fib_semantics.c14
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/route.c26
5 files changed, 29 insertions, 27 deletions
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 9e95d7fb6d5a..dcb2e18f6f8e 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -140,6 +140,9 @@ config IP_ROUTE_VERBOSE
140 handled by the klogd daemon which is responsible for kernel messages 140 handled by the klogd daemon which is responsible for kernel messages
141 ("man klogd"). 141 ("man klogd").
142 142
143config IP_ROUTE_CLASSID
144 bool
145
143config IP_PNP 146config IP_PNP
144 bool "IP: kernel level autoconfiguration" 147 bool "IP: kernel level autoconfiguration"
145 help 148 help
@@ -655,4 +658,3 @@ config TCP_MD5SIG
655 on the Internet. 658 on the Internet.
656 659
657 If unsure, say N. 660 If unsure, say N.
658
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 7981a24f5c7b..9cefe72029cf 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -41,12 +41,12 @@ struct fib4_rule {
41 __be32 srcmask; 41 __be32 srcmask;
42 __be32 dst; 42 __be32 dst;
43 __be32 dstmask; 43 __be32 dstmask;
44#ifdef CONFIG_NET_CLS_ROUTE 44#ifdef CONFIG_IP_ROUTE_CLASSID
45 u32 tclassid; 45 u32 tclassid;
46#endif 46#endif
47}; 47};
48 48
49#ifdef CONFIG_NET_CLS_ROUTE 49#ifdef CONFIG_IP_ROUTE_CLASSID
50u32 fib_rules_tclass(struct fib_result *res) 50u32 fib_rules_tclass(struct fib_result *res)
51{ 51{
52 return res->r ? ((struct fib4_rule *) res->r)->tclassid : 0; 52 return res->r ? ((struct fib4_rule *) res->r)->tclassid : 0;
@@ -165,7 +165,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
165 if (frh->dst_len) 165 if (frh->dst_len)
166 rule4->dst = nla_get_be32(tb[FRA_DST]); 166 rule4->dst = nla_get_be32(tb[FRA_DST]);
167 167
168#ifdef CONFIG_NET_CLS_ROUTE 168#ifdef CONFIG_IP_ROUTE_CLASSID
169 if (tb[FRA_FLOW]) 169 if (tb[FRA_FLOW])
170 rule4->tclassid = nla_get_u32(tb[FRA_FLOW]); 170 rule4->tclassid = nla_get_u32(tb[FRA_FLOW]);
171#endif 171#endif
@@ -195,7 +195,7 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
195 if (frh->tos && (rule4->tos != frh->tos)) 195 if (frh->tos && (rule4->tos != frh->tos))
196 return 0; 196 return 0;
197 197
198#ifdef CONFIG_NET_CLS_ROUTE 198#ifdef CONFIG_IP_ROUTE_CLASSID
199 if (tb[FRA_FLOW] && (rule4->tclassid != nla_get_u32(tb[FRA_FLOW]))) 199 if (tb[FRA_FLOW] && (rule4->tclassid != nla_get_u32(tb[FRA_FLOW])))
200 return 0; 200 return 0;
201#endif 201#endif
@@ -224,7 +224,7 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
224 if (rule4->src_len) 224 if (rule4->src_len)
225 NLA_PUT_BE32(skb, FRA_SRC, rule4->src); 225 NLA_PUT_BE32(skb, FRA_SRC, rule4->src);
226 226
227#ifdef CONFIG_NET_CLS_ROUTE 227#ifdef CONFIG_IP_ROUTE_CLASSID
228 if (rule4->tclassid) 228 if (rule4->tclassid)
229 NLA_PUT_U32(skb, FRA_FLOW, rule4->tclassid); 229 NLA_PUT_U32(skb, FRA_FLOW, rule4->tclassid);
230#endif 230#endif
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 3e0da3ef6116..a72c62d03106 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -200,7 +200,7 @@ static inline int nh_comp(const struct fib_info *fi, const struct fib_info *ofi)
200#ifdef CONFIG_IP_ROUTE_MULTIPATH 200#ifdef CONFIG_IP_ROUTE_MULTIPATH
201 nh->nh_weight != onh->nh_weight || 201 nh->nh_weight != onh->nh_weight ||
202#endif 202#endif
203#ifdef CONFIG_NET_CLS_ROUTE 203#ifdef CONFIG_IP_ROUTE_CLASSID
204 nh->nh_tclassid != onh->nh_tclassid || 204 nh->nh_tclassid != onh->nh_tclassid ||
205#endif 205#endif
206 ((nh->nh_flags ^ onh->nh_flags) & ~RTNH_F_DEAD)) 206 ((nh->nh_flags ^ onh->nh_flags) & ~RTNH_F_DEAD))
@@ -422,7 +422,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
422 422
423 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 423 nla = nla_find(attrs, attrlen, RTA_GATEWAY);
424 nexthop_nh->nh_gw = nla ? nla_get_be32(nla) : 0; 424 nexthop_nh->nh_gw = nla ? nla_get_be32(nla) : 0;
425#ifdef CONFIG_NET_CLS_ROUTE 425#ifdef CONFIG_IP_ROUTE_CLASSID
426 nla = nla_find(attrs, attrlen, RTA_FLOW); 426 nla = nla_find(attrs, attrlen, RTA_FLOW);
427 nexthop_nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; 427 nexthop_nh->nh_tclassid = nla ? nla_get_u32(nla) : 0;
428#endif 428#endif
@@ -476,7 +476,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
476 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 476 nla = nla_find(attrs, attrlen, RTA_GATEWAY);
477 if (nla && nla_get_be32(nla) != nh->nh_gw) 477 if (nla && nla_get_be32(nla) != nh->nh_gw)
478 return 1; 478 return 1;
479#ifdef CONFIG_NET_CLS_ROUTE 479#ifdef CONFIG_IP_ROUTE_CLASSID
480 nla = nla_find(attrs, attrlen, RTA_FLOW); 480 nla = nla_find(attrs, attrlen, RTA_FLOW);
481 if (nla && nla_get_u32(nla) != nh->nh_tclassid) 481 if (nla && nla_get_u32(nla) != nh->nh_tclassid)
482 return 1; 482 return 1;
@@ -783,7 +783,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
783 goto err_inval; 783 goto err_inval;
784 if (cfg->fc_gw && fi->fib_nh->nh_gw != cfg->fc_gw) 784 if (cfg->fc_gw && fi->fib_nh->nh_gw != cfg->fc_gw)
785 goto err_inval; 785 goto err_inval;
786#ifdef CONFIG_NET_CLS_ROUTE 786#ifdef CONFIG_IP_ROUTE_CLASSID
787 if (cfg->fc_flow && fi->fib_nh->nh_tclassid != cfg->fc_flow) 787 if (cfg->fc_flow && fi->fib_nh->nh_tclassid != cfg->fc_flow)
788 goto err_inval; 788 goto err_inval;
789#endif 789#endif
@@ -796,7 +796,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
796 nh->nh_oif = cfg->fc_oif; 796 nh->nh_oif = cfg->fc_oif;
797 nh->nh_gw = cfg->fc_gw; 797 nh->nh_gw = cfg->fc_gw;
798 nh->nh_flags = cfg->fc_flags; 798 nh->nh_flags = cfg->fc_flags;
799#ifdef CONFIG_NET_CLS_ROUTE 799#ifdef CONFIG_IP_ROUTE_CLASSID
800 nh->nh_tclassid = cfg->fc_flow; 800 nh->nh_tclassid = cfg->fc_flow;
801#endif 801#endif
802#ifdef CONFIG_IP_ROUTE_MULTIPATH 802#ifdef CONFIG_IP_ROUTE_MULTIPATH
@@ -1006,7 +1006,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
1006 1006
1007 if (fi->fib_nh->nh_oif) 1007 if (fi->fib_nh->nh_oif)
1008 NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); 1008 NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif);
1009#ifdef CONFIG_NET_CLS_ROUTE 1009#ifdef CONFIG_IP_ROUTE_CLASSID
1010 if (fi->fib_nh[0].nh_tclassid) 1010 if (fi->fib_nh[0].nh_tclassid)
1011 NLA_PUT_U32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid); 1011 NLA_PUT_U32(skb, RTA_FLOW, fi->fib_nh[0].nh_tclassid);
1012#endif 1012#endif
@@ -1031,7 +1031,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
1031 1031
1032 if (nh->nh_gw) 1032 if (nh->nh_gw)
1033 NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw); 1033 NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw);
1034#ifdef CONFIG_NET_CLS_ROUTE 1034#ifdef CONFIG_IP_ROUTE_CLASSID
1035 if (nh->nh_tclassid) 1035 if (nh->nh_tclassid)
1036 NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); 1036 NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid);
1037#endif 1037#endif
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d859bcc26cb7..d7b2b0987a3b 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -340,7 +340,7 @@ static int ip_rcv_finish(struct sk_buff *skb)
340 } 340 }
341 } 341 }
342 342
343#ifdef CONFIG_NET_CLS_ROUTE 343#ifdef CONFIG_IP_ROUTE_CLASSID
344 if (unlikely(skb_dst(skb)->tclassid)) { 344 if (unlikely(skb_dst(skb)->tclassid)) {
345 struct ip_rt_acct *st = this_cpu_ptr(ip_rt_acct); 345 struct ip_rt_acct *st = this_cpu_ptr(ip_rt_acct);
346 u32 idx = skb_dst(skb)->tclassid; 346 u32 idx = skb_dst(skb)->tclassid;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 66610ea3c87b..f70ae1bccb8a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -511,7 +511,7 @@ static const struct file_operations rt_cpu_seq_fops = {
511 .release = seq_release, 511 .release = seq_release,
512}; 512};
513 513
514#ifdef CONFIG_NET_CLS_ROUTE 514#ifdef CONFIG_IP_ROUTE_CLASSID
515static int rt_acct_proc_show(struct seq_file *m, void *v) 515static int rt_acct_proc_show(struct seq_file *m, void *v)
516{ 516{
517 struct ip_rt_acct *dst, *src; 517 struct ip_rt_acct *dst, *src;
@@ -564,14 +564,14 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
564 if (!pde) 564 if (!pde)
565 goto err2; 565 goto err2;
566 566
567#ifdef CONFIG_NET_CLS_ROUTE 567#ifdef CONFIG_IP_ROUTE_CLASSID
568 pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); 568 pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops);
569 if (!pde) 569 if (!pde)
570 goto err3; 570 goto err3;
571#endif 571#endif
572 return 0; 572 return 0;
573 573
574#ifdef CONFIG_NET_CLS_ROUTE 574#ifdef CONFIG_IP_ROUTE_CLASSID
575err3: 575err3:
576 remove_proc_entry("rt_cache", net->proc_net_stat); 576 remove_proc_entry("rt_cache", net->proc_net_stat);
577#endif 577#endif
@@ -585,7 +585,7 @@ static void __net_exit ip_rt_do_proc_exit(struct net *net)
585{ 585{
586 remove_proc_entry("rt_cache", net->proc_net_stat); 586 remove_proc_entry("rt_cache", net->proc_net_stat);
587 remove_proc_entry("rt_cache", net->proc_net); 587 remove_proc_entry("rt_cache", net->proc_net);
588#ifdef CONFIG_NET_CLS_ROUTE 588#ifdef CONFIG_IP_ROUTE_CLASSID
589 remove_proc_entry("rt_acct", net->proc_net); 589 remove_proc_entry("rt_acct", net->proc_net);
590#endif 590#endif
591} 591}
@@ -1784,7 +1784,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
1784 memcpy(addr, &src, 4); 1784 memcpy(addr, &src, 4);
1785} 1785}
1786 1786
1787#ifdef CONFIG_NET_CLS_ROUTE 1787#ifdef CONFIG_IP_ROUTE_CLASSID
1788static void set_class_tag(struct rtable *rt, u32 tag) 1788static void set_class_tag(struct rtable *rt, u32 tag)
1789{ 1789{
1790 if (!(rt->dst.tclassid & 0xFFFF)) 1790 if (!(rt->dst.tclassid & 0xFFFF))
@@ -1811,7 +1811,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
1811 rt->dst.dev->mtu > 576) 1811 rt->dst.dev->mtu > 576)
1812 rt->dst.metrics[RTAX_MTU-1] = 576; 1812 rt->dst.metrics[RTAX_MTU-1] = 576;
1813 } 1813 }
1814#ifdef CONFIG_NET_CLS_ROUTE 1814#ifdef CONFIG_IP_ROUTE_CLASSID
1815 rt->dst.tclassid = FIB_RES_NH(*res).nh_tclassid; 1815 rt->dst.tclassid = FIB_RES_NH(*res).nh_tclassid;
1816#endif 1816#endif
1817 } else 1817 } else
@@ -1827,7 +1827,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
1827 if (dst_metric(&rt->dst, RTAX_ADVMSS) > 65535 - 40) 1827 if (dst_metric(&rt->dst, RTAX_ADVMSS) > 65535 - 40)
1828 rt->dst.metrics[RTAX_ADVMSS-1] = 65535 - 40; 1828 rt->dst.metrics[RTAX_ADVMSS-1] = 65535 - 40;
1829 1829
1830#ifdef CONFIG_NET_CLS_ROUTE 1830#ifdef CONFIG_IP_ROUTE_CLASSID
1831#ifdef CONFIG_IP_MULTIPLE_TABLES 1831#ifdef CONFIG_IP_MULTIPLE_TABLES
1832 set_class_tag(rt, fib_rules_tclass(res)); 1832 set_class_tag(rt, fib_rules_tclass(res));
1833#endif 1833#endif
@@ -1883,7 +1883,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1883 rth->fl.mark = skb->mark; 1883 rth->fl.mark = skb->mark;
1884 rth->fl.fl4_src = saddr; 1884 rth->fl.fl4_src = saddr;
1885 rth->rt_src = saddr; 1885 rth->rt_src = saddr;
1886#ifdef CONFIG_NET_CLS_ROUTE 1886#ifdef CONFIG_IP_ROUTE_CLASSID
1887 rth->dst.tclassid = itag; 1887 rth->dst.tclassid = itag;
1888#endif 1888#endif
1889 rth->rt_iif = 1889 rth->rt_iif =
@@ -2202,7 +2202,7 @@ local_input:
2202 rth->fl.mark = skb->mark; 2202 rth->fl.mark = skb->mark;
2203 rth->fl.fl4_src = saddr; 2203 rth->fl.fl4_src = saddr;
2204 rth->rt_src = saddr; 2204 rth->rt_src = saddr;
2205#ifdef CONFIG_NET_CLS_ROUTE 2205#ifdef CONFIG_IP_ROUTE_CLASSID
2206 rth->dst.tclassid = itag; 2206 rth->dst.tclassid = itag;
2207#endif 2207#endif
2208 rth->rt_iif = 2208 rth->rt_iif =
@@ -2820,7 +2820,7 @@ static int rt_fill_info(struct net *net,
2820 } 2820 }
2821 if (rt->dst.dev) 2821 if (rt->dst.dev)
2822 NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex); 2822 NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex);
2823#ifdef CONFIG_NET_CLS_ROUTE 2823#ifdef CONFIG_IP_ROUTE_CLASSID
2824 if (rt->dst.tclassid) 2824 if (rt->dst.tclassid)
2825 NLA_PUT_U32(skb, RTA_FLOW, rt->dst.tclassid); 2825 NLA_PUT_U32(skb, RTA_FLOW, rt->dst.tclassid);
2826#endif 2826#endif
@@ -3245,9 +3245,9 @@ static __net_initdata struct pernet_operations rt_genid_ops = {
3245}; 3245};
3246 3246
3247 3247
3248#ifdef CONFIG_NET_CLS_ROUTE 3248#ifdef CONFIG_IP_ROUTE_CLASSID
3249struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; 3249struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
3250#endif /* CONFIG_NET_CLS_ROUTE */ 3250#endif /* CONFIG_IP_ROUTE_CLASSID */
3251 3251
3252static __initdata unsigned long rhash_entries; 3252static __initdata unsigned long rhash_entries;
3253static int __init set_rhash_entries(char *str) 3253static int __init set_rhash_entries(char *str)
@@ -3263,7 +3263,7 @@ int __init ip_rt_init(void)
3263{ 3263{
3264 int rc = 0; 3264 int rc = 0;
3265 3265
3266#ifdef CONFIG_NET_CLS_ROUTE 3266#ifdef CONFIG_IP_ROUTE_CLASSID
3267 ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct)); 3267 ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct));
3268 if (!ip_rt_acct) 3268 if (!ip_rt_acct)
3269 panic("IP: failed to allocate ip_rt_acct\n"); 3269 panic("IP: failed to allocate ip_rt_acct\n");