commit db29ea70406785d70e2228e68b18c4b1a660d96b
parent 6f3c7bbf8aee3fed733f7e1bd93c562fe1616bec
Author: Frederic Cambus <fred@statdns.com>
Date: Fri, 26 Oct 2018 21:01:15 +0200
Account for 'addrtype' to 'family' change in Kore master branch
Diffstat:
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/ip.c b/src/ip.c
@@ -28,10 +28,10 @@ ip(struct http_request *req)
addr = kore_malloc(INET6_ADDRSTRLEN);
- if (req->owner->addrtype == AF_INET) {
- inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv4.sin_addr), addr, INET6_ADDRSTRLEN);
+ if (req->owner->family == AF_INET) {
+ inet_ntop(req->owner->family, &(req->owner->addr.ipv4.sin_addr), addr, INET6_ADDRSTRLEN);
} else {
- inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv6.sin6_addr), addr, INET6_ADDRSTRLEN);
+ inet_ntop(req->owner->family, &(req->owner->addr.ipv6.sin6_addr), addr, INET6_ADDRSTRLEN);
}
if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) {
diff --git a/src/jsonip.c b/src/jsonip.c
@@ -39,10 +39,10 @@ jsonip(struct http_request *req)
http_response_header(req, "Cache-Control", "no-cache");
http_response_header(req, "Content-Type", "application/json; charset=utf-8");
- if (req->owner->addrtype == AF_INET) {
- inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv4.sin_addr), addr, INET6_ADDRSTRLEN);
+ if (req->owner->family == AF_INET) {
+ inet_ntop(req->owner->family, &(req->owner->addr.ipv4.sin_addr), addr, INET6_ADDRSTRLEN);
} else {
- inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv6.sin6_addr), addr, INET6_ADDRSTRLEN);
+ inet_ntop(req->owner->family, &(req->owner->addr.ipv6.sin6_addr), addr, INET6_ADDRSTRLEN);
}
if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) {
diff --git a/src/location.c b/src/location.c
@@ -109,11 +109,11 @@ location(struct http_request *req)
http_response_header(req, "Content-Type", "application/json; charset=utf-8");
/* IP address of the client originating the request */
- if (req->owner->addrtype == AF_INET)
- inet_ntop(req->owner->addrtype,
+ if (req->owner->family == AF_INET)
+ inet_ntop(req->owner->family,
&(req->owner->addr.ipv4.sin_addr), addr, INET6_ADDRSTRLEN);
else
- inet_ntop(req->owner->addrtype,
+ inet_ntop(req->owner->family,
&(req->owner->addr.ipv6.sin6_addr), addr, INET6_ADDRSTRLEN);
/* IP address specified in the "X-Forwarded-For" header */