summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_sockaddr.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-06-29 19:25:46 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-06-29 19:25:46 +0300
commit46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e (patch)
tree03b6b6c03bc47584e730b083b22277b1bc61e8bf /src/nxt_sockaddr.h
parent499a8f9ac87765252dc3656c7aac900825475a51 (diff)
downloadunit-46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e.tar.gz
unit-46c6513c2b686d4a6e26c0fe0d0db4280baf5f3e.tar.bz2
Fixed port processing in nxt_sockaddr_text().
Diffstat (limited to 'src/nxt_sockaddr.h')
-rw-r--r--src/nxt_sockaddr.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nxt_sockaddr.h b/src/nxt_sockaddr.h
index 007d42e6..1119ee2e 100644
--- a/src/nxt_sockaddr.h
+++ b/src/nxt_sockaddr.h
@@ -38,7 +38,7 @@ struct nxt_sockaddr_s {
uint8_t address_length;
/*
* Textual port representation, e.g. "8000".
- * Port length is length - port_start.
+ * Port length is (start + length) - port_start.
*/
uint8_t port_start;
/*
@@ -106,7 +106,8 @@ NXT_EXPORT nxt_int_t nxt_inet6_addr(struct in6_addr *in6_addr, u_char *buf,
#define nxt_sockaddr_start(sa) nxt_pointer_to(sa, (sa)->start)
#define nxt_sockaddr_address(sa) nxt_pointer_to(sa, (sa)->address_start)
#define nxt_sockaddr_port(sa) nxt_pointer_to(sa, (sa)->port_start)
-#define nxt_sockaddr_length(sa) ((sa)->length - (sa)->port_start)
+#define nxt_sockaddr_port_length(sa) \
+ (((sa)->start + (sa)->length) - (sa)->port_start)
#endif /* _NXT_SOCKADDR_H_INCLUDED_ */