| 80 | } |
| 81 | |
| 82 | static int |
| 83 | route_ip6_add(struct route_ipv6_config *route) |
| 84 | { |
| 85 | struct route_ipv6_config *ipv6route; |
| 86 | int rc = -EINVAL; |
| 87 | int j; |
| 88 | |
| 89 | ipv6route = find_route6_entry(route); |
| 90 | if (!ipv6route) { |
| 91 | ipv6route = malloc(sizeof(struct route_ipv6_config)); |
| 92 | if (!ipv6route) |
| 93 | return -ENOMEM; |
| 94 | } else { |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | for (j = 0; j < ETHDEV_IPV6_ADDR_LEN; j++) { |
| 99 | ipv6route->ip[j] = route->ip[j]; |
| 100 | ipv6route->mask[j] = route->mask[j]; |
| 101 | ipv6route->gateway[j] = route->gateway[j]; |
| 102 | } |
| 103 | ipv6route->is_used = true; |
| 104 | |
| 105 | if (!graph_status_get()) |
| 106 | goto exit; |
| 107 | |
| 108 | rc = route6_rewirte_table_update(ipv6route); |
| 109 | if (rc) |
| 110 | goto free; |
| 111 | |
| 112 | exit: |
| 113 | TAILQ_INSERT_TAIL(&route6, ipv6route, next); |
| 114 | return 0; |
| 115 | free: |
| 116 | free(ipv6route); |
| 117 | return rc; |
| 118 | } |
| 119 | |
| 120 | int |
| 121 | route_ip6_add_to_lookup(void) |
no test coverage detected