diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/command.h | 1 | ||||
| -rw-r--r-- | lib/command_lex.l | 6 | ||||
| -rw-r--r-- | lib/command_match.c | 1 | ||||
| -rw-r--r-- | lib/libfrr.c | 1 | ||||
| -rw-r--r-- | lib/pid_output.c | 3 | ||||
| -rw-r--r-- | lib/plist.c | 21 | ||||
| -rw-r--r-- | lib/plist.h | 16 | ||||
| -rw-r--r-- | lib/thread.c | 2 |
8 files changed, 43 insertions, 8 deletions
diff --git a/lib/command.h b/lib/command.h index 1c6938523c..8cccb62de3 100644 --- a/lib/command.h +++ b/lib/command.h @@ -357,6 +357,7 @@ struct cmd_node { #define OSPF_RI_STR "OSPF Router Information specific commands\n" #define PCE_STR "PCE Router Information specific commands\n" #define MPLS_STR "MPLS information\n" +#define WATCHFRR_STR "watchfrr information\n" #define CONF_BACKUP_EXT ".sav" diff --git a/lib/command_lex.l b/lib/command_lex.l index 59d0d840a8..436f3a241d 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -35,14 +35,14 @@ } } while(0) %} -WORD (\-|\+)?[a-z0-9\*][-+_a-zA-Z0-9\*]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M MAC M:A:C MAC_PREFIX M:A:C\/M -VARIABLE [A-Z][-_a-zA-Z:0-9]+ +VARIABLE [A-Z][-_A-Z:0-9]+ +WORD (\-|\+)?[a-zA-Z0-9\*][-+_a-zA-Z0-9\*]* NUMBER (\-|\+)?[0-9]{1,20} RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) @@ -64,7 +64,6 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) %} [ \t]+ LOC_STEP /* ignore whitespace */; -{WORD} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return WORD;} {IPV4} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return IPV4;} {IPV4_PREFIX} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return IPV4_PREFIX;} {IPV6} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return IPV6;} @@ -72,6 +71,7 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) {MAC} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return MAC;} {MAC_PREFIX} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return MAC_PREFIX;} {VARIABLE} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return VARIABLE;} +{WORD} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return WORD;} {RANGE} {yylval->string = XSTRDUP(MTYPE_LEX, yytext); return RANGE;} . {return yytext[0];} %% diff --git a/lib/command_match.c b/lib/command_match.c index 62e7c63068..6384abe5ce 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -214,6 +214,7 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline, fprintf(stdout, "\"%-20s\" matches \"%-30s\" ? ", input_token, token->text); enum match_type mt = match_token(token, input_token); + fprintf(stdout, "type: %d ", token->type); fprintf(stdout, "min: %d - ", minmatch); switch (mt) { case trivial_match: diff --git a/lib/libfrr.c b/lib/libfrr.c index 3e2e008223..d5078f98aa 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -886,6 +886,7 @@ void frr_fini(void) zprivs_terminate(di->privs); /* signal_init -> nothing needed */ thread_master_free(master); + master = NULL; closezlog(); /* frrmod_init -> nothing needed / hooks */ diff --git a/lib/pid_output.c b/lib/pid_output.c index e2e4434150..9a7307bc4f 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -57,7 +57,8 @@ pid_t pid_output(const char *path) lock.l_whence = SEEK_SET; if (fcntl(fd, F_SETLK, &lock) < 0) { - zlog_err("Could not lock pid_file %s, exiting", path); + zlog_err("Could not lock pid_file %s (%s), exiting", + path, safe_strerror(errno)); exit(1); } diff --git a/lib/plist.c b/lib/plist.c index ebd628d724..da6406d334 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -679,7 +679,9 @@ static int prefix_list_entry_match(struct prefix_list_entry *pentry, return 1; } -enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object) +enum prefix_list_type prefix_list_apply_which_prefix(struct prefix_list *plist, + struct prefix **which, + void *object) { struct prefix_list_entry *pentry, *pbest = NULL; @@ -689,11 +691,17 @@ enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object) size_t validbits = p->prefixlen; struct pltrie_table *table; - if (plist == NULL) + if (plist == NULL) { + if (which) + *which = NULL; return PREFIX_DENY; + } - if (plist->count == 0) + if (plist->count == 0) { + if (which) + *which = NULL; return PREFIX_PERMIT; + } depth = plist->master->trie_depth; table = plist->trie; @@ -729,6 +737,13 @@ enum prefix_list_type prefix_list_apply(struct prefix_list *plist, void *object) break; } + if (which) { + if (pbest) + *which = &pbest->prefix; + else + *which = NULL; + } + if (pbest == NULL) return PREFIX_DENY; diff --git a/lib/plist.h b/lib/plist.h index 3eba3046ae..bf06e74d36 100644 --- a/lib/plist.h +++ b/lib/plist.h @@ -50,7 +50,21 @@ extern void prefix_list_delete_hook(void (*func)(struct prefix_list *)); extern const char *prefix_list_name(struct prefix_list *); extern afi_t prefix_list_afi(struct prefix_list *); extern struct prefix_list *prefix_list_lookup(afi_t, const char *); -extern enum prefix_list_type prefix_list_apply(struct prefix_list *, void *); + +/* + * prefix_list_apply_which_prefix + * + * Allow calling function to learn which prefix + * caused the DENY or PERMIT. + * + * If no pointer is sent in, do not return anything. + * If it is a empty plist return a NULL pointer. + */ +extern enum prefix_list_type prefix_list_apply_which_prefix( + struct prefix_list *plist, + struct prefix **which, + void *object); +#define prefix_list_apply(A, B) prefix_list_apply_which_prefix((A), NULL, (B)) extern struct prefix_list *prefix_bgp_orf_lookup(afi_t, const char *); extern struct stream *prefix_bgp_orf_entry(struct stream *, diff --git a/lib/thread.c b/lib/thread.c index d8be32e2bd..a69bd2f0d5 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -567,9 +567,11 @@ void thread_master_free(struct thread_master *m) thread_list_free(m, &m->ready); thread_list_free(m, &m->unuse); pthread_mutex_destroy(&m->mtx); + pthread_cond_destroy(&m->cancel_cond); close(m->io_pipe[0]); close(m->io_pipe[1]); list_delete(m->cancel_req); + m->cancel_req = NULL; hash_clean(m->cpu_record, cpu_record_hash_free); hash_free(m->cpu_record); |
