Commit 68f80838 authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by Hideaki Yoshifuji

[IPV4]: Rework key route lookup interface slightly.

parent 5235d77d
......@@ -112,7 +112,8 @@ extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
u32 src, u8 tos, struct net_device *dev);
extern void ip_rt_advice(struct rtable **rp, int advice);
extern void rt_cache_flush(int how);
extern int ip_route_output_key(struct rtable **, const struct flowi *flp);
extern int __ip_route_output_key(struct rtable **, const struct flowi *flp);
extern int ip_route_output_key(struct rtable **, struct flowi *flp);
extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin);
extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
extern void ip_rt_send_redirect(struct sk_buff *skb);
......@@ -150,13 +151,15 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos
.dport = dport } } };
int err;
err = ip_route_output_key(rp, &fl);
if (err || (dst && src))
return err;
fl.fl4_dst = (*rp)->rt_dst;
fl.fl4_src = (*rp)->rt_src;
ip_rt_put(*rp);
*rp = NULL;
if (!dst || !src) {
err = __ip_route_output_key(rp, &fl);
if (err)
return err;
fl.fl4_dst = (*rp)->rt_dst;
fl.fl4_src = (*rp)->rt_src;
ip_rt_put(*rp);
*rp = NULL;
}
return ip_route_output_key(rp, &fl);
}
......
......@@ -1993,7 +1993,7 @@ out: return err;
goto done;
}
int ip_route_output_key(struct rtable **rp, const struct flowi *flp)
int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
{
unsigned hash;
struct rtable *rth;
......@@ -2023,7 +2023,20 @@ int ip_route_output_key(struct rtable **rp, const struct flowi *flp)
read_unlock_bh(&rt_hash_table[hash].lock);
return ip_route_output_slow(rp, flp);
}
}
int ip_route_output_key(struct rtable **rp, struct flowi *flp)
{
int err;
if ((err = __ip_route_output_key(rp, flp)) != 0)
return err;
#if 0
return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0;
#else
return 0;
#endif
}
static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
int nowait)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment