diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-06-03 21:33:23 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-06-03 21:33:23 +0400 |
commit | 093c53e3e08abb609cae6e58b1b438616c57c17f (patch) | |
tree | 10599557e5373498f773b57e0af84e7219875434 /accel-pppd/radius | |
parent | b002a1bdc060bf26497ea65174bfb66468560abb (diff) | |
download | accel-ppp-093c53e3e08abb609cae6e58b1b438616c57c17f.tar.gz accel-ppp-093c53e3e08abb609cae6e58b1b438616c57c17f.zip |
make IPv4 address to string conversions endian friendly
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/packet.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |