* Tries to add new non-transient algorithm error to the list of * errors. * Returns true on success. */
| 269 | * Returns true on success. |
| 270 | */ |
| 271 | static bool |
| 272 | flm_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. |
no test coverage detected