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,
67 if ((rose_node->mask == rose_route->mask) &&
68 (rosecmpm(&rose_route->address, &rose_node->address,
69 rose_route->mask) == 0))
81 if (ax25cmp(&rose_route->neighbour,
95 rose_neigh->callsign = rose_route->neighbour;
111 if (rose_route->ndigis != 0) {
120 rose_neigh->digipeat->ndigi = rose_route->ndigis;
123 for (i = 0; i < rose_route->ndigis; i++) {
125 rose_route->digipeaters[i];
146 if (rose_tmpn->mask > rose_route->mask) {
161 rose_node->address = rose_route->address;
162 rose_node->mask = rose_route->mask;
265 static void rose_remove_route(struct rose_route *rose_route)
267 struct rose_route *s;
269 if (rose_route->neigh1 != NULL)
270 rose_route->neigh1->use--;
272 if (rose_route->neigh2 != NULL)
273 rose_route->neigh2->use--;
275 if ((s = rose_route_list) == rose_route) {
276 rose_route_list = rose_route->next;
277 kfree(rose_route);
282 if (s->next == rose_route) {
283 s->next = rose_route->next;
284 kfree(rose_route);
296 static int rose_del_node(struct rose_route_struct *rose_route,
308 if ((rose_node->mask == rose_route->mask) &&
309 (rosecmpm(&rose_route->address, &rose_node->address,
310 rose_route->mask) == 0))
322 if (ax25cmp(&rose_route->neighbour,
641 struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neigh)
643 struct rose_route *rose_route;
645 for (rose_route = rose_route_list; rose_route != NULL; rose_route = rose_route->next)
646 if ((rose_route->neigh1 == neigh && rose_route->lci1 == lci) ||
647 (rose_route->neigh2 == neigh && rose_route->lci2 == lci))
648 return rose_route;
704 struct rose_route_struct rose_route;
710 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct)))
712 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL)
714 if (rose_dev_exists(&rose_route.address)) /* Can't add routes to ourself */
716 if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
718 if (rose_route.ndigis > AX25_MAX_DIGIS)
720 err = rose_add_node(&rose_route, dev);
724 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct)))
726 if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL)
728 err = rose_del_node(&rose_route, dev);
743 struct rose_route *rose_route, *s;
754 rose_route = rose_route_list;
756 while (rose_route != NULL) {
757 if ((rose_route->neigh1 == rose_neigh && rose_route->neigh2 == rose_neigh) ||
758 (rose_route->neigh1 == rose_neigh && rose_route->neigh2 == NULL) ||
759 (rose_route->neigh2 == rose_neigh && rose_route->neigh1 == NULL)) {
760 s = rose_route->next;
761 rose_remove_route(rose_route);
762 rose_route = s;
766 if (rose_route->neigh1 == rose_neigh) {
767 rose_route->neigh1->use--;
768 rose_route->neigh1 = NULL;
769 rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0);
772 if (rose_route->neigh2 == rose_neigh) {
773 rose_route->neigh2->use--;
774 rose_route->neigh2 = NULL;
775 rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0);
778 rose_route = rose_route->next;
832 struct rose_route *rose_route;
861 printk("rose_route : unknown neighbour or device %s\n",
928 rose_route = rose_route_list;
929 while (rose_route != NULL) {
930 if (rose_route->lci1 == lci &&
931 rose_route->neigh1 == rose_neigh) {
934 rose_remove_route(rose_route);
936 } else if (rose_route->neigh2 != NULL) {
938 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F;
939 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF;
940 rose_transmit_link(skb, rose_route->neigh2);
942 rose_remove_route(rose_route);
947 rose_remove_route(rose_route);
951 if (rose_route->lci2 == lci &&
952 rose_route->neigh2 == rose_neigh) {
955 rose_remove_route(rose_route);
957 } else if (rose_route->neigh1 != NULL) {
959 skb->data[0] |= (rose_route->lci1 >> 8) & 0x0F;
960 skb->data[1] = (rose_route->lci1 >> 0) & 0xFF;
961 rose_transmit_link(skb, rose_route->neigh1);
963 rose_remove_route(rose_route);
968 rose_remove_route(rose_route);
972 rose_route = rose_route->next;
998 rose_route = rose_route_list;
999 while (rose_route != NULL) {
1000 if (rose_route->rand == facilities.rand &&
1001 rosecmp(src_addr, &rose_route->src_addr) == 0 &&
1002 ax25cmp(&facilities.dest_call, &rose_route->src_call) == 0 &&
1003 ax25cmp(&facilities.source_call, &rose_route->dest_call) == 0) {
1007 rose_route = rose_route->next;
1020 if ((rose_route = kmalloc(sizeof(*rose_route), GFP_ATOMIC)) == NULL) {
1025 rose_route->lci1 = lci;
1026 rose_route->src_addr = *src_addr;
1027 rose_route->dest_addr = *dest_addr;
1028 rose_route->src_call = facilities.dest_call;
1029 rose_route->dest_call = facilities.source_call;
1030 rose_route->rand = facilities.rand;
1031 rose_route->neigh1 = rose_neigh;
1032 rose_route->lci2 = new_lci;
1033 rose_route->neigh2 = new_neigh;
1035 rose_route->neigh1->use++;
1036 rose_route->neigh2->use++;
1038 rose_route->next = rose_route_list;
1039 rose_route_list = rose_route;
1042 skb->data[0] |= (rose_route->lci2 >> 8) & 0x0F;
1043 skb->data[1] = (rose_route->lci2 >> 0) & 0xFF;
1045 rose_transmit_link(skb, rose_route->neigh2);
1224 struct rose_route *rose_route;
1231 for (rose_route = rose_route_list; rose_route && i < *pos;
1232 rose_route = rose_route->next, ++i);
1234 return (i == *pos) ? rose_route : NULL;
1242 : ((struct rose_route *)v)->next;
1259 struct rose_route *rose_route = v;
1261 if (rose_route->neigh1)
1264 rose_route->lci1,
1265 rose2asc(rsbuf, &rose_route->src_addr),
1266 ax2asc(buf, &rose_route->src_call),
1267 rose_route->neigh1->number);
1272 if (rose_route->neigh2)
1275 rose_route->lci2,
1276 rose2asc(rsbuf, &rose_route->dest_addr),
1277 ax2asc(buf, &rose_route->dest_call),
1278 rose_route->neigh2->number);
1315 struct rose_route *u, *rose_route = rose_route_list;
1331 while (rose_route != NULL) {
1332 u = rose_route;
1333 rose_route = rose_route->next;