summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jeffrey Hutzelman <jhutz@cmu.edu>2013-02-12 19:47:11 -0500
committerGravatar Jeffrey Hutzelman <jhutz@cmu.edu>2013-02-14 19:57:32 -0500
commitb92153fac201a9a22779817be5f2375f7cf754fc (patch)
treea871c806708a00f8283aa95881884b5b58f0a495
parentf473694b272b517e13d14d85916c43c6b03ddda4 (diff)
Send IPv4 addresses ASCII-encoded, not ZCode
This fixes #94
-rw-r--r--lib/Zinternal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Zinternal.c b/lib/Zinternal.c
index 0f692f3..87d6e91 100644
--- a/lib/Zinternal.c
+++ b/lib/Zinternal.c
@@ -947,13 +947,15 @@ Z_ZcodeFormatRawHeader(ZNotice_t *notice,
if (notice->z_sender_sockaddr.sa.sa_family == AF_INET) {
addrlen = sizeof(notice->z_sender_sockaddr.ip4.sin_addr);
addraddr = (unsigned char *)&notice->z_sender_sockaddr.ip4.sin_addr;
+ if (ZMakeAscii(ptr, end-ptr, addraddr, addrlen) == ZERR_FIELDLEN)
+ return ZERR_HEADERLEN;
} else if (notice->z_sender_sockaddr.sa.sa_family == AF_INET6) {
addrlen = sizeof(notice->z_sender_sockaddr.ip6.sin6_addr);
addraddr = (unsigned char *)&notice->z_sender_sockaddr.ip6.sin6_addr;
+ if (ZMakeZcode(ptr, end-ptr, addraddr, addrlen) == ZERR_FIELDLEN)
+ return ZERR_HEADERLEN;
}
- if (ZMakeZcode(ptr, end-ptr, addraddr, addrlen) == ZERR_FIELDLEN)
- return ZERR_HEADERLEN;
ptr += strlen(ptr) + 1;
}