diff options
Diffstat (limited to 'net/ipv4/fib_trie.c')
| -rw-r--r-- | net/ipv4/fib_trie.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 237c9f72b265..a573e37e0615 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -1856,7 +1856,7 @@ void fib_table_flush_external(struct fib_table *tb) | |||
| 1856 | } | 1856 | } |
| 1857 | 1857 | ||
| 1858 | /* Caller must hold RTNL. */ | 1858 | /* Caller must hold RTNL. */ |
| 1859 | int fib_table_flush(struct net *net, struct fib_table *tb) | 1859 | int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) |
| 1860 | { | 1860 | { |
| 1861 | struct trie *t = (struct trie *)tb->tb_data; | 1861 | struct trie *t = (struct trie *)tb->tb_data; |
| 1862 | struct key_vector *pn = t->kv; | 1862 | struct key_vector *pn = t->kv; |
| @@ -1904,8 +1904,17 @@ int fib_table_flush(struct net *net, struct fib_table *tb) | |||
| 1904 | hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) { | 1904 | hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) { |
| 1905 | struct fib_info *fi = fa->fa_info; | 1905 | struct fib_info *fi = fa->fa_info; |
| 1906 | 1906 | ||
| 1907 | if (!fi || !(fi->fib_flags & RTNH_F_DEAD) || | 1907 | if (!fi || tb->tb_id != fa->tb_id || |
| 1908 | tb->tb_id != fa->tb_id) { | 1908 | (!(fi->fib_flags & RTNH_F_DEAD) && |
| 1909 | !fib_props[fa->fa_type].error)) { | ||
| 1910 | slen = fa->fa_slen; | ||
| 1911 | continue; | ||
| 1912 | } | ||
| 1913 | |||
| 1914 | /* Do not flush error routes if network namespace is | ||
| 1915 | * not being dismantled | ||
| 1916 | */ | ||
| 1917 | if (!flush_all && fib_props[fa->fa_type].error) { | ||
| 1909 | slen = fa->fa_slen; | 1918 | slen = fa->fa_slen; |
| 1910 | continue; | 1919 | continue; |
| 1911 | } | 1920 | } |
