From patchwork Mon Jan 13 16:05:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 2691 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 47xJN51gC5z3xY8 for ; Mon, 13 Jan 2020 16:05:41 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 47xJN34y9Mz2Ck; Mon, 13 Jan 2020 16:05:39 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 47xJN33M6Dz2yCq; Mon, 13 Jan 2020 16:05:39 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 47xJN23TCwz2xnh for ; Mon, 13 Jan 2020 16:05:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 47xJN20Rhrz2Ck; Mon, 13 Jan 2020 16:05:38 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1578931538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=64a58YjAHbBFIy4pbNlLuygh9S1ea633TjsGRS0qg5c=; b=F1z22v0DAsAmrLfC/T0/Bf94O0+7e5eFM65v+jO+2w99cWa2uRzXhQyUBonUNN8edpfzGQ FzzcBYTGQjTcW0AQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1578931538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=64a58YjAHbBFIy4pbNlLuygh9S1ea633TjsGRS0qg5c=; b=VUH5c2h6F1cUzCUFWKtcMzQB33VeXOu9s1t8HrCIbUq1UJ2rw/sL6j9BnkPVRSIempBaWW OGDagbXf+n3aCHYzWalyL1A/+p/SN33Um49qrrRgR3r6uFoJCjnTmMg/LYGt1CXupOMS9N UDqKfl5TLQ/vY0tQ9WzalzVh85wc1JtOEYbq9gApnA8Z2iZZRcS7UhrR4762+PfE1diLPP jSkW3XYdqcf6P0fwnTIoEIMeLFPe+vrGOTH7Quvkxuv4QMKHZX+PBWRf4kSt2XSlTVjCr0 LwKm86//mA87STutwZ8mFtJ3PhR+EGqMLs1j4dXfPbkMpZ53+2tB1gp+fwcx4A== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] setup: Remove DNS settings Date: Mon, 13 Jan 2020 16:05:27 +0000 Message-Id: <20200113160527.6188-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 --- 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; }