0
if (rc_avpair_add(rh, &send, PW_USER_PASSWORD, passwd, -1, 0) == NULL)
                return ERROR_RC;

        if (rc_avpair_add(rh, &send, PW_NAS_PORT_TYPE, nas_port_type, -1, 0) == NULL)
                return ERROR_RC;

        if (rc_avpair_add(rh, &send, PW_FRAMED_IP_ADDRESS,"172.17.14.90", -1, 0) == NULL)
                return ERROR_RC;

above is my part of code "radexample.c Which used for generating a " radius request" I want to pass Framed IP with it also. my issue is here PW_USER_PASSWORD sends the correct value as it is a "string" type. but PW_FRAMED_IP_ADDRESS sends wrong value as its type is "ip" and I am sending string value.. If I pass "ip" in forth arg. rc_avpair_add gives error of type conversion !!

Jatin Bodarya
  • 1,425
  • 2
  • 20
  • 32

2 Answers2

0

PW_FRAMED_IP_ADDRESS wants an int for the fourth argument.

The easiest method is:

uint32_t framed_addr = 0;
inet_pton(AF_INET, "172.17.14.90", &framed_addr);
framed_addr = htonl(framed_addr); //network order
if (rc_avpair_add(rh, &send, PW_FRAMED_IP_ADDRESS,&framed_addr, -1, 0) == NULL)
            return ERROR_RC;
banuj
  • 3,080
  • 28
  • 34
0

I'm not sure, but Framed-IP-Address is not string attribute. Here is more detail. Maybe

unsigned int ip=(unsigned int)inet_addr("172.17.14.90");
if (rc_avpair_add(rh, &send, PW_FRAMED_IP_ADDRESS, &ip, sizeof(ip), 0) == NULL)

helps you?

declonter
  • 321
  • 1
  • 7