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

Function flm_error_add

freebsd/net/route/fib_algo.c:271–294  ·  view source on GitHub ↗

* Tries to add new non-transient algorithm error to the list of * errors. * Returns true on success. */

Source from the content-addressed store, hash-verified

269 * Returns true on success.
270 */
271static bool
272flm_error_add(struct fib_lookup_module *flm, uint32_t fibnum)
273{
274 struct fib_error *fe;
275
276 fe = malloc(sizeof(struct fib_error), M_TEMP, M_NOWAIT | M_ZERO);
277 if (fe == NULL)
278 return (false);
279 fe->fe_flm = flm;
280 fe->fe_family = flm->flm_family;
281 fe->fe_fibnum = fibnum;
282
283 FIB_MOD_LOCK();
284 /* Avoid duplicates by checking if error already exists first */
285 if (flm_error_check(flm, fibnum)) {
286 FIB_MOD_UNLOCK();
287 free(fe, M_TEMP);
288 return (true);
289 }
290 TAILQ_INSERT_HEAD(&V_fib_error_list, fe, entries);
291 FIB_MOD_UNLOCK();
292
293 return (true);
294}
295
296/*
297 * True if non-transient error has been registered for @flm in @fibnum.

Callers 2

handle_rtable_change_cbFunction · 0.85
setup_fd_instanceFunction · 0.85

Calls 3

mallocFunction · 0.85
flm_error_checkFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected