core: use nm_utils_modprobe()

https://bugzilla.gnome.org/show_bug.cgi?id=740651
This commit is contained in:
Thomas Haller
2015-01-09 11:49:25 +01:00
committed by Dan Williams
parent 4ad6099b01
commit 32625f604b
3 changed files with 4 additions and 20 deletions

View File

@@ -4934,7 +4934,6 @@ nm_device_activate_schedule_ip6_config_timeout (NMDevice *self)
static gboolean static gboolean
share_init (void) share_init (void)
{ {
int status;
char *modules[] = { "ip_tables", "iptable_nat", "nf_nat_ftp", "nf_nat_irc", char *modules[] = { "ip_tables", "iptable_nat", "nf_nat_ftp", "nf_nat_irc",
"nf_nat_sip", "nf_nat_tftp", "nf_nat_pptp", "nf_nat_h323", "nf_nat_sip", "nf_nat_tftp", "nf_nat_pptp", "nf_nat_h323",
NULL }; NULL };
@@ -4954,20 +4953,8 @@ share_init (void)
errsv, strerror (errsv)); errsv, strerror (errsv));
} }
for (iter = modules; *iter; iter++) { for (iter = modules; *iter; iter++)
char *argv[3] = { "/sbin/modprobe", *iter, NULL }; nm_utils_modprobe (NULL, *iter, NULL);
char *envp[1] = { NULL };
GError *error = NULL;
if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL, NULL, NULL, &status, &error)) {
nm_log_err (LOGD_SHARING, "share: error loading NAT module %s: (%d) %s",
*iter, error ? error->code : 0,
(error && error->message) ? error->message : "unknown");
if (error)
g_error_free (error);
}
}
return TRUE; return TRUE;
} }

View File

@@ -2267,7 +2267,6 @@ build_rtnl_link (int ifindex, const char *name, NMLinkType type)
static gboolean static gboolean
link_add (NMPlatform *platform, const char *name, NMLinkType type, const void *address, size_t address_len) link_add (NMPlatform *platform, const char *name, NMLinkType type, const void *address, size_t address_len)
{ {
int r;
struct nl_object *l; struct nl_object *l;
if (type == NM_LINK_TYPE_BOND) { if (type == NM_LINK_TYPE_BOND) {
@@ -2279,8 +2278,7 @@ link_add (NMPlatform *platform, const char *name, NMLinkType type, const void *a
* bond0 automatically. * bond0 automatically.
*/ */
if (!g_file_test ("/sys/class/net/bonding_masters", G_FILE_TEST_EXISTS)) if (!g_file_test ("/sys/class/net/bonding_masters", G_FILE_TEST_EXISTS))
/* Ignore return value to shut up the compiler */ nm_utils_modprobe (NULL, "bonding", "max_bonds=0", NULL);
r = system ("modprobe bonding max_bonds=0");
} }
debug ("link: add link '%s' of type '%s' (%d)", debug ("link: add link '%s' of type '%s' (%d)",

View File

@@ -1068,7 +1068,6 @@ nm_ppp_manager_start (NMPPPManager *manager,
NMCmdLine *ppp_cmd; NMCmdLine *ppp_cmd;
char *cmd_str; char *cmd_str;
struct stat st; struct stat st;
int ignored;
g_return_val_if_fail (NM_IS_PPP_MANAGER (manager), FALSE); g_return_val_if_fail (NM_IS_PPP_MANAGER (manager), FALSE);
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
@@ -1088,7 +1087,7 @@ nm_ppp_manager_start (NMPPPManager *manager,
/* Make sure /dev/ppp exists (bgo #533064) */ /* Make sure /dev/ppp exists (bgo #533064) */
if (stat ("/dev/ppp", &st) || !S_ISCHR (st.st_mode)) if (stat ("/dev/ppp", &st) || !S_ISCHR (st.st_mode))
ignored = system ("/sbin/modprobe ppp_generic"); nm_utils_modprobe (NULL, "ppp_generic", NULL);
connection = nm_act_request_get_connection (req); connection = nm_act_request_get_connection (req);
g_assert (connection); g_assert (connection);