From a5313507e0213647c6e745b9f2746493a1b0ddc5 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Tue, 9 Apr 2013 21:42:44 +0200 Subject: 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 --- accel-pppd/ctrl/l2tp/packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index 03816d5..2546866 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3