OSDN Git Service

Merge 4.4.118 into android-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / net / xfrm / xfrm_policy.c
index 4b09a9e..0e9ae80 100644 (file)
@@ -119,7 +119,7 @@ static inline struct dst_entry *__xfrm_dst_lookup(struct net *net,
                                                  int tos, int oif,
                                                  const xfrm_address_t *saddr,
                                                  const xfrm_address_t *daddr,
-                                                 int family)
+                                                 int family, u32 mark)
 {
        struct xfrm_policy_afinfo *afinfo;
        struct dst_entry *dst;
@@ -128,7 +128,7 @@ static inline struct dst_entry *__xfrm_dst_lookup(struct net *net,
        if (unlikely(afinfo == NULL))
                return ERR_PTR(-EAFNOSUPPORT);
 
-       dst = afinfo->dst_lookup(net, tos, oif, saddr, daddr);
+       dst = afinfo->dst_lookup(net, tos, oif, saddr, daddr, mark);
 
        xfrm_policy_put_afinfo(afinfo);
 
@@ -139,7 +139,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
                                                int tos, int oif,
                                                xfrm_address_t *prev_saddr,
                                                xfrm_address_t *prev_daddr,
-                                               int family)
+                                               int family, u32 mark)
 {
        struct net *net = xs_net(x);
        xfrm_address_t *saddr = &x->props.saddr;
@@ -155,7 +155,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
                daddr = x->coaddr;
        }
 
-       dst = __xfrm_dst_lookup(net, tos, oif, saddr, daddr, family);
+       dst = __xfrm_dst_lookup(net, tos, oif, saddr, daddr, family, mark);
 
        if (!IS_ERR(dst)) {
                if (prev_saddr != saddr)
@@ -1313,7 +1313,7 @@ EXPORT_SYMBOL(xfrm_policy_delete);
 
 int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
 {
-       struct net *net = xp_net(pol);
+       struct net *net = sock_net(sk);
        struct xfrm_policy *old_pol;
 
 #ifdef CONFIG_XFRM_SUB_POLICY
@@ -1402,14 +1402,14 @@ int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk)
 
 static int
 xfrm_get_saddr(struct net *net, int oif, xfrm_address_t *local,
-              xfrm_address_t *remote, unsigned short family)
+              xfrm_address_t *remote, unsigned short family, u32 mark)
 {
        int err;
        struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
 
        if (unlikely(afinfo == NULL))
                return -EINVAL;
-       err = afinfo->get_saddr(net, oif, local, remote);
+       err = afinfo->get_saddr(net, oif, local, remote, mark);
        xfrm_policy_put_afinfo(afinfo);
        return err;
 }
@@ -1440,7 +1440,7 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl,
                        if (xfrm_addr_any(local, tmpl->encap_family)) {
                                error = xfrm_get_saddr(net, fl->flowi_oif,
                                                       &tmp, remote,
-                                                      tmpl->encap_family);
+                                                      tmpl->encap_family, 0);
                                if (error)
                                        goto fail;
                                local = &tmp;
@@ -1719,7 +1719,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
                if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
                        family = xfrm[i]->props.family;
                        dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif,
-                                             &saddr, &daddr, family);
+                                             &saddr, &daddr, family,
+                                             xfrm[i]->props.output_mark);
                        err = PTR_ERR(dst);
                        if (IS_ERR(dst))
                                goto put_states;