diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-04-09 21:42:44 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-04-17 09:06:35 +0400 |
commit | a5313507e0213647c6e745b9f2746493a1b0ddc5 (patch) | |
tree | 8cf773fd1a910b0c05ccc6a80341e8117dcf4165 /accel-pppd/ctrl | |
parent | faf185d337229fd521bfbadbb8c8ad3a34e5b705 (diff) | |
download | accel-ppp-a5313507e0213647c6e745b9f2746493a1b0ddc5.tar.gz accel-ppp-a5313507e0213647c6e745b9f2746493a1b0ddc5.zip |
l2tp: Fix endianness of 64 bits AVPs (reception)
Received attributes of type ATTR_TYPE_INT64 are transferred to upper
layer in network byte order while any other integer type uses host
byte order.
This patch converts int64 values to host byte order so that they can be
used like other integer types.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index 03816d50..2546866d 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <endian.h> #include <errno.h> #include <stdio.h> #include <unistd.h> @@ -284,7 +285,7 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info) case ATTR_TYPE_INT64: if (avp->length != sizeof(*avp) + 8) goto out_err_len; - attr->val.uint64 = *(uint64_t *)avp->val; + attr->val.uint64 = be64toh(*(uint64_t *)avp->val); break; case ATTR_TYPE_OCTETS: attr->val.octets = _malloc(attr->length); |