From 205bae9c113c49c18feb3abe03376a194734c736 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Thu, 1 Nov 2012 14:18:01 +0000 Subject: [PATCH] Move dhcp_options: xlat to rlm_dhcp module --- raddb/Makefile | 2 +- raddb/radiusd.conf.in | 8 ++++++++ src/main/xlat.c | 38 -------------------------------------- src/modules/stable | 1 + 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/raddb/Makefile b/raddb/Makefile index 23ecf37..164c0b7 100644 --- a/raddb/Makefile +++ b/raddb/Makefile @@ -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 diff --git a/raddb/radiusd.conf.in b/raddb/radiusd.conf.in index a79fed6..273d749 100644 --- a/raddb/radiusd.conf.in +++ b/raddb/radiusd.conf.in @@ -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 diff --git a/src/main/xlat.c b/src/main/xlat.c index d941085..46419fd 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -28,7 +28,6 @@ RCSID("$Id$") #include #include #include -#include #include @@ -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); diff --git a/src/modules/stable b/src/modules/stable index b8d32ca..c13de53 100644 --- a/src/modules/stable +++ b/src/modules/stable @@ -9,6 +9,7 @@ rlm_copy_packet rlm_counter rlm_dbm rlm_detail +rlm_dhcp rlm_digest rlm_dynamic_clients rlm_eap -- 2.1.4