Move dhcp_options: xlat to rlm_dhcp module
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 1 Nov 2012 14:18:01 +0000 (14:18 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 1 Nov 2012 14:18:01 +0000 (14:18 +0000)
raddb/Makefile
raddb/radiusd.conf.in
src/main/xlat.c
src/modules/stable

index 23ecf37..164c0b7 100644 (file)
@@ -18,7 +18,7 @@ FILES = acct_users attrs attrs.access_reject attrs.accounting_response        \
 DEFAULT_SITES = default inner-tunnel
 
 DEFAULT_MODULES = acct_unique always attr_filter attr_rewrite chap checkval \
-               counter cui detail detail.log digest dynamic_clients eap \
+               counter cui detail detail.log digest dhcp dynamic_clients eap \
                echo exec expiration expr files inner-eap linelog logintime \
                mschap ntlm_auth pap passwd preprocess radutmp realm \
                replicate soh sradutmp unix utf8 wimax
index a79fed6..273d749 100644 (file)
@@ -798,6 +798,14 @@ instantiate {
        expr
 
        #
+       #  The DHCP module currently just registers some DHCP related
+       #  expansions, but will eventually contain all the code necessary
+       #  for encoding and decoding DHCP packets.
+       #
+       dhcp    
+       
+
+       #
        # We add the counter module here so that it registers
        # the check-name attribute before any module which sets
        # it
index d941085..46419fd 100644 (file)
@@ -28,7 +28,6 @@ RCSID("$Id$")
 #include       <freeradius-devel/radiusd.h>
 #include       <freeradius-devel/rad_assert.h>
 #include       <freeradius-devel/base64.h>
-#include       <freeradius-devel/dhcp.h>
 
 #include       <ctype.h>
 
@@ -598,42 +597,6 @@ static size_t xlat_base64(UNUSED void *instance, REQUEST *request,
        return enc;
 }
 
-static size_t xlat_dhcp_options(UNUSED void *instance, REQUEST *request,
-                              const char *fmt, char *out, size_t outlen)
-{
-       VALUE_PAIR *vp, *head = NULL, *next;
-       int decoded = 0;
-
-       while (isspace((int) *fmt)) fmt++;
-
-       if (!radius_get_vp(request, fmt, &vp) || !vp) {
-               *out = '\0';
-               
-               return 0;
-       }
-       
-       if ((fr_dhcp_decode_options(vp->vp_octets, vp->length, &head) < 0) ||
-           (head == NULL)) {
-               RDEBUG("WARNING: DHCP option decoding failed");
-               goto fail;
-       }
-
-       next = head;
-       
-       do {
-               next = next->next;
-               decoded++;
-       } while (next);
-       
-       pairmove(&(request->packet->vps), &head);
-
-       fail:
-       
-       snprintf(out, outlen, "%i", decoded);
-                       
-       return strlen(out);
-}
-
 /**
  * @brief Prints the current module processing the request
  */
@@ -868,7 +831,6 @@ int xlat_register(const char *module, RAD_XLAT_FUNC func, void *instance)
                XLAT_REGISTER(integer);
                XLAT_REGISTER(hex);
                XLAT_REGISTER(base64);
-               XLAT_REGISTER(dhcp_options);
                XLAT_REGISTER(string);
                XLAT_REGISTER(module);
 
index b8d32ca..c13de53 100644 (file)
@@ -9,6 +9,7 @@ rlm_copy_packet
 rlm_counter
 rlm_dbm
 rlm_detail
+rlm_dhcp
 rlm_digest
 rlm_dynamic_clients
 rlm_eap