[PATCH 1/2] enable gateway settings of wireless connection

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

 



---
 loader/kickstart.c |    9 ++++++---
 loader/net.c       |   19 +++++++++++--------
 loader/net.h       |    3 ++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 24a97d1..b779600 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -653,15 +653,18 @@ int process_kickstart_wifi (struct loaderData_s * loaderData) {
     if (loaderData->essid != NULL) {
         if (loaderData->wepkey != NULL) {
             rc = add_and_activate_wifi_connection(&(loaderData->netDev), loaderData->essid,
-                    WIFI_PROTECTION_WEP, loaderData->wepkey, loaderData->ipinfo_set, loaderData->ipv4);
+                    WIFI_PROTECTION_WEP, loaderData->wepkey, loaderData->ipinfo_set, loaderData->ipv4,
+                    loaderData->gateway);
         }
         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);
+                    WIFI_PROTECTION_WPA, loaderData->wpakey, loaderData->ipinfo_set, loaderData->ipv4,
+                    loaderData->gateway);
         }
         else {
             rc = add_and_activate_wifi_connection(&(loaderData->netDev), loaderData->essid,
-                    WIFI_PROTECTION_UNPROTECTED, NULL, loaderData->ipinfo_set, loaderData->ipv4);
+                    WIFI_PROTECTION_UNPROTECTED, NULL, loaderData->ipinfo_set, loaderData->ipv4,
+                    loaderData->gateway);
         }
     }
 
diff --git a/loader/net.c b/loader/net.c
index 1db0292..833a330 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1839,17 +1839,17 @@ 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->ipinfo_set, loaderData->ipv4, loaderData->gateway);
 
         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->ipinfo_set, loaderData->ipv4, loaderData->gateway);
 
         else
             rc = add_and_activate_wifi_connection(&(loaderData->netDev),
                     loaderData->essid, WIFI_PROTECTION_UNPROTECTED, NULL,
-                    loaderData->ipinfo_set, loaderData->ipv4);
+                    loaderData->ipinfo_set, loaderData->ipv4, loaderData->gateway);
 
         if (rc == WIFI_ACTIVATION_OK) {
             loaderData->netDev_set = 1;
@@ -2303,7 +2303,8 @@ 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) {
+    int protection, char *password, int ip_method_manual, char *address,
+    char *gateway) {
 
     NMClient *client = NULL;
     NMDeviceWifi *device = NULL;
@@ -2424,12 +2425,14 @@ int add_and_activate_wifi_connection(char **iface, char *ssid,
         GPtrArray *addresses = g_ptr_array_new();
         GArray *address_array = g_array_new(FALSE, FALSE, sizeof(guint32));
         guint32 nbo_ip = ip_str_to_nbo(address);
-        guint32 mask = 24;
-        guint32 gw = 0;
+        guint32 nbo_gw = 0;
+        guint32 nbo_mask = 24;
+
+        if (gateway) nbo_gw = ip_str_to_nbo(gateway);
 
         g_array_append_val(address_array, nbo_ip);
-        g_array_append_val(address_array, mask);
-        g_array_append_val(address_array, gw);
+        g_array_append_val(address_array, nbo_mask);
+        g_array_append_val(address_array, nbo_gw);
 
         g_ptr_array_add(addresses, address_array);
 
diff --git a/loader/net.h b/loader/net.h
index cb1c39e..36d3857 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -84,7 +84,8 @@ int isURLRemote(char *url);
 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);
+				      int ip_method_manual, char *address,
+                                      char *gateway);
 #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