Register the listen xlat in mainconfig not listen_init
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 2 Sep 2015 13:11:21 +0000 (09:11 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 2 Sep 2015 13:13:11 +0000 (09:13 -0400)
By the time listen_init is called, it's too late (guessing that's why client and getclient were moved there too).

src/include/radiusd.h
src/main/listen.c
src/main/mainconfig.c

index 1123b77..7cae21d 100644 (file)
@@ -555,6 +555,7 @@ void main_config_hup(void);
 void hup_logfile(void);
 
 /* listen.c */
+ssize_t xlat_listen(UNUSED void *instance, REQUEST *request, char const *fmt, char **out, size_t outlen);
 void listen_free(rad_listen_t **head);
 int listen_init(CONF_SECTION *cs, rad_listen_t **head, bool spawn_flag);
 rad_listen_t *proxy_new_listener(TALLOC_CTX *ctx, home_server_t *home, uint16_t src_port);
index 8b33e19..3d17396 100644 (file)
@@ -80,9 +80,8 @@ static fr_protocol_t master_listen[];
 /*
  *     Xlat for %{listen:foo}
  */
-static ssize_t xlat_listen(UNUSED void *instance, REQUEST *request,
-                          char const *fmt, char *out,
-                          size_t outlen)
+ssize_t xlat_listen(UNUSED void *instance, REQUEST *request,
+                   char const *fmt, char *out, size_t outlen)
 {
        char const *value = NULL;
        CONF_PAIR *cp;
@@ -3367,8 +3366,11 @@ add_sockets:
         */
        if (!*head) return -1;
 
+<<<<<<< HEAD
        xlat_register("listen", xlat_listen, NULL, NULL);
 
+=======
+>>>>>>> d376ada... Register the listen xlat in mainconfig not listen_init
        return 0;
 }
 
index e14208d..0f21dbd 100644 (file)
@@ -966,11 +966,12 @@ do {\
        }
 
        /*
-        *  Register the %{config:section.subsection} xlat function.
+        *      Register the %{config:section.subsection} xlat function.
         */
        xlat_register("config", xlat_config, NULL, NULL);
        xlat_register("client", xlat_client, NULL, NULL);
        xlat_register("getclient", xlat_getclient, NULL, NULL);
+       xlat_register("listen", xlat_listen, NULL, NULL);
 
        /*
         *  Go update our behaviour, based on the configuration