diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2014-10-06 13:58:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-07 00:02:30 -0400 |
commit | c8c4d42a6b46ea9f81816c47ac8d6ae25cf533fc (patch) | |
tree | d12f1487398a386448f83481fe177d63c9d655b7 /net | |
parent | 42b18706469a02c1f84375ac0ee2f30f28d85d4c (diff) |
ipv6: only generate one new serial number per fib mutation
Cc: YOSHIFUJI Hideaki <hideaki@yoshifuji.org>
Cc: Martin Lau <kafai@fb.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6_fib.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 332f1e0ff8e2..be9cb09b05f7 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -417,14 +417,13 @@ out: | |||
417 | static struct fib6_node *fib6_add_1(struct fib6_node *root, | 417 | static struct fib6_node *fib6_add_1(struct fib6_node *root, |
418 | struct in6_addr *addr, int plen, | 418 | struct in6_addr *addr, int plen, |
419 | int offset, int allow_create, | 419 | int offset, int allow_create, |
420 | int replace_required) | 420 | int replace_required, int sernum) |
421 | { | 421 | { |
422 | struct fib6_node *fn, *in, *ln; | 422 | struct fib6_node *fn, *in, *ln; |
423 | struct fib6_node *pn = NULL; | 423 | struct fib6_node *pn = NULL; |
424 | struct rt6key *key; | 424 | struct rt6key *key; |
425 | int bit; | 425 | int bit; |
426 | __be32 dir = 0; | 426 | __be32 dir = 0; |
427 | int sernum = fib6_new_sernum(); | ||
428 | 427 | ||
429 | RT6_TRACE("fib6_add_1\n"); | 428 | RT6_TRACE("fib6_add_1\n"); |
430 | 429 | ||
@@ -842,6 +841,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info, | |||
842 | int err = -ENOMEM; | 841 | int err = -ENOMEM; |
843 | int allow_create = 1; | 842 | int allow_create = 1; |
844 | int replace_required = 0; | 843 | int replace_required = 0; |
844 | int sernum = fib6_new_sernum(); | ||
845 | 845 | ||
846 | if (info->nlh) { | 846 | if (info->nlh) { |
847 | if (!(info->nlh->nlmsg_flags & NLM_F_CREATE)) | 847 | if (!(info->nlh->nlmsg_flags & NLM_F_CREATE)) |
@@ -854,7 +854,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info, | |||
854 | 854 | ||
855 | fn = fib6_add_1(root, &rt->rt6i_dst.addr, rt->rt6i_dst.plen, | 855 | fn = fib6_add_1(root, &rt->rt6i_dst.addr, rt->rt6i_dst.plen, |
856 | offsetof(struct rt6_info, rt6i_dst), allow_create, | 856 | offsetof(struct rt6_info, rt6i_dst), allow_create, |
857 | replace_required); | 857 | replace_required, sernum); |
858 | if (IS_ERR(fn)) { | 858 | if (IS_ERR(fn)) { |
859 | err = PTR_ERR(fn); | 859 | err = PTR_ERR(fn); |
860 | fn = NULL; | 860 | fn = NULL; |
@@ -888,14 +888,14 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info, | |||
888 | sfn->leaf = info->nl_net->ipv6.ip6_null_entry; | 888 | sfn->leaf = info->nl_net->ipv6.ip6_null_entry; |
889 | atomic_inc(&info->nl_net->ipv6.ip6_null_entry->rt6i_ref); | 889 | atomic_inc(&info->nl_net->ipv6.ip6_null_entry->rt6i_ref); |
890 | sfn->fn_flags = RTN_ROOT; | 890 | sfn->fn_flags = RTN_ROOT; |
891 | sfn->fn_sernum = fib6_new_sernum(); | 891 | sfn->fn_sernum = sernum; |
892 | 892 | ||
893 | /* Now add the first leaf node to new subtree */ | 893 | /* Now add the first leaf node to new subtree */ |
894 | 894 | ||
895 | sn = fib6_add_1(sfn, &rt->rt6i_src.addr, | 895 | sn = fib6_add_1(sfn, &rt->rt6i_src.addr, |
896 | rt->rt6i_src.plen, | 896 | rt->rt6i_src.plen, |
897 | offsetof(struct rt6_info, rt6i_src), | 897 | offsetof(struct rt6_info, rt6i_src), |
898 | allow_create, replace_required); | 898 | allow_create, replace_required, sernum); |
899 | 899 | ||
900 | if (IS_ERR(sn)) { | 900 | if (IS_ERR(sn)) { |
901 | /* If it is failed, discard just allocated | 901 | /* If it is failed, discard just allocated |
@@ -914,7 +914,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info, | |||
914 | sn = fib6_add_1(fn->subtree, &rt->rt6i_src.addr, | 914 | sn = fib6_add_1(fn->subtree, &rt->rt6i_src.addr, |
915 | rt->rt6i_src.plen, | 915 | rt->rt6i_src.plen, |
916 | offsetof(struct rt6_info, rt6i_src), | 916 | offsetof(struct rt6_info, rt6i_src), |
917 | allow_create, replace_required); | 917 | allow_create, replace_required, sernum); |
918 | 918 | ||
919 | if (IS_ERR(sn)) { | 919 | if (IS_ERR(sn)) { |
920 | err = PTR_ERR(sn); | 920 | err = PTR_ERR(sn); |