powerpc/eeh: Fix PE#0 check in eeh_add_to_parent_pe()
[linux/fpc-iii.git] / net / bridge / br_nf_core.c
blob387cb3bd017c0102b73ea2cf7089500ea00a19a9
1 /*
2 * Handle firewalling core
3 * Linux ethernet bridge
5 * Authors:
6 * Lennert Buytenhek <buytenh@gnu.org>
7 * Bart De Schuymer <bdschuym@pandora.be>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
14 * Lennert dedicates this file to Kerstin Wurdinger.
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/in_route.h>
20 #include <linux/inetdevice.h>
21 #include <net/route.h>
23 #include "br_private.h"
24 #ifdef CONFIG_SYSCTL
25 #include <linux/sysctl.h>
26 #endif
28 static void fake_update_pmtu(struct dst_entry *dst, struct sock *sk,
29 struct sk_buff *skb, u32 mtu)
33 static void fake_redirect(struct dst_entry *dst, struct sock *sk,
34 struct sk_buff *skb)
38 static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
40 return NULL;
43 static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst,
44 struct sk_buff *skb,
45 const void *daddr)
47 return NULL;
50 static unsigned int fake_mtu(const struct dst_entry *dst)
52 return dst->dev->mtu;
55 static struct dst_ops fake_dst_ops = {
56 .family = AF_INET,
57 .protocol = cpu_to_be16(ETH_P_IP),
58 .update_pmtu = fake_update_pmtu,
59 .redirect = fake_redirect,
60 .cow_metrics = fake_cow_metrics,
61 .neigh_lookup = fake_neigh_lookup,
62 .mtu = fake_mtu,
66 * Initialize bogus route table used to keep netfilter happy.
67 * Currently, we fill in the PMTU entry because netfilter
68 * refragmentation needs it, and the rt_flags entry because
69 * ipt_REJECT needs it. Future netfilter modules might
70 * require us to fill additional fields.
72 static const u32 br_dst_default_metrics[RTAX_MAX] = {
73 [RTAX_MTU - 1] = 1500,
76 void br_netfilter_rtable_init(struct net_bridge *br)
78 struct rtable *rt = &br->fake_rtable;
80 atomic_set(&rt->dst.__refcnt, 1);
81 rt->dst.dev = br->dev;
82 rt->dst.path = &rt->dst;
83 dst_init_metrics(&rt->dst, br_dst_default_metrics, true);
84 rt->dst.flags = DST_NOXFRM | DST_FAKE_RTABLE;
85 rt->dst.ops = &fake_dst_ops;
88 int __init br_nf_core_init(void)
90 return dst_entries_init(&fake_dst_ops);
93 void br_nf_core_fini(void)
95 dst_entries_destroy(&fake_dst_ops);