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

Function neigh_ip4_add

dpdk/app/graph/neigh.c:139–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139static int
140neigh_ip4_add(uint32_t ip, uint64_t mac)
141{
142 struct neigh_ipv4_config *v4_config;
143 int rc = -EINVAL;
144
145 v4_config = find_neigh4_entry(ip, mac);
146
147 if (!v4_config) {
148 v4_config = malloc(sizeof(struct neigh_ipv4_config));
149 if (!v4_config)
150 return -ENOMEM;
151 }
152
153 v4_config->ip = ip;
154 v4_config->mac = mac;
155 v4_config->is_used = true;
156
157 if (!graph_status_get())
158 goto exit;
159
160 rc = ip4_rewrite_node_add(v4_config);
161 if (rc)
162 goto free;
163
164exit:
165 TAILQ_INSERT_TAIL(&neigh4, v4_config, next);
166 return 0;
167free:
168 free(v4_config);
169 return rc;
170}
171
172static int
173neigh_ip6_add(uint8_t *ip, uint64_t mac)

Callers 1

cli_neigh_v4Function · 0.85

Calls 5

find_neigh4_entryFunction · 0.85
mallocFunction · 0.85
graph_status_getFunction · 0.85
ip4_rewrite_node_addFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected