@@ -282,10 +282,10 @@ struct xfrm_policy_afinfo {
struct dst_ops *dst_ops;
void (*garbage_collect)(struct net *net);
struct dst_entry *(*dst_lookup)(struct net *net,
- int tos, int oif,
+ const struct flowi *fl,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr);
- int (*get_saddr)(struct net *net, int oif,
+ int (*get_saddr)(struct net *net, const struct flowi *fl,
xfrm_address_t *saddr,
xfrm_address_t *daddr);
void (*decode_session)(struct sk_buff *skb,
@@ -18,9 +18,10 @@
#include <net/l3mdev.h>
static struct xfrm_policy_afinfo xfrm4_policy_afinfo;
+static int xfrm4_get_tos(const struct flowi *fl);
static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct
flowi4 *fl4,
- int tos, int oif,
+ const struct flowi *fl,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr)
{
@@ -28,8 +29,9 @@ static struct dst_entry *__xfrm4_dst_lookup(struct
net *net, struct flowi4 *fl4,
memset(fl4, 0, sizeof(*fl4));
fl4->daddr = daddr->a4;
- fl4->flowi4_tos = tos;
- fl4->flowi4_oif = oif;
+ fl4->flowi4_tos = xfrm4_get_tos(fl);
+ fl4->flowi4_oif = fl->flowi_oif;
+ fl4->flowi4_mark = fl->u.ip4.flowi4_mark;
if (saddr)
fl4->saddr = saddr->a4;
@@ -42,22 +44,22 @@ static struct dst_entry *__xfrm4_dst_lookup(struct
net *net, struct flowi4 *fl4,
return ERR_CAST(rt);
}
-static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, int oif,
+static struct dst_entry *xfrm4_dst_lookup(struct net *net, const
struct flowi *fl,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr)
{
struct flowi4 fl4;
- return __xfrm4_dst_lookup(net, &fl4, tos, oif, saddr, daddr);
+ return __xfrm4_dst_lookup(net, &fl4, fl, saddr, daddr);
}
-static int xfrm4_get_saddr(struct net *net, int oif,
+static int xfrm4_get_saddr(struct net *net, const struct flowi *fl,
xfrm_address_t *saddr, xfrm_address_t *daddr)
{
struct dst_entry *dst;
struct flowi4 fl4;
- dst = __xfrm4_dst_lookup(net, &fl4, 0, oif, NULL, daddr);
+ dst = __xfrm4_dst_lookup(net, &fl4, fl, NULL, daddr);
if (IS_ERR(dst))
return -EHOSTUNREACH;
@@ -27,7 +27,7 @@
static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
-static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif,
+static struct dst_entry *xfrm6_dst_lookup(struct net *net, const
struct flowi *fl,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr)
{
@@ -36,7 +36,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net
*net, int tos, int oif,
int err;
memset(&fl6, 0, sizeof(fl6));
- fl6.flowi6_oif = oif;
+ fl6.flowi6_oif = fl->flowi_oif;
fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF;
memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr));
if (saddr)
@@ -53,13 +53,13 @@ static struct dst_entry *xfrm6_dst_lookup(struct
net *net, int tos, int oif,
return dst;
}
-static int xfrm6_get_saddr(struct net *net, int oif,
+static int xfrm6_get_saddr(struct net *net, const struct flowi *fl,
xfrm_address_t *saddr, xfrm_address_t *daddr)
{
struct dst_entry *dst;
struct net_device *dev;
- dst = xfrm6_dst_lookup(net, 0, oif, NULL, daddr);
+ dst = xfrm6_dst_lookup(net, fl, NULL, daddr);
if (IS_ERR(dst))
return -EHOSTUNREACH;
@@ -116,7 +116,7 @@ static void xfrm_policy_put_afinfo(struct
xfrm_policy_afinfo *afinfo)
}
static inline struct dst_entry *__xfrm_dst_lookup(struct net *net,
- int tos, int oif,
+ const struct flowi *fl,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr,