[PATCH 2/2] enable dns settings of wireless connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader/kickstart.c |    6 +++---
 loader/net.c       |   16 ++++++++++++----
 loader/net.h       |    2 +-
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index b779600..989d965 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -654,17 +654,17 @@ int process_kickstart_wifi (struct loaderData_s * loaderData) {
         if (loaderData->wepkey != NULL) {
             rc = add_and_activate_wifi_connection(&(loaderData->netDev), loaderData->essid,
                     WIFI_PROTECTION_WEP, loaderData->wepkey, loaderData->ipinfo_set, loaderData->ipv4,
-                    loaderData->gateway);
+                    loaderData->gateway, loaderData->dns);
         }
         else if (loaderData->wpakey != NULL) {
             rc = add_and_activate_wifi_connection(&(loaderData->netDev), loaderData->essid,
                     WIFI_PROTECTION_WPA, loaderData->wpakey, loaderData->ipinfo_set, loaderData->ipv4,
-                    loaderData->gateway);
+                    loaderData->gateway, loaderData->dns);
         }
         else {
             rc = add_and_activate_wifi_connection(&(loaderData->netDev), loaderData->essid,
                     WIFI_PROTECTION_UNPROTECTED, NULL, loaderData->ipinfo_set, loaderData->ipv4,
-                    loaderData->gateway);
+                    loaderData->gateway, loaderData->dns);
         }
     }
 
diff --git a/loader/net.c b/loader/net.c
index 833a330..ce9c813 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1839,17 +1839,20 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
         if (loaderData->wepkey != NULL)
             rc = add_and_activate_wifi_connection(&(loaderData->netDev),
                     loaderData->essid, WIFI_PROTECTION_WEP, loaderData->wepkey,
-                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway);
+                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway,
+                    loaderData->dns);
 
         else if (loaderData->wpakey != NULL)
             rc = add_and_activate_wifi_connection(&(loaderData->netDev),
                     loaderData->essid, WIFI_PROTECTION_WPA, loaderData->wpakey,
-                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway);
+                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway,
+                    loaderData->dns);
 
         else
             rc = add_and_activate_wifi_connection(&(loaderData->netDev),
                     loaderData->essid, WIFI_PROTECTION_UNPROTECTED, NULL,
-                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway);
+                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway,
+                    loaderData->dns);
 
         if (rc == WIFI_ACTIVATION_OK) {
             loaderData->netDev_set = 1;
@@ -2304,7 +2307,7 @@ guint32 ip_str_to_nbo(char* ip) {
 
 int add_and_activate_wifi_connection(char **iface, char *ssid,
     int protection, char *password, int ip_method_manual, char *address,
-    char *gateway) {
+    char *gateway, char *dns) {
 
     NMClient *client = NULL;
     NMDeviceWifi *device = NULL;
@@ -2427,6 +2430,7 @@ int add_and_activate_wifi_connection(char **iface, char *ssid,
         guint32 nbo_ip = ip_str_to_nbo(address);
         guint32 nbo_gw = 0;
         guint32 nbo_mask = 24;
+        guint32 nbo_dns = 0;
 
         if (gateway) nbo_gw = ip_str_to_nbo(gateway);
 
@@ -2441,6 +2445,10 @@ int add_and_activate_wifi_connection(char **iface, char *ssid,
             NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
             NM_SETTING_IP4_CONFIG_ADDRESSES, addresses,
             NULL);
+        if (dns) {
+            nbo_dns = ip_str_to_nbo(dns);
+            nm_setting_ip4_config_add_dns(s_ip, nbo_dns);
+        }
         nm_connection_add_setting(connection, NM_SETTING (s_ip));
         g_array_free(address_array, TRUE);
         g_ptr_array_free(addresses, TRUE);
diff --git a/loader/net.h b/loader/net.h
index 36d3857..068f995 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -85,7 +85,7 @@ int isValidIPv4Address(const char *address);
 int add_and_activate_wifi_connection (char **iface, char *ssid,
 				      int protection, char *password,
 				      int ip_method_manual, char *address,
-                                      char *gateway);
+                                      char *gateway, char *dns);
 #ifdef ENABLE_IPV6
 int isValidIPv6Address(const char *address);
 #endif
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux