aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_fib.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet/dn_fib.c')
-rw-r--r--net/decnet/dn_fib.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 1c74ed36ce8..9e885f180b6 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -30,7 +30,7 @@
30#include <linux/netdevice.h> 30#include <linux/netdevice.h>
31#include <linux/timer.h> 31#include <linux/timer.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <asm/atomic.h> 33#include <linux/atomic.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <net/neighbour.h> 35#include <net/neighbour.h>
36#include <net/dst.h> 36#include <net/dst.h>
@@ -414,33 +414,34 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowidn
414 414
415 res->fi = fi; 415 res->fi = fi;
416 416
417 switch(type) { 417 switch (type) {
418 case RTN_NAT: 418 case RTN_NAT:
419 DN_FIB_RES_RESET(*res); 419 DN_FIB_RES_RESET(*res);
420 atomic_inc(&fi->fib_clntref);
421 return 0;
422 case RTN_UNICAST:
423 case RTN_LOCAL:
424 for_nexthops(fi) {
425 if (nh->nh_flags & RTNH_F_DEAD)
426 continue;
427 if (!fld->flowidn_oif ||
428 fld->flowidn_oif == nh->nh_oif)
429 break;
430 }
431 if (nhsel < fi->fib_nhs) {
432 res->nh_sel = nhsel;
420 atomic_inc(&fi->fib_clntref); 433 atomic_inc(&fi->fib_clntref);
421 return 0; 434 return 0;
422 case RTN_UNICAST: 435 }
423 case RTN_LOCAL: 436 endfor_nexthops(fi);
424 for_nexthops(fi) { 437 res->fi = NULL;
425 if (nh->nh_flags & RTNH_F_DEAD) 438 return 1;
426 continue; 439 default:
427 if (!fld->flowidn_oif || 440 if (net_ratelimit())
428 fld->flowidn_oif == nh->nh_oif) 441 printk("DECnet: impossible routing event : dn_fib_semantic_match type=%d\n",
429 break; 442 type);
430 } 443 res->fi = NULL;
431 if (nhsel < fi->fib_nhs) { 444 return -EINVAL;
432 res->nh_sel = nhsel;
433 atomic_inc(&fi->fib_clntref);
434 return 0;
435 }
436 endfor_nexthops(fi);
437 res->fi = NULL;
438 return 1;
439 default:
440 if (net_ratelimit())
441 printk("DECnet: impossible routing event : dn_fib_semantic_match type=%d\n", type);
442 res->fi = NULL;
443 return -EINVAL;
444 } 445 }
445 } 446 }
446 return err; 447 return err;
@@ -647,20 +648,20 @@ static int dn_fib_dnaddr_event(struct notifier_block *this, unsigned long event,
647{ 648{
648 struct dn_ifaddr *ifa = (struct dn_ifaddr *)ptr; 649 struct dn_ifaddr *ifa = (struct dn_ifaddr *)ptr;
649 650
650 switch(event) { 651 switch (event) {
651 case NETDEV_UP: 652 case NETDEV_UP:
652 dn_fib_add_ifaddr(ifa); 653 dn_fib_add_ifaddr(ifa);
653 dn_fib_sync_up(ifa->ifa_dev->dev); 654 dn_fib_sync_up(ifa->ifa_dev->dev);
655 dn_rt_cache_flush(-1);
656 break;
657 case NETDEV_DOWN:
658 dn_fib_del_ifaddr(ifa);
659 if (ifa->ifa_dev && ifa->ifa_dev->ifa_list == NULL) {
660 dn_fib_disable_addr(ifa->ifa_dev->dev, 1);
661 } else {
654 dn_rt_cache_flush(-1); 662 dn_rt_cache_flush(-1);
655 break; 663 }
656 case NETDEV_DOWN: 664 break;
657 dn_fib_del_ifaddr(ifa);
658 if (ifa->ifa_dev && ifa->ifa_dev->ifa_list == NULL) {
659 dn_fib_disable_addr(ifa->ifa_dev->dev, 1);
660 } else {
661 dn_rt_cache_flush(-1);
662 }
663 break;
664 } 665 }
665 return NOTIFY_DONE; 666 return NOTIFY_DONE;
666} 667}
@@ -763,8 +764,8 @@ void __init dn_fib_init(void)
763 764
764 register_dnaddr_notifier(&dn_fib_dnaddr_notifier); 765 register_dnaddr_notifier(&dn_fib_dnaddr_notifier);
765 766
766 rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL); 767 rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL, NULL);
767 rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL); 768 rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL, NULL);
768} 769}
769 770
770 771