PATCH [4/5]: mkinitrd: actual bring up the network interface

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

 



Hi all,

This patch fixes the network config code to not only configure the interface, but also actually bring it up, which sort of helps.

Regards,

Hans
diff -up mkinitrd-6.0.75/nash/network.c~ mkinitrd-6.0.75/nash/network.c
--- mkinitrd-6.0.75/nash/network.c~	2009-01-31 13:17:26.000000000 +0100
+++ mkinitrd-6.0.75/nash/network.c	2009-01-31 13:19:54.000000000 +0100
@@ -189,6 +189,51 @@ static int nashSetMTU(char * dev, int mt
     return ret;
 }
 
+static int nashSetUp(char * dev) {
+    struct nl_handle *handle = NULL;
+    struct nl_cache *cache = NULL;
+    struct rtnl_link *link = NULL;
+    struct rtnl_link *request = NULL;
+    int ret;
+
+    if (dev == NULL)
+        return 1;
+
+    if ((handle = nl_handle_alloc()) == NULL)
+        return 1;
+
+    if (nl_connect(handle, NETLINK_ROUTE)) {
+        nl_handle_destroy(handle);
+        return 1;
+    }
+
+    if ((cache = rtnl_link_alloc_cache(handle)) == NULL) {
+        nl_close(handle);
+        nl_handle_destroy(handle);
+        return 1;
+    }
+
+    if ((link = rtnl_link_get_by_name(cache, dev)) == NULL) {
+        nl_cache_free(cache);
+        nl_close(handle);
+        nl_handle_destroy(handle);
+        return 1;
+    }
+
+    request = rtnl_link_alloc();
+    rtnl_link_set_flags(request, rtnl_link_str2flags("up"));
+
+    ret = rtnl_link_change(handle, link, request, 0);
+
+    rtnl_link_put(link);
+    rtnl_link_put(request);
+    nl_cache_free(cache);
+    nl_close(handle);
+    nl_handle_destroy(handle);
+
+    return ret;
+}
+
 static char *dhclientLeaseLineParse(char *linebuf, char *key) {
     char *b = NULL, *e = NULL;
 
@@ -396,6 +441,11 @@ int nashNetworkCommand(char * cmd) {
     if (dns || nameserver)
         writeResolvConf(dns, nameserver, domain);
 
+    if (nashSetUp(dev)) {
+        eprintf("ERROR: Could not bring interface %s up\n", dev);
+        return 1;
+    }
+
     if ((bootProto != NULL) && (!strncmp(bootProto, "dhcp", 4))) {
         nashLogger(_nash_context, NASH_NOTICE, "Sending request for IP information through %s\n", dev);
 
_______________________________________________
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