1 commit a4b3e41e5fb845e0804ff6a5a4e94b5b0631b6b7
3 Author: Geoffrey McRae <gnif@users.noreply.github.com>
4 Date: Tue Dec 20 14:19:54 2016 +1100
6 Merge pull request #46 from criecm/stable
10 commit e93902533dd89ba6c77cea90e4e2c7d762650126
11 Author: Geoffroy Desvernay <dgeo@centrale-marseille.fr>
12 Date: Mon Dec 12 10:01:14 2016 +0100
14 Fix warning with clang
16 Fix this warning on FreeBSD 11 (clang cc by default)
17 ./apxs.sh -c -n mod_rpaf.so mod_rpaf.c
18 /usr/local/share/apr/build-1/libtool --silent --mode=compile cc -prefer-pic -O2 -pipe -I/usr/local/include -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include/apache24 -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include -I/usr/local/include/db5 -I/usr/include -c -o mod_rpaf.lo mod_rpaf.c && touch mod_rpaf.slo
19 mod_rpaf.c:117:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
20 if (mask = ap_strchr(ip, '/')) {
21 ~~~~~^~~~~~~~~~~~~~~~~~~~
22 mod_rpaf.c:117:18: note: place parentheses around the assignment to silence this warning
23 if (mask = ap_strchr(ip, '/')) {
26 mod_rpaf.c:117:18: note: use '==' to turn this assignment into an equality comparison
27 if (mask = ap_strchr(ip, '/')) {
32 diff --git a/mod_rpaf.c b/mod_rpaf.c
33 index ee59765..519aece 100644
36 @@ -114,7 +114,7 @@ static const char *rpaf_set_proxy_ip(cmd_parms *cmd, void *dummy, const char *pr
38 if (rpaf_looks_like_ip(proxy_ip)) {
39 ip = apr_pstrdup(cmd->temp_pool, proxy_ip);
40 - if (mask = ap_strchr(ip, '/')) {
41 + if ((mask = ap_strchr(ip, '/'))) {
44 sub = (apr_ipsubnet_t **)apr_array_push(cfg->proxy_ips);
46 commit 6ecaee817d787db3c449d07282e1c440e5dccaeb
47 Author: Ben Sjoberg <bensjoberg@gmail.com>
48 Date: Fri Dec 9 21:05:38 2016 -0600
50 Fix IPv6 client IPs when the proxy uses KeepAlive
52 diff --git a/mod_rpaf.c b/mod_rpaf.c
53 index ee59765..e4d8ae7 100644
56 @@ -54,6 +54,7 @@ typedef struct {
60 + apr_sockaddr_t old_addr;
64 @@ -206,7 +207,7 @@ static int is_in_array(apr_sockaddr_t *remote_addr, apr_array_header_t *proxy_ip
65 static apr_status_t rpaf_cleanup(void *data) {
66 rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data;
67 rcr->r->DEF_IP = apr_pstrdup(rcr->r->connection->pool, rcr->old_ip);
68 - rcr->r->DEF_ADDR->sa.sin.sin_addr.s_addr = apr_inet_addr(rcr->r->DEF_IP);
69 + memcpy(rcr->r->DEF_ADDR, &rcr->old_addr, sizeof(apr_sockaddr_t));
73 @@ -311,6 +312,7 @@ static int rpaf_post_read_request(request_rec *r) {
75 apr_pool_cleanup_register(r->pool, (void *)rcr, rpaf_cleanup, apr_pool_cleanup_null);
76 r->DEF_IP = apr_pstrdup(r->DEF_POOL, last_val);
77 + memcpy(&rcr->old_addr, r->DEF_ADDR, sizeof(apr_sockaddr_t));
79 tmppool = r->DEF_ADDR->pool;
80 tmpport = r->DEF_ADDR->port;
82 commit 5d3cd725c118c0b5f3a330b618d723cc99b77065
83 Author: Geoffrey McRae <geoff@spacevs.com>
84 Date: Wed Oct 14 00:32:47 2015 +1100
86 Added '.' to the ipv6 character set for ipv4 in ipv6 addresses, fixes #19
88 diff --git a/mod_rpaf.c b/mod_rpaf.c
89 index 7425aa6..690f0f9 100644
92 @@ -81,7 +81,7 @@ static void *rpaf_create_server_cfg(apr_pool_t *p, server_rec *s) {
93 /* quick check for ipv4/6 likelihood; similar to Apache2.4 mod_remoteip check */
94 static int rpaf_looks_like_ip(const char *ip) {
95 static const char ipv4_set[] = "0123456789./";
96 - static const char ipv6_set[] = "0123456789abcdef:/";
97 + static const char ipv6_set[] = "0123456789abcdef:/.";
99 /* zero length value is not valid */