From: c vw <dl1ycf@darc.de>
Date: Wed, 11 Nov 2020 16:23:21 +0000 (+0100)
Subject: Accept non-matching subnets also if the computer has an APIPA address
X-Git-Url: https://git.rkrishnan.org/Site/frontends/(%5B%5E?a=commitdiff_plain;h=d07ff0694108f588e7aca46b7081a955d34f6f6c;p=pihpsdr.git

Accept non-matching subnets also if the computer has an APIPA address
---

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);