commit 34ac55e5fe559d5a0bce225a0e4469bc15c2a7e8
parent df9b007de4b861522a2ccf83ed168e01f4fddef1
Author: finwo <finwo@pm.me>
Date: Sat, 3 Jan 2026 19:37:12 +0100
2.42
Diffstat:
7 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,15 @@
+2.42 [KK 2009-01-28]
+- Bugfix in "xrctl generateconfig". The activity info introduced
+ before (which the web interface now emites), confused xrctl.
+- Bugfix in sys/ipmatch.cc: mask matching corrected for systems where
+ longs are not 4 bytes (64bit systems).
+- Bugfix in hashed-ip dispatch mode: When no back ends were available,
+ the dispatcher would crash (fixed).
+- XSLT stylesheet that transforms web interface slightly changed to
+ improve the looks.
+- Bugfix in xrctl's "rotate" action. Thanks "ncisrael" for reporting
+ it in the forum.
+
2.41 [KK 2009-01-05]
- Bugfix in xrctl, thanks Eddie for reporting it.
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
# Top-level Makefile for XR
# -------------------------
-VER = 2.41
+VER = 2.42
PREFIX = $(DESTDIR)/usr
BINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
diff --git a/xr/DispatchAlgorithms/hashedip/target.cc b/xr/DispatchAlgorithms/hashedip/target.cc
@@ -2,6 +2,12 @@
unsigned HashedIp::target(struct in_addr clientip,
BackendVector const &targetlist) {
+
+ // Nothing to do if we don't have targets.
+ if (!targetlist.size())
+ throw static_cast<Error>
+ ("Hashed-ip algorithm: no back ends to dispatch to");
+
// Hash the client's IP into an index
unsigned h = 0;
for (char *cp = (char*)&clientip;
diff --git a/xr/dnsentry/resolve.cc b/xr/dnsentry/resolve.cc
@@ -15,6 +15,6 @@ in_addr_t &DNSEntry::resolve (string const &h) {
if (!hostaddr)
throw static_cast<Error>("Failed to resolve host '") + h + "'";
- debugmsg(Mstr("Host ") + h + "resolved\n");
+ debugmsg(Mstr("Host ") + h + " resolved\n");
return result;
}
diff --git a/xr/etc/status.xslt b/xr/etc/status.xslt
@@ -19,18 +19,21 @@
font-family: Verdana,Helvetica;
font-size: 8pt;
}
+ table {
+ border-collapse: collapse;
+ border-style: hidden;
+ }
td {
font-family: Verdana,Helvetica;
font-size: 8pt;
- background-color: #ffff99; }
+ background-color: #ffff99;
+ border: 1px solid #f0f090;
}
input {
font-family: Verdana,Helvetica;
font-size: 8pt;
- background-color: #ffff99; }
}
- .server { background-color: #f3f399; }
- .backend { background-color: #f3f099; }
+ .header { background-color: #f3f399; }
.footer { color: gray; }
</style>
<script type="text/javascript">
@@ -75,10 +78,10 @@
<tr> <td colspan="4"><hr/></td></tr>
<tr>
- <td class="backend" colspan="2">
+ <td class="header" colspan="2">
<b>Add back end ip:port</b>
</td>
- <td class="backend" colspan="2" align="right">
+ <td class="header" colspan="2" align="right">
<input type="text" size="30" name="addbackend" id="addbackend"
onchange="goto('/server/addbackend/', 'addbackend');"/>
</td>
@@ -178,10 +181,10 @@
<xsl:template match="/status/server">
<tr>
- <td class="server" colspan="3">
+ <td class="header" colspan="3">
<b>Server <xsl:value-of select="address"/> </b>
</td>
- <td class="server">
+ <td class="header">
<input type="button" onclick="goto('/', '');" value="Refresh"/>
</td>
</tr>
@@ -529,11 +532,11 @@
<xsl:template match="/status/backend">
<tr> <td colspan="4"><hr/></td></tr>
<tr>
- <td class="backend" colspan="3">
+ <td class="header" colspan="3">
<a name="{nr}"/>
<b> Back end <xsl:value-of select="address"/> </b>
</td>
- <td class="backend">
+ <td class="header">
<input type="button" value="Delete"
onclick="goto('/server/deletebackend/{nr}', '');"/>
</td>
@@ -754,4 +757,3 @@
<xsl:template match="*"/>
</xsl:stylesheet>
-
diff --git a/xr/sys/ipmatch.cc b/xr/sys/ipmatch.cc
@@ -4,9 +4,9 @@
bool ipmatch (struct in_addr adr, struct in_addr mask) {
PROFILE("ipmatch");
- long laddr, lmask;
- memcpy (&laddr, &adr, sizeof(long));
- memcpy (&lmask, &mask, sizeof(long));
+ long laddr = 0, lmask = 0;
+ memcpy (&laddr, &adr, sizeof(adr));
+ memcpy (&lmask, &mask, sizeof(mask));
bool match = ( (laddr & lmask) == laddr );
debugmsg ("Matching ip " + (string)inet_ntoa(adr) + " against mask " +
diff --git a/xrctl/xrctl b/xrctl/xrctl
@@ -197,7 +197,7 @@ sub cmd_rotate {
print ("Service $s: ");
my $f = log_file($s);
print ("log file $f, ");
- if (substr($s, 0, 1) ne '>') {
+ if (substr($f, 0, 1) ne '>') {
print ("not a file\n");
next;
}
@@ -643,12 +643,16 @@ sub generateconfig {
my $active = 0;
for my $l (split (/\n/, $response_blob)) {
if ($l =~ /<server>/) {
- print ($l, "\n");
+ print (" $l\n");
$active = 1;
} elsif ($l =~ /<\/status>/) {
$active = 0;
+ } elsif ($l =~ /<activity>/) {
+ $active = 0;
+ } elsif ($l =~ /<\/activity>/) {
+ $active = 1;
} elsif ($active) {
- print ($l, "\n");
+ print (" $l\n");
}
}
@@ -689,6 +693,9 @@ sub new {
}
}
+ # Activity logs is trash
+ $docstr =~ s{<activity>.*</activity>}{}g;
+
# print $docstr, "\n";
$self->{xml} = $docstr;