Lines Matching refs:rose_route
42 static struct rose_route *rose_route_list;
51 static int __must_check rose_add_node(struct rose_route_struct *rose_route, in rose_add_node() argument
63 if ((rose_node->mask == rose_route->mask) && in rose_add_node()
64 (rosecmpm(&rose_route->address, &rose_node->address, in rose_add_node()
65 rose_route->mask) == 0)) in rose_add_node()
77 if (ax25cmp(&rose_route->neighbour, in rose_add_node()
91 rose_neigh->callsign = rose_route->neighbour; in rose_add_node()
107 if (rose_route->ndigis != 0) { in rose_add_node()
116 rose_neigh->digipeat->ndigi = rose_route->ndigis; in rose_add_node()
119 for (i = 0; i < rose_route->ndigis; i++) { in rose_add_node()
121 rose_route->digipeaters[i]; in rose_add_node()
142 if (rose_tmpn->mask > rose_route->mask) { in rose_add_node()
157 rose_node->address = rose_route->address; in rose_add_node()
158 rose_node->mask = rose_route->mask; in rose_add_node()
261 static void rose_remove_route(struct rose_route *rose_route) in rose_remove_route() argument
263 struct rose_route *s; in rose_remove_route()
265 if (rose_route->neigh1 != NULL) in rose_remove_route()
266 rose_route->neigh1->use--; in rose_remove_route()
268 if (rose_route->neigh2 != NULL) in rose_remove_route()
269 rose_route->neigh2->use--; in rose_remove_route()
271 if ((s = rose_route_list) == rose_route) { in rose_remove_route()
272 rose_route_list = rose_route->next; in rose_remove_route()
273 kfree(rose_route); in rose_remove_route()
278 if (s->next == rose_route) { in rose_remove_route()
279 s->next = rose_route->next; in rose_remove_route()
280 kfree(rose_route); in rose_remove_route()
292 static int rose_del_node(struct rose_route_struct *rose_route, in rose_del_node() argument
304 if ((rose_node->mask == rose_route->mask) && in rose_del_node()
305 (rosecmpm(&rose_route->address, &rose_node->address, in rose_del_node()
306 rose_route->mask) == 0)) in rose_del_node()
318 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;
665 struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neigh) in rose_route_free_lci()
667 struct rose_route *rose_route; in rose_route_free_lci() local
669 for (rose_route = rose_route_list; rose_route != NULL; rose_route = rose_route->next) in rose_route_free_lci()
670 if ((rose_route->neigh1 == neigh && rose_route->lci1 == lci) || in rose_route_free_lci()
671 (rose_route->neigh2 == neigh && rose_route->lci2 == lci)) in rose_route_free_lci()
672 return rose_route; in rose_route_free_lci()
731 struct rose_route_struct rose_route; in rose_rt_ioctl() local
737 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) in rose_rt_ioctl()
739 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) in rose_rt_ioctl()
741 if (rose_dev_exists(&rose_route.address)) /* Can't add routes to ourself */ in rose_rt_ioctl()
743 if (rose_route.mask > 10) /* Mask can't be more than 10 digits */ in rose_rt_ioctl()
745 if (rose_route.ndigis > AX25_MAX_DIGIS) in rose_rt_ioctl()
747 err = rose_add_node(&rose_route, dev); in rose_rt_ioctl()
751 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) in rose_rt_ioctl()
753 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) in rose_rt_ioctl()
755 err = rose_del_node(&rose_route, dev); in rose_rt_ioctl()
770 struct rose_route *rose_route, *s; in rose_del_route_by_neigh() local
781 rose_route = rose_route_list; in rose_del_route_by_neigh()
783 while (rose_route != NULL) { in rose_del_route_by_neigh()
784 if ((rose_route->neigh1 == rose_neigh && rose_route->neigh2 == rose_neigh) || in rose_del_route_by_neigh()
785 (rose_route->neigh1 == rose_neigh && rose_route->neigh2 == NULL) || in rose_del_route_by_neigh()
786 (rose_route->neigh2 == rose_neigh && rose_route->neigh1 == NULL)) { in rose_del_route_by_neigh()
787 s = rose_route->next; in rose_del_route_by_neigh()
788 rose_remove_route(rose_route); in rose_del_route_by_neigh()
789 rose_route = s; in rose_del_route_by_neigh()
793 if (rose_route->neigh1 == rose_neigh) { in rose_del_route_by_neigh()
794 rose_route->neigh1->use--; in rose_del_route_by_neigh()
795 rose_route->neigh1 = NULL; in rose_del_route_by_neigh()
796 rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0); in rose_del_route_by_neigh()
799 if (rose_route->neigh2 == rose_neigh) { in rose_del_route_by_neigh()
800 rose_route->neigh2->use--; in rose_del_route_by_neigh()
801 rose_route->neigh2 = NULL; in rose_del_route_by_neigh()
802 rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0); in rose_del_route_by_neigh()
805 rose_route = rose_route->next; in rose_del_route_by_neigh()
860 struct rose_route *rose_route; in rose_route_frame() local
966 rose_route = rose_route_list; in rose_route_frame()
967 while (rose_route != NULL) { in rose_route_frame()
968 if (rose_route->lci1 == lci && in rose_route_frame()
969 rose_route->neigh1 == rose_neigh) { in rose_route_frame()
972 rose_remove_route(rose_route); in rose_route_frame()
974 } else if (rose_route->neigh2 != NULL) { in rose_route_frame()
976 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F; in rose_route_frame()
977 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF; in rose_route_frame()
978 rose_transmit_link(skb, rose_route->neigh2); in rose_route_frame()
980 rose_remove_route(rose_route); in rose_route_frame()
985 rose_remove_route(rose_route); in rose_route_frame()
989 if (rose_route->lci2 == lci && in rose_route_frame()
990 rose_route->neigh2 == rose_neigh) { in rose_route_frame()
993 rose_remove_route(rose_route); in rose_route_frame()
995 } else if (rose_route->neigh1 != NULL) { in rose_route_frame()
997 skb->data[0] |= (rose_route->lci1 >> 8) & 0x0F; in rose_route_frame()
998 skb->data[1] = (rose_route->lci1 >> 0) & 0xFF; in rose_route_frame()
999 rose_transmit_link(skb, rose_route->neigh1); in rose_route_frame()
1001 rose_remove_route(rose_route); in rose_route_frame()
1006 rose_remove_route(rose_route); in rose_route_frame()
1010 rose_route = rose_route->next; in rose_route_frame()
1035 rose_route = rose_route_list; in rose_route_frame()
1036 while (rose_route != NULL) { in rose_route_frame()
1037 if (rose_route->rand == facilities.rand && in rose_route_frame()
1038 rosecmp(src_addr, &rose_route->src_addr) == 0 && in rose_route_frame()
1039 ax25cmp(&facilities.dest_call, &rose_route->src_call) == 0 && in rose_route_frame()
1040 ax25cmp(&facilities.source_call, &rose_route->dest_call) == 0) { in rose_route_frame()
1044 rose_route = rose_route->next; in rose_route_frame()
1057 if ((rose_route = kmalloc(sizeof(*rose_route), GFP_ATOMIC)) == NULL) { in rose_route_frame()
1062 rose_route->lci1 = lci; in rose_route_frame()
1063 rose_route->src_addr = *src_addr; in rose_route_frame()
1064 rose_route->dest_addr = *dest_addr; in rose_route_frame()
1065 rose_route->src_call = facilities.dest_call; in rose_route_frame()
1066 rose_route->dest_call = facilities.source_call; in rose_route_frame()
1067 rose_route->rand = facilities.rand; in rose_route_frame()
1068 rose_route->neigh1 = rose_neigh; in rose_route_frame()
1069 rose_route->lci2 = new_lci; in rose_route_frame()
1070 rose_route->neigh2 = new_neigh; in rose_route_frame()
1072 rose_route->neigh1->use++; in rose_route_frame()
1073 rose_route->neigh2->use++; in rose_route_frame()
1075 rose_route->next = rose_route_list; in rose_route_frame()
1076 rose_route_list = rose_route; in rose_route_frame()
1079 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F; in rose_route_frame()
1080 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF; in rose_route_frame()
1082 rose_transmit_link(skb, rose_route->neigh2); in rose_route_frame()
1227 struct rose_route *rose_route; in rose_route_start() local
1234 for (rose_route = rose_route_list; rose_route && i < *pos; in rose_route_start()
1235 rose_route = rose_route->next, ++i); in rose_route_start()
1237 return (i == *pos) ? rose_route : NULL; in rose_route_start()
1245 : ((struct rose_route *)v)->next; in rose_route_next()
1262 struct rose_route *rose_route = v; in rose_route_show() local
1264 if (rose_route->neigh1) in rose_route_show()
1267 rose_route->lci1, in rose_route_show()
1268 rose2asc(rsbuf, &rose_route->src_addr), in rose_route_show()
1269 ax2asc(buf, &rose_route->src_call), in rose_route_show()
1270 rose_route->neigh1->number); in rose_route_show()
1275 if (rose_route->neigh2) in rose_route_show()
1278 rose_route->lci2, in rose_route_show()
1279 rose2asc(rsbuf, &rose_route->dest_addr), in rose_route_show()
1280 ax2asc(buf, &rose_route->dest_call), in rose_route_show()
1281 rose_route->neigh2->number); in rose_route_show()
1304 struct rose_route *u, *rose_route = rose_route_list; in rose_rt_free() local
1320 while (rose_route != NULL) { in rose_rt_free()
1321 u = rose_route; in rose_rt_free()
1322 rose_route = rose_route->next; in rose_rt_free()