From 9b2275bcdd9a91c1dc28f7451dc276c49545d527 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 21 Jan 2017 13:42:09 +0100 Subject: [PATCH] Corrected byte order on read of IPV6_TCLASS value from ancillary message --- CHANGES | 3 +++ xio-ip6.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index af1a1ee..3235509 100644 --- a/CHANGES +++ b/CHANGES @@ -60,6 +60,9 @@ corrections: Ignore exit code of child process when it was killed by master due to EOF + Corrected byte order on read of IPV6_TCLASS value from ancillary + message + porting: Type conflict between int and sig_atomic_t between declaration and definition of diag_immediate_type and diag_immediate_exit broke diff --git a/xio-ip6.c b/xio-ip6.c index b24ef34..d10e7fc 100644 --- a/xio-ip6.c +++ b/xio-ip6.c @@ -292,11 +292,14 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num, return STAT_OK; #endif #ifdef IPV6_TCLASS - case IPV6_TCLASS: + case IPV6_TCLASS: { + unsigned int u; typbuff[0] = '\0'; strncat(typbuff, "IPV6_TCLASS", typlen-1); nambuff[0] = '\0'; strncat(nambuff, "tclass", namlen-1); - xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); + u = ntohl(*(unsigned int *)CMSG_DATA(cmsg)); + xiodump((const unsigned char *)&u, msglen, valbuff, vallen, 0); return STAT_OK; + } #endif default: snprintf(typbuff, typlen, "IPV6.%u", cmsg->cmsg_type);