|
| 1 | +From 0bee9e9f7942c5b73a715eaeadf5ab2d09a8c74d Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Sat, 22 Feb 2025 18:33:25 +0100 |
| 4 | +Subject: [PATCH] Expose bound-to addresses from CivetWeb to the frontend |
| 5 | + |
| 6 | +Signed-off-by: DL6ER < [email protected]> |
| 7 | +--- |
| 8 | + src/webserver/civetweb/civetweb.c | 1 + |
| 9 | + src/webserver/civetweb/civetweb.h | 6 ++++++ |
| 10 | + 2 files changed, 7 insertions(+) |
| 11 | + |
| 12 | +diff --git a/src/webserver/civetweb/civetweb.c b/src/webserver/civetweb/civetweb.c |
| 13 | +index fa908e54..66fcab01 100644 |
| 14 | +--- a/src/webserver/civetweb/civetweb.c |
| 15 | ++++ b/src/webserver/civetweb/civetweb.c |
| 16 | +@@ -3339,6 +3339,7 @@ mg_get_server_ports(const struct mg_context *ctx, |
| 17 | + ports[cnt].is_ssl = ctx->listening_sockets[i].is_ssl; |
| 18 | + ports[cnt].is_redirect = ctx->listening_sockets[i].ssl_redir; |
| 19 | + ports[cnt].is_optional = ctx->listening_sockets[i].is_optional; |
| 20 | ++ memcpy(&ports[cnt].addr, &ctx->listening_sockets[i].lsa, sizeof(ports[cnt].addr)); |
| 21 | + |
| 22 | + if (ctx->listening_sockets[i].lsa.sa.sa_family == AF_INET) { |
| 23 | + /* IPv4 */ |
| 24 | +diff --git a/src/webserver/civetweb/civetweb.h b/src/webserver/civetweb/civetweb.h |
| 25 | +index eee958b4..6dcfa457 100644 |
| 26 | +--- a/src/webserver/civetweb/civetweb.h |
| 27 | ++++ b/src/webserver/civetweb/civetweb.h |
| 28 | +@@ -23,6 +23,8 @@ |
| 29 | + #ifndef CIVETWEB_HEADER_INCLUDED |
| 30 | + #define CIVETWEB_HEADER_INCLUDED |
| 31 | + |
| 32 | ++#include <netinet/in.h> /* Pi-hole extension */ |
| 33 | ++ |
| 34 | + #define CIVETWEB_VERSION "1.17" |
| 35 | + #define CIVETWEB_VERSION_MAJOR (1) |
| 36 | + #define CIVETWEB_VERSION_MINOR (17) |
| 37 | +@@ -721,6 +723,10 @@ struct mg_server_port { |
| 38 | + int _reserved2; |
| 39 | + int _reserved3; |
| 40 | + int _reserved4; |
| 41 | ++ union { |
| 42 | ++ struct sockaddr_in sa4; /* Pi-hole extension */ |
| 43 | ++ struct sockaddr_in6 sa6; /* Pi-hole extension */ |
| 44 | ++ } addr; |
| 45 | + }; |
| 46 | + |
| 47 | + /* Legacy name */ |
| 48 | +-- |
| 49 | +2.43.0 |
| 50 | + |
0 commit comments