Lines Matching refs:rose_route

46 static struct rose_route *rose_route_list;
55 static int __must_check rose_add_node(struct rose_route_struct *rose_route, in rose_add_node() argument
67 if ((rose_node->mask == rose_route->mask) && in rose_add_node()
68 (rosecmpm(&rose_route->address, &rose_node->address, in rose_add_node()
69 rose_route->mask) == 0)) in rose_add_node()
81 if (ax25cmp(&rose_route->neighbour, in rose_add_node()
95 rose_neigh->callsign = rose_route->neighbour; in rose_add_node()
111 if (rose_route->ndigis != 0) { in rose_add_node()
120 rose_neigh->digipeat->ndigi = rose_route->ndigis; in rose_add_node()
123 for (i = 0; i < rose_route->ndigis; i++) { in rose_add_node()
125 rose_route->digipeaters[i]; in rose_add_node()
146 if (rose_tmpn->mask > rose_route->mask) { in rose_add_node()
161 rose_node->address = rose_route->address; in rose_add_node()
162 rose_node->mask = rose_route->mask; in rose_add_node()
265 static void rose_remove_route(struct rose_route *rose_route) in rose_remove_route() argument
267 struct rose_route *s; in rose_remove_route()
269 if (rose_route->neigh1 != NULL) in rose_remove_route()
270 rose_route->neigh1->use--; in rose_remove_route()
272 if (rose_route->neigh2 != NULL) in rose_remove_route()
273 rose_route->neigh2->use--; in rose_remove_route()
275 if ((s = rose_route_list) == rose_route) { in rose_remove_route()
276 rose_route_list = rose_route->next; in rose_remove_route()
277 kfree(rose_route); in rose_remove_route()
282 if (s->next == rose_route) { in rose_remove_route()
283 s->next = rose_route->next; in rose_remove_route()
284 kfree(rose_route); in rose_remove_route()
296 static int rose_del_node(struct rose_route_struct *rose_route, in rose_del_node() argument
308 if ((rose_node->mask == rose_route->mask) && in rose_del_node()
309 (rosecmpm(&rose_route->address, &rose_node->address, in rose_del_node()
310 rose_route->mask) == 0)) in rose_del_node()
322 if (ax25cmp(&rose_route->neighbour, in rose_del_node()
534 struct rose_route *s, *rose_route;
537 rose_route = rose_route_list;
538 while (rose_route != NULL) {
539 s = rose_route;
540 rose_route = rose_route->next;
661 struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neigh) in rose_route_free_lci()
663 struct rose_route *rose_route; in rose_route_free_lci() local
665 for (rose_route = rose_route_list; rose_route != NULL; rose_route = rose_route->next) in rose_route_free_lci()
666 if ((rose_route->neigh1 == neigh && rose_route->lci1 == lci) || in rose_route_free_lci()
667 (rose_route->neigh2 == neigh && rose_route->lci2 == lci)) in rose_route_free_lci()
668 return rose_route; in rose_route_free_lci()
728 struct rose_route_struct rose_route; in rose_rt_ioctl() local
734 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) in rose_rt_ioctl()
736 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) in rose_rt_ioctl()
738 if (rose_dev_exists(&rose_route.address)) /* Can't add routes to ourself */ in rose_rt_ioctl()
740 if (rose_route.mask > 10) /* Mask can't be more than 10 digits */ in rose_rt_ioctl()
742 if (rose_route.ndigis > AX25_MAX_DIGIS) in rose_rt_ioctl()
744 err = rose_add_node(&rose_route, dev); in rose_rt_ioctl()
748 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) in rose_rt_ioctl()
750 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) in rose_rt_ioctl()
752 err = rose_del_node(&rose_route, dev); in rose_rt_ioctl()
767 struct rose_route *rose_route, *s; in rose_del_route_by_neigh() local
778 rose_route = rose_route_list; in rose_del_route_by_neigh()
780 while (rose_route != NULL) { in rose_del_route_by_neigh()
781 if ((rose_route->neigh1 == rose_neigh && rose_route->neigh2 == rose_neigh) || in rose_del_route_by_neigh()
782 (rose_route->neigh1 == rose_neigh && rose_route->neigh2 == NULL) || in rose_del_route_by_neigh()
783 (rose_route->neigh2 == rose_neigh && rose_route->neigh1 == NULL)) { in rose_del_route_by_neigh()
784 s = rose_route->next; in rose_del_route_by_neigh()
785 rose_remove_route(rose_route); in rose_del_route_by_neigh()
786 rose_route = s; in rose_del_route_by_neigh()
790 if (rose_route->neigh1 == rose_neigh) { in rose_del_route_by_neigh()
791 rose_route->neigh1->use--; in rose_del_route_by_neigh()
792 rose_route->neigh1 = NULL; in rose_del_route_by_neigh()
793 rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0); in rose_del_route_by_neigh()
796 if (rose_route->neigh2 == rose_neigh) { in rose_del_route_by_neigh()
797 rose_route->neigh2->use--; in rose_del_route_by_neigh()
798 rose_route->neigh2 = NULL; in rose_del_route_by_neigh()
799 rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0); in rose_del_route_by_neigh()
802 rose_route = rose_route->next; in rose_del_route_by_neigh()
856 struct rose_route *rose_route; in rose_route_frame() local
963 rose_route = rose_route_list; in rose_route_frame()
964 while (rose_route != NULL) { in rose_route_frame()
965 if (rose_route->lci1 == lci && in rose_route_frame()
966 rose_route->neigh1 == rose_neigh) { in rose_route_frame()
969 rose_remove_route(rose_route); in rose_route_frame()
971 } else if (rose_route->neigh2 != NULL) { in rose_route_frame()
973 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F; in rose_route_frame()
974 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF; in rose_route_frame()
975 rose_transmit_link(skb, rose_route->neigh2); in rose_route_frame()
977 rose_remove_route(rose_route); in rose_route_frame()
982 rose_remove_route(rose_route); in rose_route_frame()
986 if (rose_route->lci2 == lci && in rose_route_frame()
987 rose_route->neigh2 == rose_neigh) { in rose_route_frame()
990 rose_remove_route(rose_route); in rose_route_frame()
992 } else if (rose_route->neigh1 != NULL) { in rose_route_frame()
994 skb->data[0] |= (rose_route->lci1 >> 8) & 0x0F; in rose_route_frame()
995 skb->data[1] = (rose_route->lci1 >> 0) & 0xFF; in rose_route_frame()
996 rose_transmit_link(skb, rose_route->neigh1); in rose_route_frame()
998 rose_remove_route(rose_route); in rose_route_frame()
1003 rose_remove_route(rose_route); in rose_route_frame()
1007 rose_route = rose_route->next; in rose_route_frame()
1032 rose_route = rose_route_list; in rose_route_frame()
1033 while (rose_route != NULL) { in rose_route_frame()
1034 if (rose_route->rand == facilities.rand && in rose_route_frame()
1035 rosecmp(src_addr, &rose_route->src_addr) == 0 && in rose_route_frame()
1036 ax25cmp(&facilities.dest_call, &rose_route->src_call) == 0 && in rose_route_frame()
1037 ax25cmp(&facilities.source_call, &rose_route->dest_call) == 0) { in rose_route_frame()
1041 rose_route = rose_route->next; in rose_route_frame()
1054 if ((rose_route = kmalloc(sizeof(*rose_route), GFP_ATOMIC)) == NULL) { in rose_route_frame()
1059 rose_route->lci1 = lci; in rose_route_frame()
1060 rose_route->src_addr = *src_addr; in rose_route_frame()
1061 rose_route->dest_addr = *dest_addr; in rose_route_frame()
1062 rose_route->src_call = facilities.dest_call; in rose_route_frame()
1063 rose_route->dest_call = facilities.source_call; in rose_route_frame()
1064 rose_route->rand = facilities.rand; in rose_route_frame()
1065 rose_route->neigh1 = rose_neigh; in rose_route_frame()
1066 rose_route->lci2 = new_lci; in rose_route_frame()
1067 rose_route->neigh2 = new_neigh; in rose_route_frame()
1069 rose_route->neigh1->use++; in rose_route_frame()
1070 rose_route->neigh2->use++; in rose_route_frame()
1072 rose_route->next = rose_route_list; in rose_route_frame()
1073 rose_route_list = rose_route; in rose_route_frame()
1076 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F; in rose_route_frame()
1077 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF; in rose_route_frame()
1079 rose_transmit_link(skb, rose_route->neigh2); in rose_route_frame()
1258 struct rose_route *rose_route; in rose_route_start() local
1265 for (rose_route = rose_route_list; rose_route && i < *pos; in rose_route_start()
1266 rose_route = rose_route->next, ++i); in rose_route_start()
1268 return (i == *pos) ? rose_route : NULL; in rose_route_start()
1276 : ((struct rose_route *)v)->next; in rose_route_next()
1293 struct rose_route *rose_route = v; in rose_route_show() local
1295 if (rose_route->neigh1) in rose_route_show()
1298 rose_route->lci1, in rose_route_show()
1299 rose2asc(rsbuf, &rose_route->src_addr), in rose_route_show()
1300 ax2asc(buf, &rose_route->src_call), in rose_route_show()
1301 rose_route->neigh1->number); in rose_route_show()
1306 if (rose_route->neigh2) in rose_route_show()
1309 rose_route->lci2, in rose_route_show()
1310 rose2asc(rsbuf, &rose_route->dest_addr), in rose_route_show()
1311 ax2asc(buf, &rose_route->dest_call), in rose_route_show()
1312 rose_route->neigh2->number); in rose_route_show()
1349 struct rose_route *u, *rose_route = rose_route_list; in rose_rt_free() local
1365 while (rose_route != NULL) { in rose_rt_free()
1366 u = rose_route; in rose_rt_free()
1367 rose_route = rose_route->next; in rose_rt_free()