adding new entry in dictionar
Hi everybody, i have added a new entry in dictionary.3gpp2. the new entry is part of a TLV that i had created in the past and been using for years successfully, but now i needed to add a new field and it does not work, i do not know the reasons as i m adding it as i did the rest of the fields in the tlv long time ago (or so i think) this is the tlv: # The next set of attributes contain sub-types ATTRIBUTE 3GPP2-Prepaid-Acct-Quota 90 tlv ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-QuotaIDentifier 90.1 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuota 90.2 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow 90.3 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeThreshold 90.4 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeThresholdOverflow 90.5 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-UpdateReason 90.8 short The new field is 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow. The radius logs still showing this field as "Attr-26.5535.90.3 = 0x0000", and programatically i m trying to access it as i do the others and all i get is garbage. this is how i m trying to access it: i try to get an id to it from the dictoinary: inst->vqo = dict_attrbyname("3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow"); and then try to access it like this: volume_quota_overflow = pairfind(request->packet->vps,instance->vqo->attr,_3GPP2_VENDOR,TAG_ANY); but all i get is garbage (it is actually the whole field as a decimal number which a big number,144907816), after changing the dictionary i restarted the sever. i m using freeradius 3.0.7, please any hint will be much appreciated. thanks!
On Apr 28, 2015, at 2:29 AM, Juan Pablo L. <jpablolorenzetti@hotmail.com> wrote: Hi everybody, i have added a new entry in dictionary.3gpp2.
the new entry is part of a TLV that i had created in the past and been using for years successfully, but now i needed to add a new field and it does not work, i do not know the reasons as i m adding it as i did the rest of the fields in the tlv long time ago (or so i think)
This question is better suited for the developers list, as you're looking at the server internals.
The new field is 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow. The radius logs still showing this field as "Attr-26.5535.90.3 = 0x0000",
Probably because it's being created incorrectly.
and programatically i m trying to access it as i do the others and all i get is garbage. this is how i m trying to access it:
i try to get an id to it from the dictoinary:
inst->vqo = dict_attrbyname("3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow");
Yes, that works.
and then try to access it like this:
volume_quota_overflow = pairfind(request->packet->vps,instance->vqo->attr,_3GPP2_VENDOR,TAG_ANY);
That works, too.
but all i get is garbage (it is actually the whole field as a decimal number which a big number,144907816),
No, you get a pointer to the VALUE_PAIR. You shouldn't look at the internal fields of a DICT_ATTR unless you need to do that. The "garbage" value you're referring to is a real value which has meaning. Go read src/lib/dict.c for explanations. The problem seems to be that you're not creating the attribute properly. Since you didn't include that code here, I can't tell what you're doing wrong. Alan DeKok.
Hi Alex, thanks for your prompt answer as always, i have added all code related to the management of this field, i m certainly that i m doing it wrong but cant see where .. am i missing some code to make this work ? as far as i knew: 1. i needed to add the field in the dictionary (new field is 90.3): # The next set of attributes contain sub-types ATTRIBUTE 3GPP2-Prepaid-Acct-Quota 90 tlv ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-QuotaIDentifier 90.1 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuota 90.2 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow 90.3 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeThreshold 90.4 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeThresholdOverflow 90.5 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-UpdateReason 90.8 short 2. get a reference to the id assigned internally to that field by freeradius: inst->vqo = dict_attrbyname("3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow"); 3. get the value from the request: volume_quota_overflow = pairfind(request->packet->vps,instance->vqo->attr,_3GPP2_VENDOR,TAG_ANY); 4. access the value in the module: volume_quota_overflow->vp_integer those are the steps that i m following but there is something wrong because regardless of what i do in the module code freeradius does not recognise the field when the request comes in anyways so i think anything after that will fail too. freeradius still shows this field in the logs as: Attr-26.5535.90.3 = 0x0000 after adding the new field in the dictionary and restarting the server, what else is needed to make freeradius recognise the field, and display it properly in the logs? because maybe that is the problem, that freeradius still does not pick up the new field. thanks!!!
Subject: Re: adding new entry in dictionar From: aland@deployingradius.com Date: Tue, 28 Apr 2015 06:34:41 -0400 To: freeradius-users@lists.freeradius.org
On Apr 28, 2015, at 2:29 AM, Juan Pablo L. <jpablolorenzetti@hotmail.com> wrote: Hi everybody, i have added a new entry in dictionary.3gpp2.
the new entry is part of a TLV that i had created in the past and been using for years successfully, but now i needed to add a new field and it does not work, i do not know the reasons as i m adding it as i did the rest of the fields in the tlv long time ago (or so i think)
This question is better suited for the developers list, as you're looking at the server internals.
The new field is 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow. The radius logs still showing this field as "Attr-26.5535.90.3 = 0x0000",
Probably because it's being created incorrectly.
and programatically i m trying to access it as i do the others and all i get is garbage. this is how i m trying to access it:
i try to get an id to it from the dictoinary:
inst->vqo = dict_attrbyname("3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow");
Yes, that works.
and then try to access it like this:
volume_quota_overflow = pairfind(request->packet->vps,instance->vqo->attr,_3GPP2_VENDOR,TAG_ANY);
That works, too.
but all i get is garbage (it is actually the whole field as a decimal number which a big number,144907816),
No, you get a pointer to the VALUE_PAIR.
You shouldn't look at the internal fields of a DICT_ATTR unless you need to do that. The "garbage" value you're referring to is a real value which has meaning. Go read src/lib/dict.c for explanations.
The problem seems to be that you're not creating the attribute properly. Since you didn't include that code here, I can't tell what you're doing wrong.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Apr 28, 2015, at 10:25 AM, Juan Pablo L. <jpablolorenzetti@hotmail.com> wrote:
Hi Alex, thanks for your prompt answer as always, i have added all code related to the management of this field, i m certainly that i m doing it wrong but cant see where .. am i missing some code to make this work ? as far as i knew:
1. i needed to add the field in the dictionary (new field is 90.3): # The next set of attributes contain sub-types ATTRIBUTE 3GPP2-Prepaid-Acct-Quota 90 tlv ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-QuotaIDentifier 90.1 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuota 90.2 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow 90.3 integer
Note that is "integer". i.e. 4 octets.
4. access the value in the module: volume_quota_overflow->vp_integer
That should all work.
those are the steps that i m following but there is something wrong because regardless of what i do in the module code freeradius does not recognise the field when the request comes in anyways so i think anything after that will fail too.
freeradius still shows this field in the logs as: Attr-26.5535.90.3 = 0x0000
i.e. 2 octets. You're getting that value because the attribute in the packet is malformed. Change the dictionary to use type "short", or fix the NAS so that it sends the correct format.
after adding the new field in the dictionary and restarting the server, what else is needed to make freeradius recognise the field, and display it properly in the logs? because maybe that is the problem, that freeradius still does not pick up the new field. thanks!!!
The NAS needs to send the attribute in the format specified by the dictionary. If the two disagree, you'll see "Attr-..." instead of "3GPP2-..." Alan DeKok.
Alex, thank you very much, changing to short worked, even though i do not understand something, the standard states that the field is 4 octets, i supposed that includes the headers of the field + the value of the field. ... i did notice the value had 2 octets but went by my intepretation of the standard (4 octets for the value). thanks a lot it is working all good now.
Subject: Re: adding new entry in dictionar From: aland@deployingradius.com Date: Tue, 28 Apr 2015 10:34:01 -0400 To: freeradius-users@lists.freeradius.org
On Apr 28, 2015, at 10:25 AM, Juan Pablo L. <jpablolorenzetti@hotmail.com> wrote:
Hi Alex, thanks for your prompt answer as always, i have added all code related to the management of this field, i m certainly that i m doing it wrong but cant see where .. am i missing some code to make this work ? as far as i knew:
1. i needed to add the field in the dictionary (new field is 90.3): # The next set of attributes contain sub-types ATTRIBUTE 3GPP2-Prepaid-Acct-Quota 90 tlv ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-QuotaIDentifier 90.1 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuota 90.2 integer ATTRIBUTE 3GPP2-Prepaid-Acct-Quota-VolumeQuotaOverflow 90.3 integer
Note that is "integer". i.e. 4 octets.
4. access the value in the module: volume_quota_overflow->vp_integer
That should all work.
those are the steps that i m following but there is something wrong because regardless of what i do in the module code freeradius does not recognise the field when the request comes in anyways so i think anything after that will fail too.
freeradius still shows this field in the logs as: Attr-26.5535.90.3 = 0x0000
i.e. 2 octets. You're getting that value because the attribute in the packet is malformed. Change the dictionary to use type "short", or fix the NAS so that it sends the correct format.
after adding the new field in the dictionary and restarting the server, what else is needed to make freeradius recognise the field, and display it properly in the logs? because maybe that is the problem, that freeradius still does not pick up the new field. thanks!!!
The NAS needs to send the attribute in the format specified by the dictionary. If the two disagree, you'll see "Attr-..." instead of "3GPP2-..."
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (2)
-
Alan DeKok -
Juan Pablo L.