diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2005-06-21 16:51:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-21 16:51:04 -0400 |
commit | 0d51aa80a9b1db43920c0770c3bb842dd823c005 (patch) | |
tree | 999b0c5afbbb1f32af07eb2e1cb9e2692f1aa791 /net/ipv6/ip6_fib.c | |
parent | 19baf839ff4a8daa1f2a7400897094fc18e4f5e9 (diff) |
[IPV6]: V6 route events reported with wrong netlink PID and seq number
Essentially netlink at the moment always reports a pid and sequence of 0
always for v6 route activities.
To understand the repurcassions of this look at:
http://lists.quagga.net/pipermail/quagga-dev/2005-June/003507.html
While fixing this, i took the liberty to resolve the outstanding issue
of IPV6 routes inserted via ioctls to have the correct pids as well.
This patch tries to behave as close as possible to the v4 routes i.e
maintains whatever PID the socket issuing the command owns as opposed to
the process. That made the patch a little bulky.
I have tested against both netlink derived utility to add/del routes as
well as ioctl derived one. The Quagga folks have tested against quagga.
This fixes the problem and so far hasnt been detected to introduce any
new issues.
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r-- | net/ipv6/ip6_fib.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 405740b75abb..1b354aa97934 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -394,7 +394,7 @@ insert_above: | |||
394 | */ | 394 | */ |
395 | 395 | ||
396 | static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | 396 | static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, |
397 | struct nlmsghdr *nlh) | 397 | struct nlmsghdr *nlh, struct netlink_skb_parms *req) |
398 | { | 398 | { |
399 | struct rt6_info *iter = NULL; | 399 | struct rt6_info *iter = NULL; |
400 | struct rt6_info **ins; | 400 | struct rt6_info **ins; |
@@ -449,7 +449,7 @@ out: | |||
449 | *ins = rt; | 449 | *ins = rt; |
450 | rt->rt6i_node = fn; | 450 | rt->rt6i_node = fn; |
451 | atomic_inc(&rt->rt6i_ref); | 451 | atomic_inc(&rt->rt6i_ref); |
452 | inet6_rt_notify(RTM_NEWROUTE, rt, nlh); | 452 | inet6_rt_notify(RTM_NEWROUTE, rt, nlh, req); |
453 | rt6_stats.fib_rt_entries++; | 453 | rt6_stats.fib_rt_entries++; |
454 | 454 | ||
455 | if ((fn->fn_flags & RTN_RTINFO) == 0) { | 455 | if ((fn->fn_flags & RTN_RTINFO) == 0) { |
@@ -479,7 +479,8 @@ void fib6_force_start_gc(void) | |||
479 | * with source addr info in sub-trees | 479 | * with source addr info in sub-trees |
480 | */ | 480 | */ |
481 | 481 | ||
482 | int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 482 | int fib6_add(struct fib6_node *root, struct rt6_info *rt, |
483 | struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) | ||
483 | { | 484 | { |
484 | struct fib6_node *fn; | 485 | struct fib6_node *fn; |
485 | int err = -ENOMEM; | 486 | int err = -ENOMEM; |
@@ -552,7 +553,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, | |||
552 | } | 553 | } |
553 | #endif | 554 | #endif |
554 | 555 | ||
555 | err = fib6_add_rt2node(fn, rt, nlh); | 556 | err = fib6_add_rt2node(fn, rt, nlh, req); |
556 | 557 | ||
557 | if (err == 0) { | 558 | if (err == 0) { |
558 | fib6_start_gc(rt); | 559 | fib6_start_gc(rt); |
@@ -859,7 +860,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) | |||
859 | } | 860 | } |
860 | 861 | ||
861 | static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, | 862 | static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, |
862 | struct nlmsghdr *nlh, void *_rtattr) | 863 | struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
863 | { | 864 | { |
864 | struct fib6_walker_t *w; | 865 | struct fib6_walker_t *w; |
865 | struct rt6_info *rt = *rtp; | 866 | struct rt6_info *rt = *rtp; |
@@ -915,11 +916,11 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, | |||
915 | if (atomic_read(&rt->rt6i_ref) != 1) BUG(); | 916 | if (atomic_read(&rt->rt6i_ref) != 1) BUG(); |
916 | } | 917 | } |
917 | 918 | ||
918 | inet6_rt_notify(RTM_DELROUTE, rt, nlh); | 919 | inet6_rt_notify(RTM_DELROUTE, rt, nlh, req); |
919 | rt6_release(rt); | 920 | rt6_release(rt); |
920 | } | 921 | } |
921 | 922 | ||
922 | int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | 923 | int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct netlink_skb_parms *req) |
923 | { | 924 | { |
924 | struct fib6_node *fn = rt->rt6i_node; | 925 | struct fib6_node *fn = rt->rt6i_node; |
925 | struct rt6_info **rtp; | 926 | struct rt6_info **rtp; |
@@ -944,7 +945,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr) | |||
944 | 945 | ||
945 | for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { | 946 | for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { |
946 | if (*rtp == rt) { | 947 | if (*rtp == rt) { |
947 | fib6_del_route(fn, rtp, nlh, _rtattr); | 948 | fib6_del_route(fn, rtp, nlh, _rtattr, req); |
948 | return 0; | 949 | return 0; |
949 | } | 950 | } |
950 | } | 951 | } |
@@ -1073,7 +1074,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) | |||
1073 | res = c->func(rt, c->arg); | 1074 | res = c->func(rt, c->arg); |
1074 | if (res < 0) { | 1075 | if (res < 0) { |
1075 | w->leaf = rt; | 1076 | w->leaf = rt; |
1076 | res = fib6_del(rt, NULL, NULL); | 1077 | res = fib6_del(rt, NULL, NULL, NULL); |
1077 | if (res) { | 1078 | if (res) { |
1078 | #if RT6_DEBUG >= 2 | 1079 | #if RT6_DEBUG >= 2 |
1079 | printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); | 1080 | printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); |