When I use radclient from branch 1.1 it doesn't print IPv4 values correctly for the pairs inside the reply packet. I get 4 strange characters instead of an ASCII IP address in standard dot notation. It seems the following patch solves the problem for me, is it safe to apply it to the CVS ? (I'm unsure if lvalue or strvalue is used like this elsewhere) Index: src/lib/radius.c =================================================================== RCS file: /source/radiusd/src/lib/radius.c,v retrieving revision 1.125.2.5.2.1 diff -u -r1.125.2.5.2.1 radius.c --- src/lib/radius.c 30 Nov 2005 22:17:35 -0000 1.125.2.5.2.1 +++ src/lib/radius.c 11 Dec 2005 19:29:57 -0000 @@ -1590,11 +1590,16 @@ vp->lvalue = ntohl(vp->lvalue); break; - + /* + * IPv4 address. Keep it in network byte order in + * vp->lvalue and put ASCII IP address in standard + * dot notation into vp->strvalue. + */ case PW_TYPE_IPADDR: if (vp->length != 4) goto raw; memcpy(&vp->lvalue, vp->strvalue, 4); + ip_ntoa(vp->strvalue, vp->lvalue); break; /* -- Nicolas Baradakis
Nicolas Baradakis <nbk@sitadelle.com> wrote:
It seems the following patch solves the problem for me, is it safe to apply it to the CVS ? (I'm unsure if lvalue or strvalue is used like this elsewhere)
Not really. The patch works, and is not a bad idea. However, generally it would be good to *not* do this. It's a hack so that people can do regex matches on IP addresses. I hacked the CVS head to fix this a while back, and that hasn't been back-ported to 1.1.x. I would say add this patch to 1.1.x, *and* fix src/lib/print.c, to print out the IP address. Right now, it assumes that vp->strvalue is the printed form of the IP, which is not always right. Alan DeKok.
Alan DeKok wrote:
Nicolas Baradakis <nbk@sitadelle.com> wrote:
It seems the following patch solves the problem for me, is it safe to apply it to the CVS ? (I'm unsure if lvalue or strvalue is used like this elsewhere)
Not really. The patch works, and is not a bad idea.
However, generally it would be good to *not* do this. It's a hack so that people can do regex matches on IP addresses. I hacked the CVS head to fix this a while back, and that hasn't been back-ported to 1.1.x.
I would say add this patch to 1.1.x, *and* fix src/lib/print.c, to print out the IP address. Right now, it assumes that vp->strvalue is the printed form of the IP, which is not always right.
Many thanks for explaining all these things to me. I've updated the CVS exactly as you said. -- Nicolas Baradakis
participants (2)
-
Alan DeKok -
Nicolas Baradakis