MCPcopy Create free account
hub / github.com/F-Stack/f-stack / route_ip4_add

Function route_ip4_add

dpdk/app/graph/ip4_route.c:79–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static int
80route_ip4_add(struct route_ipv4_config *route)
81{
82 struct route_ipv4_config *ipv4route;
83 int rc = -EINVAL;
84
85 ipv4route = find_route4_entry(route);
86
87 if (!ipv4route) {
88 ipv4route = malloc(sizeof(struct route_ipv4_config));
89 if (!ipv4route)
90 return -ENOMEM;
91 } else {
92 return 0;
93 }
94
95 ipv4route->ip = route->ip;
96 ipv4route->netmask = route->netmask;
97 ipv4route->via = route->via;
98 ipv4route->is_used = true;
99
100 if (!graph_status_get())
101 goto exit;
102
103 rc = route4_rewirte_table_update(ipv4route);
104 if (rc)
105 goto free;
106
107exit:
108 TAILQ_INSERT_TAIL(&route4, ipv4route, next);
109 return 0;
110free:
111 free(ipv4route);
112 return rc;
113}
114
115int
116route_ip4_add_to_lookup(void)

Callers 1

cli_ipv4_lookupFunction · 0.85

Calls 5

find_route4_entryFunction · 0.85
mallocFunction · 0.85
graph_status_getFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected