From 093c53e3e08abb609cae6e58b1b438616c57c17f Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Tue, 3 Jun 2014 21:33:23 +0400 Subject: make IPv4 address to string conversions endian friendly --- accel-pppd/radius/packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'accel-pppd/radius') diff --git a/accel-pppd/radius/packet.c b/accel-pppd/radius/packet.c index ace9f6e2..5bff60af 100644 --- a/accel-pppd/radius/packet.c +++ b/accel-pppd/radius/packet.c @@ -284,6 +284,7 @@ void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (* uint64_t ifid; uint16_t u16[4]; } ifid_u; + in_addr_t addr; if (s) print("[RADIUS(%i) ", s->id); @@ -348,7 +349,8 @@ void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (* print("\"%s\"", attr->val.string); break; case ATTR_TYPE_IPADDR: - print("%i.%i.%i.%i", attr->val.ipaddr & 0xff, (attr->val.ipaddr >> 8) & 0xff, (attr->val.ipaddr >> 16) & 0xff, (attr->val.ipaddr >> 24) & 0xff); + addr = ntohl(attr->val.ipaddr); + print("%i.%i.%i.%i", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); break; case ATTR_TYPE_IFID: ifid_u.ifid = attr->val.ifid; -- cgit v1.2.3