commit 8fe58867e3444bfb3aa8fafb3a0b5669cd8c49f9
Author: Alexander Zubkov <green@qrator.net>
Date:   Wed Jan 25 19:28:50 2023 +0100

    Configure: introduce alias symbols
    
    Allow to create symbols that act as aliases to other symbols.
    Alias symbol allows to reference the same object and to find it
    also by another name. Such symbols can be used for seamless renaming
    of protocols without interruption by loading a series of configs:
    1) original config with original name "A" only
    2) config with original name "A" and new name "B" as alias
    3) config with new name "B" and original name "A" as alias
    4) final config with new name "B" only
    
    New syntax was added to the config to add aliases:
    link <alias> to <symbol>;

diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index ceedee8a..ec5eceec 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -667,6 +667,25 @@ cf_localize_symbol(struct symbol *sym)
   return cf_new_symbol(sym->name);
 }
 
+/**
+ * cf_alias_symbol - make an "alias" symbol
+ * @sym: the reference symbol
+ * @alias: the symbol to be linked to the reference
+ *
+ * This function defines the meaning of the symbol from the reference symbol.
+ * The protocol/table/... keeps its original name, but can be also accessed
+ * accessed with the new alias symbol
+ */
+void
+cf_alias_symbol(struct symbol *sym, struct symbol *alias)
+{
+  struct symbol tmp = *sym;
+  tmp.n = alias->n;
+  tmp.next = alias->next;
+  //tmp.scope = alias->scope;
+  *alias = tmp;
+}
+
 struct symbol *
 cf_default_name(char *template, int *counter)
 {
diff --git a/conf/conf.h b/conf/conf.h
index b409750e..d7796c5c 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -192,6 +192,7 @@ struct symbol *cf_find_symbol(const struct config *cfg, const byte *c);
 struct symbol *cf_get_symbol(const byte *c);
 struct symbol *cf_default_name(char *template, int *counter);
 struct symbol *cf_localize_symbol(struct symbol *sym);
+void cf_alias_symbol(struct symbol *sym, struct symbol *alias);
 
 static inline int cf_symbol_is_local(struct symbol *sym)
 { return (sym->scope == conf_this_scope) && !conf_this_scope->soft_scopes; }
diff --git a/nest/config.Y b/nest/config.Y
index b2aa0906..10cb15cb 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -154,6 +154,15 @@ CF_ENUM_PX(T_ENUM_AF, AF_, AFI_, IPV4, IPV6)
 
 CF_GRAMMAR
 
+/* Makeing alias of a symbol */
+
+conf: link_to ;
+
+link_to: LINK CF_SYM_UNDEFINED TO CF_SYM_KNOWN ';'
+{
+  cf_alias_symbol($4, $2);
+}
+
 /* Setting of router ID */
 
 conf: rtrid ;
