From d07ff0694108f588e7aca46b7081a955d34f6f6c Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Wed, 11 Nov 2020 17:23:21 +0100
Subject: [PATCH] Accept non-matching subnets also if the computer has an APIPA
 address

---
 discovery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/discovery.c b/discovery.c
index 93ac1ec..cdd71f3 100644
--- a/discovery.c
+++ b/discovery.c
@@ -479,7 +479,11 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name);
 	  // by many radios if they do not get a DHCP address. These addresses are valid even if outside the
 	  // netmask of the (physical) interface making the connection - so do not complain in this case!
 	  //
-          if (strncmp(inet_ntoa(d->info.network.address.sin_addr),"169.254.",8)) {
+	  // If the radio has a valid IP address but the computer only has an APIPA address, this also
+	  // leads to a radio address outside the netmask and can be ignored.
+	  //
+          if (strncmp(inet_ntoa(d->info.network.address.sin_addr),"169.254.",8) &&
+              strncmp(inet_ntoa(d->info.network.interface_address.sin_addr),"169.254.",8)) {
             if((d->info.network.interface_address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr) != (d->info.network.address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr)) {
               gtk_button_set_label(GTK_BUTTON(start_button),"Subnet!");
               gtk_widget_set_sensitive(start_button, FALSE);
-- 
2.45.2