Merge branch 'fix/hda' of git://github.com/tiwai/sound
[pandora-kernel.git] / net / xfrm / xfrm_policy.c
index 5ce74a3..552df27 100644 (file)
@@ -1349,14 +1349,16 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
                BUG();
        }
        xdst = dst_alloc(dst_ops, NULL, 0, 0, 0);
-       memset(&xdst->u.rt6.rt6i_table, 0, sizeof(*xdst) - sizeof(struct dst_entry));
-       xfrm_policy_put_afinfo(afinfo);
 
-       if (likely(xdst))
+       if (likely(xdst)) {
+               memset(&xdst->u.rt6.rt6i_table, 0,
+                       sizeof(*xdst) - sizeof(struct dst_entry));
                xdst->flo.ops = &xfrm_bundle_fc_ops;
-       else
+       else
                xdst = ERR_PTR(-ENOBUFS);
 
+       xfrm_policy_put_afinfo(afinfo);
+
        return xdst;
 }
 
@@ -1497,7 +1499,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
                goto free_dst;
 
        /* Copy neighbour for reachability confirmation */
-       dst0->neighbour = neigh_clone(dst->neighbour);
+       dst_set_neighbour(dst0, neigh_clone(dst_get_neighbour(dst)));
 
        xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len);
        xfrm_init_pmtu(dst_prev);
@@ -2385,6 +2387,11 @@ static unsigned int xfrm_default_mtu(const struct dst_entry *dst)
        return dst_mtu(dst->path);
 }
 
+static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr)
+{
+       return dst_neigh_lookup(dst->path, daddr);
+}
+
 int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 {
        struct net *net;
@@ -2410,6 +2417,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
                        dst_ops->negative_advice = xfrm_negative_advice;
                if (likely(dst_ops->link_failure == NULL))
                        dst_ops->link_failure = xfrm_link_failure;
+               if (likely(dst_ops->neigh_lookup == NULL))
+                       dst_ops->neigh_lookup = xfrm_neigh_lookup;
                if (likely(afinfo->garbage_collect == NULL))
                        afinfo->garbage_collect = __xfrm_garbage_collect;
                xfrm_policy_afinfo[afinfo->family] = afinfo;