This is no longer required since we have a new CGI script
that takes care of all DNS settings and stores things in
another format.
Fixes: #12235
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
src/setup/networking.c | 93 +++++++++++-------------------------------
1 file changed, 23 insertions(+), 70 deletions(-)
diff --git a/src/setup/networking.c b/src/setup/networking.c
index d6cd30cff..51dc7acb0 100644
--- a/src/setup/networking.c
+++ b/src/setup/networking.c
@@ -14,11 +14,6 @@
#include "setup.h"
-#define DNS1 0
-#define DNS2 1
-#define DEFAULT_GATEWAY 2
-#define DNSGATEWAY_TOTAL 3
-
extern FILE *flog;
extern char *mylog;
@@ -56,7 +51,7 @@ int drivermenu(void);
int changedrivers(void);
int greenaddressmenu(void);
int addressesmenu(void);
-int dnsgatewaymenu(void);
+int gatewaymenu(void);
int handlenetworking(void)
{
@@ -89,7 +84,7 @@ int handlenetworking(void)
break;
case 4:
- dnsgatewaymenu();
+ gatewaymenu();
break;
case 0:
@@ -250,7 +245,7 @@ int firstmenu(void)
_("Network configuration type"),
_("Drivers and card assignments"),
_("Address settings"),
- _("DNS and Gateway settings"),
+ _("Gateway settings"),
NULL
};
int rc;
@@ -708,14 +703,14 @@ int addressesmenu(void)
return 0;
}
-/* DNS and default gateway.... */
-int dnsgatewaymenu(void)
+/* default gateway.... */
+int gatewaymenu(void)
{
struct keyvalue *kv = initkeyvalues();
char message[1000];
char temp[STRING_SIZE] = "0";
- struct newtWinEntry entries[DNSGATEWAY_TOTAL+1];
- char *values[DNSGATEWAY_TOTAL]; /* pointers for the values. */
+ struct newtWinEntry entries[2];
+ char* values[1]; /* pointers for the values. */
int error;
int configtype;
int rc;
@@ -727,92 +722,50 @@ int dnsgatewaymenu(void)
return 0;
}
- entries[DNS1].text = _("Primary DNS:");
- strcpy(temp, ""); findkey(kv, "DNS1", temp);
- values[DNS1] = strdup(temp);
- entries[DNS1].value = &values[DNS1];
- entries[DNS1].flags = 0;
-
- entries[DNS2].text = _("Secondary DNS:");
- strcpy(temp, ""); findkey(kv, "DNS2", temp);
- values[DNS2] = strdup(temp);
- entries[DNS2].value = &values[DNS2];
- entries[DNS2].flags = 0;
-
- entries[DEFAULT_GATEWAY].text = _("Default gateway:");
+ entries[0].text = _("Default gateway:");
strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
- values[DEFAULT_GATEWAY] = strdup(temp);
- entries[DEFAULT_GATEWAY].value = &values[DEFAULT_GATEWAY];
- entries[DEFAULT_GATEWAY].flags = 0;
+ values[0] = strdup(temp);
+ entries[0].value = &values[0];
+ entries[0].flags = 0;
- entries[DNSGATEWAY_TOTAL].text = NULL;
- entries[DNSGATEWAY_TOTAL].value = NULL;
- entries[DNSGATEWAY_TOTAL].flags = 0;
+ entries[1].text = NULL;
+ entries[1].value = NULL;
+ entries[1].flags = 0;
do
{
error = 0;
- rc = newtWinEntries(_("DNS and Gateway settings"),
- _("Enter the DNS and gateway information. "
- "These settings are used only with Static IP (and DHCP if DNS set) on the RED interface."),
+ rc = newtWinEntries(_("Gateway settings"),
+ _("Enter the gateway information. "
+ "These settings are used only with Static IP on the RED interface."),
50, 5, 5, 18, entries, _("OK"), _("Cancel"), NULL);
if (rc == 0 || rc == 1)
{
- strcpy(message, _("The following fields are invalid:"));
- strcpy(message, "\n\n");
- if (strlen(values[DNS1]))
+ if (strlen(values[0]))
{
- if (inet_addr(values[DNS1]) == INADDR_NONE)
- {
- strcat(message, _("Primary DNS"));
- strcat(message, "\n");
- error = 1;
- }
- }
- if (strlen(values[DNS2]))
- {
- if (inet_addr(values[DNS2]) == INADDR_NONE)
- {
- strcat(message, _("Secondary DNS"));
- strcat(message, "\n");
- error = 1;
- }
- }
- if (strlen(values[DEFAULT_GATEWAY]))
- {
- if (inet_addr(values[DEFAULT_GATEWAY]) == INADDR_NONE)
+ if (inet_addr(values[0]) == INADDR_NONE)
{
strcat(message, _("Default gateway"));
strcat(message, "\n");
error = 1;
}
}
- if (!strlen(values[DNS1]) && strlen(values[DNS2]))
- {
- strcpy(message, _("Secondary DNS specified without a Primary DNS"));
- strcat(message, "\n");
- error = 1;
- }
if (error)
errorbox(message);
else
{
- replacekeyvalue(kv, "DNS1", values[DNS1]);
- replacekeyvalue(kv, "DNS2", values[DNS2]);
- replacekeyvalue(kv, "DEFAULT_GATEWAY", values[DEFAULT_GATEWAY]);
+ replacekeyvalue(kv, "DEFAULT_GATEWAY", values[0]);
netaddresschange = 1;
- free(values[DNS1]);
- free(values[DNS2]);
- free(values[DEFAULT_GATEWAY]);
+ free(values[0]);
writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings");
}
}
}
while (error);
-
+
freekeyvalues(kv);
-
+
return 1;
}
--
2.20.1