Commit a35ed119 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6

into kernel.bkbits.net:/home/davem/net-2.6
parents 99643fc4 e24181d0
...@@ -52,7 +52,8 @@ static unsigned int fib_hash_size; ...@@ -52,7 +52,8 @@ static unsigned int fib_hash_size;
static unsigned int fib_info_cnt; static unsigned int fib_info_cnt;
#define DEVINDEX_HASHBITS 8 #define DEVINDEX_HASHBITS 8
static struct hlist_head fib_info_devhash[DEVINDEX_HASHBITS]; #define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE];
#ifdef CONFIG_IP_ROUTE_MULTIPATH #ifdef CONFIG_IP_ROUTE_MULTIPATH
...@@ -229,7 +230,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi) ...@@ -229,7 +230,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
static inline unsigned int fib_devindex_hashfn(unsigned int val) static inline unsigned int fib_devindex_hashfn(unsigned int val)
{ {
unsigned int mask = ((1U << DEVINDEX_HASHBITS) - 1); unsigned int mask = DEVINDEX_HASHSIZE - 1;
return (val ^ return (val ^
(val >> DEVINDEX_HASHBITS) ^ (val >> DEVINDEX_HASHBITS) ^
...@@ -1040,9 +1041,7 @@ int fib_sync_down(u32 local, struct net_device *dev, int force) ...@@ -1040,9 +1041,7 @@ int fib_sync_down(u32 local, struct net_device *dev, int force)
if (force) if (force)
scope = -1; scope = -1;
BUG_ON(!fib_info_laddrhash); if (local && fib_info_laddrhash) {
if (local) {
unsigned int hash = fib_laddr_hashfn(local); unsigned int hash = fib_laddr_hashfn(local);
struct hlist_head *head = &fib_info_laddrhash[hash]; struct hlist_head *head = &fib_info_laddrhash[hash];
struct hlist_node *node; struct hlist_node *node;
......
...@@ -2206,22 +2206,27 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp) ...@@ -2206,22 +2206,27 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
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 ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags)
{ {
int err; int err;
if ((err = __ip_route_output_key(rp, flp)) != 0) if ((err = __ip_route_output_key(rp, flp)) != 0)
return err; return err;
return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0;
if (flp->proto) {
if (!flp->fl4_src)
flp->fl4_src = (*rp)->rt_src;
if (!flp->fl4_dst)
flp->fl4_dst = (*rp)->rt_dst;
return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags);
}
return 0;
} }
int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) int ip_route_output_key(struct rtable **rp, struct flowi *flp)
{ {
int err; return ip_route_output_flow(rp, flp, NULL, 0);
if ((err = __ip_route_output_key(rp, flp)) != 0)
return err;
return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0;
} }
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,
......
...@@ -711,25 +711,11 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, ...@@ -711,25 +711,11 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
{ {
struct xfrm_policy *policy; struct xfrm_policy *policy;
struct xfrm_state *xfrm[XFRM_MAX_DEPTH]; struct xfrm_state *xfrm[XFRM_MAX_DEPTH];
struct rtable *rt = (struct rtable*)*dst_p; struct dst_entry *dst, *dst_orig = *dst_p;
struct dst_entry *dst;
int nx = 0; int nx = 0;
int err; int err;
u32 genid; u32 genid;
u16 family = (*dst_p)->ops->family; u16 family = dst_orig->ops->family;
switch (family) {
case AF_INET:
if (!fl->fl4_src)
fl->fl4_src = rt->rt_src;
if (!fl->fl4_dst)
fl->fl4_dst = rt->rt_dst;
case AF_INET6:
/* Still not clear... */
default:
/* nothing */;
}
restart: restart:
genid = atomic_read(&flow_cache_genid); genid = atomic_read(&flow_cache_genid);
policy = NULL; policy = NULL;
...@@ -738,7 +724,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, ...@@ -738,7 +724,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
if (!policy) { if (!policy) {
/* To accelerate a bit... */ /* To accelerate a bit... */
if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT])
return 0; return 0;
policy = flow_cache_lookup(fl, family, policy = flow_cache_lookup(fl, family,
...@@ -813,7 +799,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, ...@@ -813,7 +799,7 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
return 0; return 0;
} }
dst = &rt->u.dst; dst = dst_orig;
err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family); err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family);
if (unlikely(err)) { if (unlikely(err)) {
...@@ -843,12 +829,12 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, ...@@ -843,12 +829,12 @@ int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
write_unlock_bh(&policy->lock); write_unlock_bh(&policy->lock);
} }
*dst_p = dst; *dst_p = dst;
ip_rt_put(rt); dst_release(dst_orig);
xfrm_pol_put(policy); xfrm_pol_put(policy);
return 0; return 0;
error: error:
ip_rt_put(rt); dst_release(dst_orig);
xfrm_pol_put(policy); xfrm_pol_put(policy);
*dst_p = NULL; *dst_p = NULL;
return err; return err;
......
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