ipv6: Convert to use flowi6 where applicable.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2011-03-12 16:22:43 -05:00
commit 4c9483b2fb
35 changed files with 622 additions and 620 deletions

View file

@ -75,15 +75,13 @@ static int __ip_vs_addr_is_local_v6(struct net *net,
const struct in6_addr *addr)
{
struct rt6_info *rt;
struct flowi fl = {
.flowi_oif = 0,
.fl6_dst = *addr,
.fl6_src = { .s6_addr32 = {0, 0, 0, 0} },
struct flowi6 fl6 = {
.daddr = *addr,
};
rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl);
rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6);
if (rt && rt->rt6i_dev && (rt->rt6i_dev->flags & IFF_LOOPBACK))
return 1;
return 1;
return 0;
}

View file

@ -198,27 +198,27 @@ __ip_vs_route_output_v6(struct net *net, struct in6_addr *daddr,
struct in6_addr *ret_saddr, int do_xfrm)
{
struct dst_entry *dst;
struct flowi fl = {
.fl6_dst = *daddr,
struct flowi6 fl6 = {
.daddr = *daddr,
};
dst = ip6_route_output(net, NULL, &fl);
dst = ip6_route_output(net, NULL, &fl6);
if (dst->error)
goto out_err;
if (!ret_saddr)
return dst;
if (ipv6_addr_any(&fl.fl6_src) &&
if (ipv6_addr_any(&fl6.saddr) &&
ipv6_dev_get_saddr(net, ip6_dst_idev(dst)->dev,
&fl.fl6_dst, 0, &fl.fl6_src) < 0)
&fl6.daddr, 0, &fl6.saddr) < 0)
goto out_err;
if (do_xfrm) {
dst = xfrm_lookup(net, dst, &fl, NULL, 0);
dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
if (IS_ERR(dst)) {
dst = NULL;
goto out_err;
}
}
ipv6_addr_copy(ret_saddr, &fl.fl6_src);
ipv6_addr_copy(ret_saddr, &fl6.saddr);
return dst;
out_err:

View file

@ -143,18 +143,18 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
const struct ipv6hdr *iph = ipv6_hdr(skb);
struct net *net = pick_net(skb);
struct dst_entry *dst;
struct flowi fl;
struct flowi6 fl6;
memset(&fl, 0, sizeof(fl));
memset(&fl6, 0, sizeof(fl6));
if (info->priv) {
if (info->priv->oif == -1)
return false;
fl.flowi_oif = info->priv->oif;
fl6.flowi6_oif = info->priv->oif;
}
fl.fl6_dst = info->gw.in6;
fl.fl6_flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
fl6.daddr = info->gw.in6;
fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
(iph->flow_lbl[1] << 8) | iph->flow_lbl[2];
dst = ip6_route_output(net, NULL, &fl);
dst = ip6_route_output(net, NULL, &fl6);
if (dst == NULL)
return false;