aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-02-21 16:37:35 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-02-23 19:10:51 -0500
commit42cf93cd464e0df3c85d298c647411bae6d99e6e (patch)
treef68f155f6eedbac8ac8c32c8c947d5a2f6cb2033 /net
parenta80614d1adba903a1e5cb22bf14ebc640fc2ba4c (diff)
[NETFILTER]: Fix bridge netfilter related in xfrm_lookup
The bridge-netfilter code attaches a fake dst_entry with dst->ops == NULL to purely bridged packets. When these packets are SNATed and a policy lookup is done, xfrm_lookup crashes because it tries to dereference dst->ops. Change xfrm_lookup not to dereference dst->ops before checking for the DST_NOXFRM flag and set this flag in the fake dst_entry. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_netfilter.c1
-rw-r--r--net/xfrm/xfrm_policy.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 6bb0c7eb1ef0..e060aad8624d 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -90,6 +90,7 @@ static struct rtable __fake_rtable = {
90 .dev = &__fake_net_device, 90 .dev = &__fake_net_device,
91 .path = &__fake_rtable.u.dst, 91 .path = &__fake_rtable.u.dst,
92 .metrics = {[RTAX_MTU - 1] = 1500}, 92 .metrics = {[RTAX_MTU - 1] = 1500},
93 .flags = DST_NOXFRM,
93 } 94 }
94 }, 95 },
95 .rt_flags = 0, 96 .rt_flags = 0,
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 5e6b05ac1260..8206025d8e46 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -782,7 +782,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
782 int nx = 0; 782 int nx = 0;
783 int err; 783 int err;
784 u32 genid; 784 u32 genid;
785 u16 family = dst_orig->ops->family; 785 u16 family;
786 u8 dir = policy_to_flow_dir(XFRM_POLICY_OUT); 786 u8 dir = policy_to_flow_dir(XFRM_POLICY_OUT);
787 u32 sk_sid = security_sk_sid(sk, fl, dir); 787 u32 sk_sid = security_sk_sid(sk, fl, dir);
788restart: 788restart:
@@ -796,13 +796,14 @@ restart:
796 if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) 796 if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
797 return 0; 797 return 0;
798 798
799 policy = flow_cache_lookup(fl, sk_sid, family, dir, 799 policy = flow_cache_lookup(fl, sk_sid, dst_orig->ops->family,
800 xfrm_policy_lookup); 800 dir, xfrm_policy_lookup);
801 } 801 }
802 802
803 if (!policy) 803 if (!policy)
804 return 0; 804 return 0;
805 805
806 family = dst_orig->ops->family;
806 policy->curlft.use_time = (unsigned long)xtime.tv_sec; 807 policy->curlft.use_time = (unsigned long)xtime.tv_sec;
807 808
808 switch (policy->action) { 809 switch (policy->action) {