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, ...@@ -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); u32 src, u8 tos, struct net_device *dev);
extern void ip_rt_advice(struct rtable **rp, int advice); extern void ip_rt_advice(struct rtable **rp, int advice);
extern void rt_cache_flush(int how); 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 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 unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
extern void ip_rt_send_redirect(struct sk_buff *skb); 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 ...@@ -150,13 +151,15 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos
.dport = dport } } }; .dport = dport } } };
int err; int err;
err = ip_route_output_key(rp, &fl); if (!dst || !src) {
if (err || (dst && src)) err = __ip_route_output_key(rp, &fl);
return err; if (err)
fl.fl4_dst = (*rp)->rt_dst; return err;
fl.fl4_src = (*rp)->rt_src; fl.fl4_dst = (*rp)->rt_dst;
ip_rt_put(*rp); fl.fl4_src = (*rp)->rt_src;
*rp = NULL; ip_rt_put(*rp);
*rp = NULL;
}
return ip_route_output_key(rp, &fl); return ip_route_output_key(rp, &fl);
} }
......
...@@ -1993,7 +1993,7 @@ out: return err; ...@@ -1993,7 +1993,7 @@ out: return err;
goto done; 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; unsigned hash;
struct rtable *rth; struct rtable *rth;
...@@ -2023,7 +2023,20 @@ int ip_route_output_key(struct rtable **rp, const struct flowi *flp) ...@@ -2023,7 +2023,20 @@ int ip_route_output_key(struct rtable **rp, const struct flowi *flp)
read_unlock_bh(&rt_hash_table[hash].lock); read_unlock_bh(&rt_hash_table[hash].lock);
return ip_route_output_slow(rp, flp); 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, static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
int nowait) 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