packages: kernel/kernel-routes.patch, kernel/kernel-tuxonice-headers.patch, ...

arekm arekm at pld-linux.org
Sat Jan 8 19:15:05 CET 2011


Author: arekm                        Date: Sat Jan  8 18:15:05 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- update routes, vserver and tuxonice patches

---- Files affected:
packages/kernel:
   kernel-routes.patch (1.11 -> 1.12) , kernel-tuxonice-headers.patch (1.4 -> 1.5) , kernel-tuxonice.patch (1.19 -> 1.20) , kernel-vserver-2.3.patch (1.53 -> 1.54) , kernel.spec (1.868 -> 1.869) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-routes.patch
diff -u packages/kernel/kernel-routes.patch:1.11 packages/kernel/kernel-routes.patch:1.12
--- packages/kernel/kernel-routes.patch:1.11	Sat Oct 23 15:55:45 2010
+++ packages/kernel/kernel-routes.patch	Sat Jan  8 19:14:58 2011
@@ -1,6 +1,6 @@
-diff -urp v2.6.36/linux/include/linux/rtnetlink.h linux/include/linux/rtnetlink.h
---- v2.6.36/linux/include/linux/rtnetlink.h	2010-10-22 11:34:37.000000000 +0300
-+++ linux/include/linux/rtnetlink.h	2010-10-23 15:03:19.704274198 +0300
+diff -urp v2.6.37/linux/include/linux/rtnetlink.h linux/include/linux/rtnetlink.h
+--- v2.6.37/linux/include/linux/rtnetlink.h	2011-01-06 00:01:18.000000000 +0200
++++ linux/include/linux/rtnetlink.h	2011-01-08 17:20:30.066270851 +0200
 @@ -312,6 +312,8 @@ struct rtnexthop {
  #define RTNH_F_DEAD		1	/* Nexthop is dead (used by multipath)	*/
  #define RTNH_F_PERVASIVE	2	/* Do recursive gateway lookup	*/
@@ -10,9 +10,9 @@
  
  /* Macros to handle hexthops */
  
-diff -urp v2.6.36/linux/include/net/flow.h linux/include/net/flow.h
---- v2.6.36/linux/include/net/flow.h	2010-08-02 09:37:48.000000000 +0300
-+++ linux/include/net/flow.h	2010-10-23 15:04:36.408274819 +0300
+diff -urp v2.6.37/linux/include/net/flow.h linux/include/net/flow.h
+--- v2.6.37/linux/include/net/flow.h	2010-08-02 09:37:48.000000000 +0300
++++ linux/include/net/flow.h	2011-01-08 17:21:40.092271753 +0200
 @@ -19,6 +19,8 @@ struct flowi {
  		struct {
  			__be32			daddr;
@@ -31,10 +31,10 @@
  #define fl4_tos		nl_u.ip4_u.tos
  #define fl4_scope	nl_u.ip4_u.scope
  
-diff -urp v2.6.36/linux/include/net/ip_fib.h linux/include/net/ip_fib.h
---- v2.6.36/linux/include/net/ip_fib.h	2010-02-25 09:01:36.000000000 +0200
-+++ linux/include/net/ip_fib.h	2010-10-23 15:03:19.704274198 +0300
-@@ -207,6 +207,8 @@ extern int fib_lookup(struct net *n, str
+diff -urp v2.6.37/linux/include/net/ip_fib.h linux/include/net/ip_fib.h
+--- v2.6.37/linux/include/net/ip_fib.h	2011-01-06 00:01:19.000000000 +0200
++++ linux/include/net/ip_fib.h	2011-01-08 17:20:30.066270851 +0200
+@@ -210,6 +210,8 @@ extern int fib_lookup(struct net *n, str
  extern struct fib_table *fib_new_table(struct net *net, u32 id);
  extern struct fib_table *fib_get_table(struct net *net, u32 id);
  
@@ -43,16 +43,16 @@
  #endif /* CONFIG_IP_MULTIPLE_TABLES */
  
  /* Exported by fib_frontend.c */
-@@ -277,4 +279,6 @@ static inline void fib_proc_exit(struct 
+@@ -270,4 +272,6 @@ static inline void fib_proc_exit(struct 
  }
  #endif
  
 +extern rwlock_t fib_nhflags_lock;
 +
  #endif  /* _NET_FIB_H */
-diff -urp v2.6.36/linux/include/net/netfilter/nf_nat.h linux/include/net/netfilter/nf_nat.h
---- v2.6.36/linux/include/net/netfilter/nf_nat.h	2010-02-25 09:01:36.000000000 +0200
-+++ linux/include/net/netfilter/nf_nat.h	2010-10-23 15:04:36.408274819 +0300
+diff -urp v2.6.37/linux/include/net/netfilter/nf_nat.h linux/include/net/netfilter/nf_nat.h
+--- v2.6.37/linux/include/net/netfilter/nf_nat.h	2010-02-25 09:01:36.000000000 +0200
++++ linux/include/net/netfilter/nf_nat.h	2011-01-08 17:21:40.092271753 +0200
 @@ -73,6 +73,13 @@ struct nf_conn_nat {
  #endif
  };
@@ -67,9 +67,9 @@
  /* Set up the info structure to map into this range. */
  extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
  				      const struct nf_nat_range *range,
-diff -urp v2.6.36/linux/include/net/route.h linux/include/net/route.h
---- v2.6.36/linux/include/net/route.h	2010-10-22 11:34:37.000000000 +0300
-+++ linux/include/net/route.h	2010-10-23 15:04:36.409274028 +0300
+diff -urp v2.6.37/linux/include/net/route.h linux/include/net/route.h
+--- v2.6.37/linux/include/net/route.h	2010-10-22 11:34:37.000000000 +0300
++++ linux/include/net/route.h	2011-01-08 17:21:40.093271136 +0200
 @@ -126,6 +126,7 @@ static inline int ip_route_input_noref(s
  	return ip_route_input_common(skb, dst, src, tos, devin, true);
  }
@@ -78,10 +78,10 @@
  extern unsigned short	ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
  extern void		ip_rt_send_redirect(struct sk_buff *skb);
  
-diff -urp v2.6.36/linux/net/bridge/br_netfilter.c linux/net/bridge/br_netfilter.c
---- v2.6.36/linux/net/bridge/br_netfilter.c	2010-10-22 11:34:37.000000000 +0300
-+++ linux/net/bridge/br_netfilter.c	2010-10-23 15:04:36.410274544 +0300
-@@ -337,6 +337,9 @@ static int br_nf_pre_routing_finish(stru
+diff -urp v2.6.37/linux/net/bridge/br_netfilter.c linux/net/bridge/br_netfilter.c
+--- v2.6.37/linux/net/bridge/br_netfilter.c	2011-01-06 00:01:21.000000000 +0200
++++ linux/net/bridge/br_netfilter.c	2011-01-08 17:21:40.094271883 +0200
+@@ -404,6 +404,9 @@ static int br_nf_pre_routing_finish(stru
  	struct rtable *rt;
  	int err;
  
@@ -91,9 +91,9 @@
  	if (nf_bridge->mask & BRNF_PKT_TYPE) {
  		skb->pkt_type = PACKET_OTHERHOST;
  		nf_bridge->mask ^= BRNF_PKT_TYPE;
-diff -urp v2.6.36/linux/net/ipv4/fib_frontend.c linux/net/ipv4/fib_frontend.c
---- v2.6.36/linux/net/ipv4/fib_frontend.c	2010-10-22 11:34:38.000000000 +0300
-+++ linux/net/ipv4/fib_frontend.c	2010-10-23 15:03:19.706274107 +0300
+diff -urp v2.6.37/linux/net/ipv4/fib_frontend.c linux/net/ipv4/fib_frontend.c
+--- v2.6.37/linux/net/ipv4/fib_frontend.c	2011-01-06 00:01:22.000000000 +0200
++++ linux/net/ipv4/fib_frontend.c	2011-01-08 17:20:30.067270952 +0200
 @@ -47,6 +47,8 @@
  
  #ifndef CONFIG_IP_MULTIPLE_TABLES
@@ -122,9 +122,9 @@
  		fib_table_select_default(tb, flp, res);
  }
  
-@@ -245,6 +250,9 @@ int fib_validate_source(__be32 src, __be
- 			    .iif = oif };
- 
+@@ -264,6 +269,9 @@ int fib_validate_source(__be32 src, __be
+ 		.iif = oif
+ 	};
  	struct fib_result res;
 +	int table;
 +	unsigned char prefixlen;
@@ -132,14 +132,13 @@
  	int no_addr, rpf, accept_local;
  	bool dev_match;
  	int ret;
-@@ -294,21 +302,29 @@ int fib_validate_source(__be32 src, __be
- 		fib_res_put(&res);
+@@ -310,19 +318,26 @@ int fib_validate_source(__be32 src, __be
+ 		ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST;
  		return ret;
  	}
 +	table = FIB_RES_TABLE(&res);
 +	prefixlen = res.prefixlen;
 +	scope = res.scope;
- 	fib_res_put(&res);
  	if (no_addr)
  		goto last_resort;
 -	if (rpf == 1)
@@ -155,17 +154,15 @@
 +		     !rpf)) {
  			*spec_dst = FIB_RES_PREFSRC(res);
  			ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST;
-+			fib_res_put(&res);
 +			return ret;
  		}
- 		fib_res_put(&res);
  	}
 +	if (rpf == 1)
 +		goto e_rpf;
  	return ret;
  
  last_resort:
-@@ -933,9 +949,7 @@ static int fib_inetaddr_event(struct not
+@@ -954,9 +969,7 @@ static int fib_inetaddr_event(struct not
  	switch (event) {
  	case NETDEV_UP:
  		fib_add_ifaddr(ifa);
@@ -175,7 +172,7 @@
  		rt_cache_flush(dev_net(dev), -1);
  		break;
  	case NETDEV_DOWN:
-@@ -971,9 +985,7 @@ static int fib_netdev_event(struct notif
+@@ -992,9 +1005,7 @@ static int fib_netdev_event(struct notif
  		for_ifa(in_dev) {
  			fib_add_ifaddr(ifa);
  		} endfor_ifa(in_dev);
@@ -185,49 +182,59 @@
  		rt_cache_flush(dev_net(dev), -1);
  		break;
  	case NETDEV_DOWN:
-diff -urp v2.6.36/linux/net/ipv4/fib_hash.c linux/net/ipv4/fib_hash.c
---- v2.6.36/linux/net/ipv4/fib_hash.c	2010-05-17 10:49:01.000000000 +0300
-+++ linux/net/ipv4/fib_hash.c	2010-10-23 15:03:19.707274360 +0300
-@@ -278,25 +278,35 @@ out:
+diff -urp v2.6.37/linux/net/ipv4/fib_hash.c linux/net/ipv4/fib_hash.c
+--- v2.6.37/linux/net/ipv4/fib_hash.c	2011-01-06 00:01:22.000000000 +0200
++++ linux/net/ipv4/fib_hash.c	2011-01-08 17:20:30.068270994 +0200
+@@ -305,27 +305,43 @@ out:
  void fib_table_select_default(struct fib_table *tb,
  			      const struct flowi *flp, struct fib_result *res)
  {
 -	int order, last_idx;
-+	int order, last_idx, last_dflt, last_nhsel;
-+	struct fib_alias *first_fa = NULL;
-+	struct hlist_head *head;
++	int order, last_idx, last_dflt, last_nhsel, good;
++	struct fib_alias *first_fa;
  	struct hlist_node *node;
  	struct fib_node *f;
- 	struct fib_info *fi = NULL;
+-	struct fib_info *fi = NULL;
++	struct fib_info *fi;
  	struct fib_info *last_resort;
  	struct fn_hash *t = (struct fn_hash *)tb->tb_data;
 -	struct fn_zone *fz = t->fn_zones[0];
 +	struct fn_zone *fz = t->fn_zones[res->prefixlen];
+ 	struct hlist_head *head;
 +	__be32 k;
++	unsigned int seq;
  
  	if (fz == NULL)
  		return;
  
 +	k = fz_key(flp->fl4_dst, fz);
++
++	rcu_read_lock();
++
++retry:
 +	last_dflt = -2;
 +	last_nhsel = 0;
  	last_idx = -1;
  	last_resort = NULL;
  	order = -1;
- 
- 	read_lock(&fib_hash_lock);
--	hlist_for_each_entry(f, node, &fz->fz_hash[0], fn_hash) {
-+	head = &fz->fz_hash[fn_hash(k, fz)];
-+	hlist_for_each_entry(f, node, head, fn_hash) {
++	fi = NULL;
++	first_fa = NULL;
++	good = 0;
+ 
+-	rcu_read_lock();
+-	head = rcu_dereference(fz->fz_hash);
++	seq = read_seqbegin(&fz->fz_lock);
++	head = rcu_dereference(fz->fz_hash) + fn_hash(k, fz);
+ 	hlist_for_each_entry_rcu(f, node, head, fn_hash) {
  		struct fib_alias *fa;
  
 +		if (f->fn_key != k)
 +			continue;
 +
- 		list_for_each_entry(fa, &f->fn_alias, fa_list) {
+ 		list_for_each_entry_rcu(fa, &f->fn_alias, fa_list) {
  			struct fib_info *next_fi = fa->fa_info;
  
-@@ -304,42 +314,56 @@ void fib_table_select_default(struct fib
+@@ -333,43 +349,66 @@ void fib_table_select_default(struct fib
  			    fa->fa_type != RTN_UNICAST)
  				continue;
  
@@ -239,28 +246,40 @@
 -			if (!next_fi->fib_nh[0].nh_gw ||
 -			    next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK)
 -				continue;
- 			fa->fa_state |= FA_S_ACCESSED;
+ 
+ 			fib_alias_accessed(fa);
  
 -			if (fi == NULL) {
 -				if (next_fi != res->fi)
 -					break;
 -			} else if (!fib_detect_death(fi, order, &last_resort,
 -						&last_idx, tb->tb_default)) {
+-				fib_result_assign(res, fi);
+-				tb->tb_default = order;
+-				goto out;
 +			if (!first_fa) {
 +				last_dflt = fa->fa_last_dflt;
 +				first_fa = fa;
 +			}
 +			if (fi && !fib_detect_death(fi, order, &last_resort,
 +				&last_idx, &last_dflt, &last_nhsel, flp)) {
- 				fib_result_assign(res, fi);
--				tb->tb_default = order;
-+				first_fa->fa_last_dflt = order;
- 				goto out;
++				good = 1;
++				goto done1;
  			}
  			fi = next_fi;
  			order++;
  		}
 +		break;
++	}
++
++done1:
++	if (read_seqretry(&fz->fz_lock, seq))
++		goto retry;
++
++	if (good) {
++		fib_result_assign(res, fi);
++		first_fa->fa_last_dflt = order;
++		goto out;
  	}
  
  	if (order <= 0 || fi == NULL) {
@@ -296,17 +315,17 @@
 +		first_fa->fa_last_dflt = last_idx;
 +	}
  out:
- 	read_unlock(&fib_hash_lock);
+ 	rcu_read_unlock();
  }
-@@ -463,6 +487,7 @@ int fib_table_insert(struct fib_table *t
- 			write_lock_bh(&fib_hash_lock);
- 			fi_drop = fa->fa_info;
- 			fa->fa_info = fi;
-+			fa->fa_last_dflt = -1;
- 			fa->fa_type = cfg->fc_type;
- 			fa->fa_scope = cfg->fc_scope;
+@@ -507,6 +546,7 @@ int fib_table_insert(struct fib_table *t
+ 
+ 			new_fa->fa_tos = fa->fa_tos;
+ 			new_fa->fa_info = fi;
++			new_fa->fa_last_dflt = -1;
+ 			new_fa->fa_type = cfg->fc_type;
+ 			new_fa->fa_scope = cfg->fc_scope;
  			state = fa->fa_state;
-@@ -517,6 +542,7 @@ int fib_table_insert(struct fib_table *t
+@@ -559,6 +599,7 @@ int fib_table_insert(struct fib_table *t
  	new_fa->fa_type = cfg->fc_type;
  	new_fa->fa_scope = cfg->fc_scope;
  	new_fa->fa_state = 0;
@@ -314,9 +333,9 @@
  
  	/*
  	 * Insert new entry to the list.
-diff -urp v2.6.36/linux/net/ipv4/fib_lookup.h linux/net/ipv4/fib_lookup.h
---- v2.6.36/linux/net/ipv4/fib_lookup.h	2009-09-11 10:27:17.000000000 +0300
-+++ linux/net/ipv4/fib_lookup.h	2010-10-23 15:03:19.707274360 +0300
+diff -urp v2.6.37/linux/net/ipv4/fib_lookup.h linux/net/ipv4/fib_lookup.h
+--- v2.6.37/linux/net/ipv4/fib_lookup.h	2011-01-06 00:01:22.000000000 +0200
++++ linux/net/ipv4/fib_lookup.h	2011-01-08 17:20:30.069271071 +0200
 @@ -8,6 +8,7 @@
  struct fib_alias {
  	struct list_head	fa_list;
@@ -325,7 +344,7 @@
  	u8			fa_tos;
  	u8			fa_type;
  	u8			fa_scope;
-@@ -37,7 +38,8 @@ extern struct fib_alias *fib_find_alias(
+@@ -42,7 +43,8 @@ extern struct fib_alias *fib_find_alias(
  					u8 tos, u32 prio);
  extern int fib_detect_death(struct fib_info *fi, int order,
  			    struct fib_info **last_resort,
@@ -335,10 +354,10 @@
  
  static inline void fib_result_assign(struct fib_result *res,
  				     struct fib_info *fi)
-diff -urp v2.6.36/linux/net/ipv4/fib_rules.c linux/net/ipv4/fib_rules.c
---- v2.6.36/linux/net/ipv4/fib_rules.c	2010-08-02 09:37:49.000000000 +0300
-+++ linux/net/ipv4/fib_rules.c	2010-10-23 15:03:19.708274528 +0300
-@@ -54,6 +54,11 @@ u32 fib_rules_tclass(struct fib_result *
+diff -urp v2.6.37/linux/net/ipv4/fib_rules.c linux/net/ipv4/fib_rules.c
+--- v2.6.37/linux/net/ipv4/fib_rules.c	2011-01-06 00:01:22.000000000 +0200
++++ linux/net/ipv4/fib_rules.c	2011-01-08 17:20:30.070271447 +0200
+@@ -53,6 +53,11 @@ u32 fib_rules_tclass(struct fib_result *
  }
  #endif
  
@@ -350,9 +369,9 @@
  int fib_lookup(struct net *net, struct flowi *flp, struct fib_result *res)
  {
  	struct fib_lookup_arg arg = {
-diff -urp v2.6.36/linux/net/ipv4/fib_semantics.c linux/net/ipv4/fib_semantics.c
---- v2.6.36/linux/net/ipv4/fib_semantics.c	2010-05-17 10:49:01.000000000 +0300
-+++ linux/net/ipv4/fib_semantics.c	2010-10-23 15:04:36.412272841 +0300
+diff -urp v2.6.37/linux/net/ipv4/fib_semantics.c linux/net/ipv4/fib_semantics.c
+--- v2.6.37/linux/net/ipv4/fib_semantics.c	2011-01-06 00:01:22.000000000 +0200
++++ linux/net/ipv4/fib_semantics.c	2011-01-08 17:21:40.095271450 +0200
 @@ -51,6 +51,7 @@ static struct hlist_head *fib_info_hash;
  static struct hlist_head *fib_info_laddrhash;
  static unsigned int fib_hash_size;
@@ -361,25 +380,25 @@
  
  #define DEVINDEX_HASHBITS 8
  #define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
-@@ -187,7 +188,7 @@ static __inline__ int nh_comp(const stru
+@@ -203,7 +204,7 @@ static inline int nh_comp(const struct f
  #ifdef CONFIG_NET_CLS_ROUTE
  		    nh->nh_tclassid != onh->nh_tclassid ||
  #endif
--		    ((nh->nh_flags^onh->nh_flags)&~RTNH_F_DEAD))
-+		    ((nh->nh_flags^onh->nh_flags)&~RTNH_F_BADSTATE))
+-		    ((nh->nh_flags ^ onh->nh_flags) & ~RTNH_F_DEAD))
++		    ((nh->nh_flags ^ onh->nh_flags) & ~RTNH_F_BADSTATE))
  			return -1;
  		onh++;
  	} endfor_nexthops(fi);
-@@ -238,7 +239,7 @@ static struct fib_info *fib_find_info(co
+@@ -254,7 +255,7 @@ static struct fib_info *fib_find_info(co
  		    nfi->fib_priority == fi->fib_priority &&
  		    memcmp(nfi->fib_metrics, fi->fib_metrics,
  			   sizeof(fi->fib_metrics)) == 0 &&
--		    ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_DEAD) == 0 &&
-+		    ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_BADSTATE) == 0 &&
+-		    ((nfi->fib_flags ^ fi->fib_flags) & ~RTNH_F_DEAD) == 0 &&
++		    ((nfi->fib_flags ^ fi->fib_flags) & ~RTNH_F_BADSTATE) == 0 &&
  		    (nfi->fib_nhs == 0 || nh_comp(fi, nfi) == 0))
  			return fi;
  	}
-@@ -350,26 +351,70 @@ struct fib_alias *fib_find_alias(struct 
+@@ -365,26 +366,70 @@ struct fib_alias *fib_find_alias(struct 
  }
  
  int fib_detect_death(struct fib_info *fi, int order,
@@ -412,10 +431,10 @@
 -	}
 -	if (state == NUD_REACHABLE)
 -		return 0;
--	if ((state&NUD_VALID) && order != dflt)
+-	if ((state & NUD_VALID) && order != dflt)
 -		return 0;
--	if ((state&NUD_VALID) ||
--	    (*last_idx<0 && order > dflt)) {
+-	if ((state & NUD_VALID) ||
+-	    (*last_idx < 0 && order > dflt)) {
 -		*last_resort = fi;
 -		*last_idx = order;
 +		flag = 0;
@@ -434,17 +453,17 @@
 +			state = n->nud_state;
 +			neigh_release(n);
 +		}
-+		if (state==NUD_REACHABLE ||
-+			((state&NUD_VALID) && order != *dflt)) {
++		if (state == NUD_REACHABLE ||
++		    ((state & NUD_VALID) && order != *dflt)) {
 +			dead = 0;
 +			goto setfl;
 +		}
-+		if (!(state&NUD_VALID))
++		if (!(state & NUD_VALID))
 +			flag = 1;
 +		if (!dead)
 +			goto setfl;
-+		if ((state&NUD_VALID) ||
-+		    (*last_idx<0 && order >= *dflt)) {
++		if ((state & NUD_VALID) ||
++		    (*last_idx < 0 && order >= *dflt)) {
 +			*last_resort = fi;
 +			*last_idx = order;
 +			*last_nhsel = nhsel;
@@ -466,13 +485,13 @@
  }
  
  #ifdef CONFIG_IP_ROUTE_MULTIPATH
-@@ -538,8 +583,11 @@ static int fib_check_nh(struct fib_confi
- 				return -EINVAL;
- 			if ((dev = __dev_get_by_index(net, nh->nh_oif)) == NULL)
+@@ -553,8 +598,11 @@ static int fib_check_nh(struct fib_confi
+ 			dev = __dev_get_by_index(net, nh->nh_oif);
+ 			if (!dev)
  				return -ENODEV;
--			if (!(dev->flags&IFF_UP))
+-			if (!(dev->flags & IFF_UP))
 -				return -ENETDOWN;
-+			if (!(dev->flags&IFF_UP)) {
++			if (!(dev->flags & IFF_UP)) {
 +				if (fi->fib_protocol != RTPROT_STATIC)
 +					return -ENETDOWN;
 +				nh->nh_flags |= RTNH_F_DEAD;
@@ -480,88 +499,78 @@
  			nh->nh_dev = dev;
  			dev_hold(dev);
  			nh->nh_scope = RT_SCOPE_LINK;
-@@ -559,24 +607,48 @@ static int fib_check_nh(struct fib_confi
- 			/* It is not necessary, but requires a bit of thinking */
+@@ -576,21 +624,41 @@ static int fib_check_nh(struct fib_confi
  			if (fl.fl4_scope < RT_SCOPE_LINK)
  				fl.fl4_scope = RT_SCOPE_LINK;
--			if ((err = fib_lookup(net, &fl, &res)) != 0)
+ 			err = fib_lookup(net, &fl, &res);
+-			if (err) {
+-				rcu_read_unlock();
 -				return err;
-+			err = fib_lookup(net, &fl, &res);
- 		}
--		err = -EINVAL;
--		if (res.type != RTN_UNICAST && res.type != RTN_LOCAL)
--			goto out;
--		nh->nh_scope = res.scope;
--		nh->nh_oif = FIB_RES_OIF(res);
--		if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL)
--			goto out;
--		dev_hold(nh->nh_dev);
--		err = -ENETDOWN;
--		if (!(nh->nh_dev->flags & IFF_UP))
--			goto out;
--		err = 0;
++		}
 +		if (err) {
 +			struct in_device *in_dev;
 +
 +			if (err != -ENETUNREACH ||
 +			    fi->fib_protocol != RTPROT_STATIC)
-+				return err;
++				goto out;
 +
 +			in_dev = inetdev_by_index(net, nh->nh_oif);
 +			if (in_dev == NULL ||
-+			    in_dev->dev->flags & IFF_UP) {
-+				if (in_dev)
-+					in_dev_put(in_dev);
-+				return err;
-+			}
++			    in_dev->dev->flags & IFF_UP)
++				goto out;
 +			nh->nh_flags |= RTNH_F_DEAD;
 +			nh->nh_scope = RT_SCOPE_LINK;
 +			nh->nh_dev = in_dev->dev;
 +			dev_hold(nh->nh_dev);
-+			in_dev_put(in_dev);
 +		} else {
 +			err = -EINVAL;
 +			if (res.type != RTN_UNICAST && res.type != RTN_LOCAL)
 +				goto out;
 +			nh->nh_scope = res.scope;
 +			nh->nh_oif = FIB_RES_OIF(res);
-+			if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL)
++			nh->nh_dev = dev = FIB_RES_DEV(res);
++			if (!dev)
 +				goto out;
-+			dev_hold(nh->nh_dev);
++			dev_hold(dev);
 +			if (!(nh->nh_dev->flags & IFF_UP)) {
 +				if (fi->fib_protocol != RTPROT_STATIC) {
 +					err = -ENETDOWN;
 +					goto out;
 +				}
 +				nh->nh_flags |= RTNH_F_DEAD;
-+			}
+ 			}
 +			err = 0;
- out:
--		fib_res_put(&res);
--		return err;
-+			fib_res_put(&res);
-+			return err;
-+		}
+ 		}
+-		err = -EINVAL;
+-		if (res.type != RTN_UNICAST && res.type != RTN_LOCAL)
+-			goto out;
+-		nh->nh_scope = res.scope;
+-		nh->nh_oif = FIB_RES_OIF(res);
+-		nh->nh_dev = dev = FIB_RES_DEV(res);
+-		if (!dev)
+-			goto out;
+-		dev_hold(dev);
+-		err = (dev->flags & IFF_UP) ? 0 : -ENETDOWN;
  	} else {
  		struct in_device *in_dev;
  
-@@ -587,8 +659,11 @@ out:
+@@ -603,8 +671,11 @@ static int fib_check_nh(struct fib_confi
  		if (in_dev == NULL)
- 			return -ENODEV;
- 		if (!(in_dev->dev->flags&IFF_UP)) {
--			in_dev_put(in_dev);
--			return -ENETDOWN;
-+			if (fi->fib_protocol != RTPROT_STATIC) {
-+				in_dev_put(in_dev);
-+				return -ENETDOWN;
-+			}
+ 			goto out;
+ 		err = -ENETDOWN;
+-		if (!(in_dev->dev->flags & IFF_UP))
+-			goto out;
++		if (!(in_dev->dev->flags & IFF_UP)) {
++			if (fi->fib_protocol != RTPROT_STATIC)
++				goto out;
 +			nh->nh_flags |= RTNH_F_DEAD;
- 		}
++		}
  		nh->nh_dev = in_dev->dev;
  		dev_hold(nh->nh_dev);
-@@ -897,8 +972,12 @@ int fib_semantic_match(struct list_head 
+ 		nh->nh_scope = RT_SCOPE_HOST;
+@@ -919,8 +990,12 @@ int fib_semantic_match(struct list_head 
  				for_nexthops(fi) {
- 					if (nh->nh_flags&RTNH_F_DEAD)
+ 					if (nh->nh_flags & RTNH_F_DEAD)
  						continue;
 -					if (!flp->oif || flp->oif == nh->nh_oif)
 -						break;
@@ -574,17 +583,17 @@
  				}
  #ifdef CONFIG_IP_ROUTE_MULTIPATH
  				if (nhsel < fi->fib_nhs) {
-@@ -1078,18 +1157,29 @@ int fib_sync_down_dev(struct net_device 
+@@ -1100,18 +1175,29 @@ int fib_sync_down_dev(struct net_device 
  		prev_fi = fi;
  		dead = 0;
  		change_nexthops(fi) {
--			if (nexthop_nh->nh_flags&RTNH_F_DEAD)
+-			if (nexthop_nh->nh_flags & RTNH_F_DEAD)
 -				dead++;
 -			else if (nexthop_nh->nh_dev == dev &&
 -				 nexthop_nh->nh_scope != scope) {
 -				nexthop_nh->nh_flags |= RTNH_F_DEAD;
-+			if (nexthop_nh->nh_flags&RTNH_F_DEAD) {
-+				if (fi->fib_protocol!=RTPROT_STATIC ||
++			if (nexthop_nh->nh_flags & RTNH_F_DEAD) {
++				if (fi->fib_protocol != RTPROT_STATIC ||
 +				    nexthop_nh->nh_dev == NULL ||
 +				    __in_dev_get_rtnl(nexthop_nh->nh_dev) == NULL ||
 +				    nexthop_nh->nh_dev->flags&IFF_UP)
@@ -612,20 +621,20 @@
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-routes.patch?r1=1.11&r2=1.12&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-tuxonice-headers.patch?r1=1.4&r2=1.5&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-tuxonice.patch?r1=1.19&r2=1.20&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-vserver-2.3.patch?r1=1.53&r2=1.54&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel.spec?r1=1.868&r2=1.869&f=u



More information about the pld-cvs-commit mailing list