]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
respect Proxy-To-Originating-Realm in request_coa_originate()
authorAlan T. DeKok <aland@freeradius.org>
Thu, 1 Apr 2021 18:37:29 +0000 (14:37 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 2 Apr 2021 19:14:44 +0000 (15:14 -0400)
this isn't entirely the correct name for how we use the attribute,
but it's at least consistent with the rest of the server.

src/main/process.c

index a35f989685b2fe92b9805cc5fc3d45ae87b205dd..8f4588b0c7b23fa93a3694c233358215e94c129e 100644 (file)
@@ -4341,6 +4341,26 @@ static void request_coa_originate(REQUEST *request)
        coa = request->coa;
        coa->listener = NULL;   /* copied here by request_alloc_fake(), but not needed */
 
+#ifdef WITH_COA_TUNNEL
+       /*
+        *      Proxy-To-Originating-Realm is preferred to any other
+        *      method of originating CoA requests.
+        */
+       vp = fr_pair_find_by_num(coa->config, PW_PROXY_TO_ORIGINATING_REALM, 0, TAG_ANY);
+       if (vp) {
+               /*
+                *      This function will set request->home_server,
+                *      and also request->proxy_listener.
+                */
+               if (listen_coa_find(coa, vp->vp_strvalue) < 0) {
+                       RWDEBUG("Unknown Originating realm '%s'", vp->vp_strvalue);
+                       return;
+               }
+
+               goto set_packet_type;
+       }
+#endif
+
        /*
         *      src_ipaddr will be set up in proxy_encode.
         */
@@ -4406,6 +4426,9 @@ static void request_coa_originate(REQUEST *request)
                }
        }
 
+#ifdef WITH_COA_TUNNEL
+set_packet_type:
+#endif
        vp = fr_pair_find_by_num(coa->proxy->vps, PW_PACKET_TYPE, 0, TAG_ANY);
        if (vp) {
                switch (vp->vp_integer) {