IPv4 strvalue
Nicolas Baradakis
nbk at sitadelle.com
Sun Dec 11 20:44:22 CET 2005
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
More information about the Freeradius-Devel
mailing list