]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
cmds.c, cbor_cmds.c (, config.Y): 'show symbols constant', 'show symbols variable...
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Thu, 7 Dec 2023 12:42:23 +0000 (13:42 +0100)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Thu, 7 Dec 2023 12:42:23 +0000 (13:42 +0100)
nest/cbor_cmds.c
nest/cmds.c
nest/config.Y

index 858b77167428df36c6da1e22951cdd03bf671c73..8bd69b283a911e7222970fed30e34c6898ebda89 100644 (file)
@@ -116,8 +116,8 @@ cmd_show_status_cbor(byte *tbuf, uint capacity, struct linpool *lp)
 
 int parse_show_symbols_arg(struct argument *argument)
 {
-  char *params[] = {"table", "filter", "function", "protocol", "template"};
-  int param_vals[] = {SYM_TABLE, SYM_FILTER, SYM_FUNCTION, SYM_PROTO, SYM_TEMPLATE};  // defined in conf.h
+  char *params[] = {"table", "filter", "function", "protocol", "template", "constant", "variable"};
+  int param_vals[] = {SYM_TABLE, SYM_FILTER, SYM_FUNCTION, SYM_PROTO, SYM_TEMPLATE, SYM_CONSTANT, SYM_VARIABLE};  // defined in conf.h
   for (size_t j = 0; j < sizeof(params)/sizeof(char*); j++)
   {
     if (compare_str(argument->arg, argument->len, params[j]))
@@ -167,7 +167,6 @@ cmd_show_symbols_cbor(byte *tbuf, uint capacity, struct arg_list *args, struct l
     cbor_string_string(w, "type", "symbol not known");
     return w->pt;
   }
-
   else
   {
     cbor_add_string(w, "table");
@@ -177,8 +176,12 @@ cmd_show_symbols_cbor(byte *tbuf, uint capacity, struct arg_list *args, struct l
       {
         if (!sym->scope->active)
           continue;
-
-        if (show_type != SYM_VOID && (sym->class != show_type))
+        if (show_type == SYM_VARIABLE || show_type == SYM_CONSTANT)
+        {
+          if (!(show_type  == (int)(sym->class & 0xffffff00)))
+            continue;
+        }
+        else if (show_type != SYM_VOID && (sym->class != show_type))
           continue;
 
         cbor_open_block_with_length(w, 2);
index d49bbc53c32384454d7f38f8537142943adbe365..77fc33b2f3d4d91111d2ffd440fbf61d113b561d 100644 (file)
@@ -47,6 +47,7 @@ cmd_show_status(void)
 void
 cmd_show_symbols(struct sym_show_data *sd)
 {
+  cli_msg(-1010, "%i %x", sd->type, sd->type);
   if (sd->sym)
     cli_msg(1010, "%-8s\t%s", sd->sym->name, cf_symbol_class_name(sd->sym));
   else
@@ -57,10 +58,15 @@ cmd_show_symbols(struct sym_show_data *sd)
        if (!sym->scope->active)
          continue;
 
-       if (sd->type && (sym->class != sd->type))
+       if (sd->type == SYM_VARIABLE || sd->type == SYM_CONSTANT)
+        {
+          if (!(sd->type  == (int)(sym->class & 0xffffff00)))
+            continue;
+        }
+        else if (sd->type && (sym->class != sd->type))
          continue;
 
-       cli_msg(-1010, "%-8s\t%s", sym->name, cf_symbol_class_name(sym));
+       cli_msg(-1010, "%-8s\t%s  %x %i", sym->name, cf_symbol_class_name(sym), sym->class, sym->class);
       }
       HASH_WALK_END;
 
index 6832a57a8b6fd10a0dca6aad6946d67d50acf9a2..3d294eccb473ffe38d8e993be6105651ea0d85fc 100644 (file)
@@ -114,7 +114,7 @@ proto_postconfig(void)
 CF_DECLS
 
 CF_KEYWORDS(ROUTER, ID, HOSTNAME, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
-CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, STATES, ROUTES, FILTERS)
+CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, STATES, ROUTES, FILTERS, CONSTANT, VARIABLE)
 CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, SADR, MPLS)
 CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED, RPKI)
 CF_KEYWORDS(PASSWORD, KEY, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, CHANNELS, INTERFACES)
@@ -836,7 +836,7 @@ channel_arg:
  ;
 
 CF_CLI_HELP(SHOW SYMBOLS, ..., [[Show all known symbolic names]])
-CF_CLI(SHOW SYMBOLS, sym_args, [table|filter|function|protocol|template|<symbol>], [[Show all known symbolic names]])
+CF_CLI(SHOW SYMBOLS, sym_args, [table|filter|function|protocol|template|constant|variable|<symbol>], [[Show all known symbolic names]])
 { cmd_show_symbols($3); } ;
 
 sym_args:
@@ -848,6 +848,8 @@ sym_args:
  | sym_args FILTER { $$ = $1; $$->type = SYM_FILTER; }
  | sym_args PROTOCOL { $$ = $1; $$->type = SYM_PROTO; }
  | sym_args TEMPLATE { $$ = $1; $$->type = SYM_TEMPLATE; }
+ | sym_args CONSTANT { $$ = $1; $$->type = SYM_CONSTANT; }
+ | sym_args VARIABLE { $$ = $1; $$->type = SYM_VARIABLE; }
  | sym_args CF_SYM_KNOWN { $$ = $1; $$->sym = $2; }
  ;