diff options
Diffstat (limited to 'net/rose/rose_route.c')
-rw-r--r-- | net/rose/rose_route.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index bd593871c81e..a81066a1010a 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
@@ -662,27 +662,34 @@ struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neig | |||
662 | } | 662 | } |
663 | 663 | ||
664 | /* | 664 | /* |
665 | * Find a neighbour given a ROSE address. | 665 | * Find a neighbour or a route given a ROSE address. |
666 | */ | 666 | */ |
667 | struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, | 667 | struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, |
668 | unsigned char *diagnostic) | 668 | unsigned char *diagnostic, int new) |
669 | { | 669 | { |
670 | struct rose_neigh *res = NULL; | 670 | struct rose_neigh *res = NULL; |
671 | struct rose_node *node; | 671 | struct rose_node *node; |
672 | int failed = 0; | 672 | int failed = 0; |
673 | int i; | 673 | int i; |
674 | 674 | ||
675 | spin_lock_bh(&rose_node_list_lock); | 675 | if (!new) spin_lock_bh(&rose_node_list_lock); |
676 | for (node = rose_node_list; node != NULL; node = node->next) { | 676 | for (node = rose_node_list; node != NULL; node = node->next) { |
677 | if (rosecmpm(addr, &node->address, node->mask) == 0) { | 677 | if (rosecmpm(addr, &node->address, node->mask) == 0) { |
678 | for (i = 0; i < node->count; i++) { | 678 | for (i = 0; i < node->count; i++) { |
679 | if (!rose_ftimer_running(node->neighbour[i])) { | 679 | if (new) { |
680 | res = node->neighbour[i]; | 680 | if (node->neighbour[i]->restarted) { |
681 | goto out; | 681 | res = node->neighbour[i]; |
682 | } else | 682 | goto out; |
683 | failed = 1; | 683 | } |
684 | } | ||
685 | else { | ||
686 | if (!rose_ftimer_running(node->neighbour[i])) { | ||
687 | res = node->neighbour[i]; | ||
688 | goto out; | ||
689 | } else | ||
690 | failed = 1; | ||
691 | } | ||
684 | } | 692 | } |
685 | break; | ||
686 | } | 693 | } |
687 | } | 694 | } |
688 | 695 | ||
@@ -695,7 +702,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, | |||
695 | } | 702 | } |
696 | 703 | ||
697 | out: | 704 | out: |
698 | spin_unlock_bh(&rose_node_list_lock); | 705 | if (!new) spin_unlock_bh(&rose_node_list_lock); |
699 | 706 | ||
700 | return res; | 707 | return res; |
701 | } | 708 | } |
@@ -1018,7 +1025,7 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) | |||
1018 | rose_route = rose_route->next; | 1025 | rose_route = rose_route->next; |
1019 | } | 1026 | } |
1020 | 1027 | ||
1021 | if ((new_neigh = rose_get_neigh(dest_addr, &cause, &diagnostic)) == NULL) { | 1028 | if ((new_neigh = rose_get_neigh(dest_addr, &cause, &diagnostic, 1)) == NULL) { |
1022 | rose_transmit_clear_request(rose_neigh, lci, cause, diagnostic); | 1029 | rose_transmit_clear_request(rose_neigh, lci, cause, diagnostic); |
1023 | goto out; | 1030 | goto out; |
1024 | } | 1031 | } |