From 946180701191ea7e552fa5a939140a635d47b566 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Thu, 16 Mar 2023 15:16:17 +0000 Subject: [PATCH] Remove limitation on --dynamic-host. Dynamic-host was implemented to ignore interface addresses with /32 (or /128 for IPv6) prefix lengths, since they are not useful for synthesising addresses. Due to a bug before 2.88, this didn't work for IPv4, and some have used --dynamic-host=example.com,0.0.0.0,eth0 to do the equivalent of --interface-name for such interfaces. When the bug was fixed in 2.88 these uses broke. Since this behaviour seems to violate the principle of least surprise, and since the 2.88 fix is breaking existing imstallations, this commit removes the check on /32 and /128 prefix lengths to solve both problems. --- src/network.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/network.c b/src/network.c index 1e41a78..a80d096 100644 --- a/src/network.c +++ b/src/network.c @@ -359,13 +359,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label, struct in_addr newaddr = addr->in.sin_addr; if (int_name->flags & INP4) - { - if (netmask.s_addr == 0xffffffff) - continue; - - newaddr.s_addr = (addr->in.sin_addr.s_addr & netmask.s_addr) | - (int_name->proto4.s_addr & ~netmask.s_addr); - } + newaddr.s_addr = (addr->in.sin_addr.s_addr & netmask.s_addr) | + (int_name->proto4.s_addr & ~netmask.s_addr); /* check for duplicates. */ for (lp = int_name->addr; lp; lp = lp->next) @@ -398,10 +393,6 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label, { int i; - /* No sense in doing /128. */ - if (prefixlen == 128) - continue; - for (i = 0; i < 16; i++) { int bits = ((i+1)*8) - prefixlen;