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/extra | |
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/extra')
-rw-r--r-- | accel-pppd/extra/pppd_compat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index 7bdf5974..e005e8be 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -430,6 +430,7 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack) FILE *f; char *fname1, *fname2 = NULL; int i; + in_addr_t addr; fname1 = _malloc(PATH_MAX); if (!fname1) { @@ -478,7 +479,8 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack) fprintf(f, "\n"); break; case ATTR_TYPE_IPADDR: - fprintf(f, "%i.%i.%i.%i\n", attr->val.ipaddr & 0xff, (attr->val.ipaddr >> 8) & 0xff, (attr->val.ipaddr >> 16) & 0xff, (attr->val.ipaddr >> 24) & 0xff); + addr = ntohl(attr->val.ipaddr); + fprintf(f, "%i.%i.%i.%i\n", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); break; case ATTR_TYPE_DATE: fprintf(f, "%lu\n", attr->val.date); |