ifnet: fix memory leak; handle file format changes
This commit is contained in:
@@ -21,11 +21,10 @@ libnm_settings_plugin_ifnet_la_CPPFLAGS = \
|
|||||||
$(DBUS_CFLAGS) \
|
$(DBUS_CFLAGS) \
|
||||||
$(GUDEV_CFLAGS) \
|
$(GUDEV_CFLAGS) \
|
||||||
-DG_DISABLE_DEPRECATED \
|
-DG_DISABLE_DEPRECATED \
|
||||||
-DSYSCONFDIR=\"$(sysconfdir)\"\
|
-DSYSCONFDIR=\"$(sysconfdir)\"
|
||||||
-g
|
|
||||||
|
|
||||||
|
|
||||||
libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version
|
libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
||||||
libnm_settings_plugin_ifnet_la_LIBADD = \
|
libnm_settings_plugin_ifnet_la_LIBADD = \
|
||||||
$(top_builddir)/libnm-util/libnm-util.la \
|
$(top_builddir)/libnm-util/libnm-util.la \
|
||||||
$(top_builddir)/libnm-glib/libnm-glib.la \
|
$(top_builddir)/libnm-glib/libnm-glib.la \
|
||||||
@@ -50,12 +49,9 @@ lib_ifnet_io_la_CPPFLAGS = \
|
|||||||
$(DBUS_CFLAGS) \
|
$(DBUS_CFLAGS) \
|
||||||
-DG_DISABLE_DEPRECATED \
|
-DG_DISABLE_DEPRECATED \
|
||||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||||
-DSBINDIR=\"$(sbindir)\"\
|
-DSBINDIR=\"$(sbindir)\"
|
||||||
-g
|
|
||||||
|
|
||||||
lib_ifnet_io_la_LIBADD = \
|
lib_ifnet_io_la_LIBADD = \
|
||||||
$(top_builddir)/libnm-util/libnm-util.la \
|
$(top_builddir)/libnm-util/libnm-util.la \
|
||||||
$(GLIB_LIBS)\
|
$(GLIB_LIBS)\
|
||||||
$(GIO_LIBS)
|
$(GIO_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
* Copyright (C) 1999-2010 Gentoo Foundation, Inc.
|
* Copyright (C) 1999-2010 Gentoo Foundation, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -194,6 +193,32 @@ ifnet_plugin_error_quark (void)
|
|||||||
return error_quark;
|
return error_quark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
find_default_gateway_str (char *str)
|
||||||
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
if ((tmp = strstr (str, "default via ")) != NULL) {
|
||||||
|
return tmp + strlen ("default via ");
|
||||||
|
} else if ((tmp = strstr (str, "default gw ")) != NULL) {
|
||||||
|
return tmp + strlen ("default gw ");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
find_gateway_str (char *str)
|
||||||
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
if ((tmp = strstr (str, "via ")) != NULL) {
|
||||||
|
return tmp + strlen ("via ");
|
||||||
|
} else if ((tmp = strstr (str, "gw ")) != NULL) {
|
||||||
|
return tmp + strlen ("gw ");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
reload_parsers ()
|
reload_parsers ()
|
||||||
{
|
{
|
||||||
@@ -362,11 +387,10 @@ has_default_route (gchar * conn_name, gboolean (*check_fn) (gchar *))
|
|||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
routes = g_strdup (tmp);
|
routes = g_strdup (tmp);
|
||||||
tmp = strstr (routes, "default via ");
|
tmp = find_default_gateway_str (routes);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
tmp += strlen ("default via ");
|
|
||||||
g_strstrip (tmp);
|
g_strstrip (tmp);
|
||||||
if ((end = strstr (tmp, "\"")) != NULL)
|
if ((end = strstr (tmp, "\"")) != NULL)
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
@@ -483,8 +507,13 @@ get_ip4_gateway (gchar * gateway)
|
|||||||
|
|
||||||
if (!gateway)
|
if (!gateway)
|
||||||
return 0;
|
return 0;
|
||||||
tmp = strstr (gateway, "via ");
|
tmp = find_gateway_str (gateway);
|
||||||
tmp = g_strdup (tmp + strlen ("via "));
|
if (!tmp) {
|
||||||
|
PLUGIN_WARN (IFNET_PLUGIN_NAME,
|
||||||
|
"Couldn't obtain gateway in \"%s\"", gateway);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
tmp = g_strdup (tmp);
|
||||||
strip_string (tmp, ' ');
|
strip_string (tmp, ' ');
|
||||||
strip_string (tmp, '"');
|
strip_string (tmp, '"');
|
||||||
if ((split = strstr (tmp, "\"")) != NULL)
|
if ((split = strstr (tmp, "\"")) != NULL)
|
||||||
@@ -509,8 +538,13 @@ get_ip6_next_hop (gchar * next_hop)
|
|||||||
|
|
||||||
if (!next_hop)
|
if (!next_hop)
|
||||||
return 0;
|
return 0;
|
||||||
tmp = strstr (next_hop, "via ");
|
tmp = find_gateway_str (next_hop);
|
||||||
tmp = g_strdup (tmp + strlen ("via "));
|
if (!tmp) {
|
||||||
|
PLUGIN_WARN (IFNET_PLUGIN_NAME,
|
||||||
|
"Couldn't obtain next_hop in \"%s\"", next_hop);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
tmp = g_strdup (tmp);
|
||||||
strip_string (tmp, ' ');
|
strip_string (tmp, ' ');
|
||||||
strip_string (tmp, '"');
|
strip_string (tmp, '"');
|
||||||
g_strstrip (tmp);
|
g_strstrip (tmp);
|
||||||
@@ -671,8 +705,8 @@ convert_ip4_routes_block (gchar * conn_name)
|
|||||||
length = g_strv_length (ipset);
|
length = g_strv_length (ipset);
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
ip = ipset[i];
|
ip = ipset[i];
|
||||||
if (strstr (ip, "default via ") || strstr (ip, "::")
|
if (find_default_gateway_str (ip) || strstr (ip, "::")
|
||||||
|| !strstr (ip, "via"))
|
|| !find_gateway_str (ip))
|
||||||
continue;
|
continue;
|
||||||
ip = strip_string (ip, '"');
|
ip = strip_string (ip, '"');
|
||||||
iblock = create_ip4_block (ip);
|
iblock = create_ip4_block (ip);
|
||||||
@@ -712,9 +746,7 @@ convert_ip6_routes_block (gchar * conn_name)
|
|||||||
ip = strip_string (ip, '"');
|
ip = strip_string (ip, '"');
|
||||||
if (ip[0] == '\0')
|
if (ip[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
printf ("ip:%s\n", ip);
|
if ((tmp_addr = find_default_gateway_str (ip)) != NULL) {
|
||||||
if ((tmp_addr = strstr (ip, "default via ")) != NULL) {
|
|
||||||
tmp_addr += strlen ("default via ");
|
|
||||||
if (!is_ip6_address (tmp_addr))
|
if (!is_ip6_address (tmp_addr))
|
||||||
continue;
|
continue;
|
||||||
else {
|
else {
|
||||||
@@ -855,7 +887,7 @@ is_managed (gchar * conn_name)
|
|||||||
void
|
void
|
||||||
get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
|
get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
|
||||||
{
|
{
|
||||||
gchar *dhcp_client = ifnet_get_global_setting ("main", "dhcp");
|
gchar *dhcp_client = NULL;
|
||||||
const gchar *dhcpcd_conf = "/etc/dhcpcd.conf";
|
const gchar *dhcpcd_conf = "/etc/dhcpcd.conf";
|
||||||
const gchar *dhclient_conf = "/etc/dhcp/dhclient.conf";
|
const gchar *dhclient_conf = "/etc/dhcp/dhclient.conf";
|
||||||
gchar *line = NULL, *tmp = NULL, *contents = NULL;
|
gchar *line = NULL, *tmp = NULL, *contents = NULL;
|
||||||
@@ -864,6 +896,7 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
|
|||||||
|
|
||||||
*hostname = NULL;
|
*hostname = NULL;
|
||||||
*client_id = NULL;
|
*client_id = NULL;
|
||||||
|
dhcp_client = ifnet_get_global_setting ("main", "dhcp");
|
||||||
if (dhcp_client) {
|
if (dhcp_client) {
|
||||||
if (!strcmp (dhcp_client, "dhclient"))
|
if (!strcmp (dhcp_client, "dhclient"))
|
||||||
g_file_get_contents (dhclient_conf, &contents, NULL,
|
g_file_get_contents (dhclient_conf, &contents, NULL,
|
||||||
@@ -871,6 +904,7 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
|
|||||||
else if (!strcmp (dhcp_client, "dhcpcd"))
|
else if (!strcmp (dhcp_client, "dhcpcd"))
|
||||||
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (dhcp_client);
|
||||||
} else {
|
} else {
|
||||||
if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR))
|
if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR))
|
||||||
g_file_get_contents (dhclient_conf, &contents, NULL,
|
g_file_get_contents (dhclient_conf, &contents, NULL,
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#include "connection_parser.h"
|
#include "connection_parser.h"
|
||||||
|
|
||||||
#define IFNET_PLUGIN_NAME_PRINT "ifnet"
|
#define IFNET_PLUGIN_NAME_PRINT "ifnet"
|
||||||
#define IFNET_PLUGIN_INFO "(C) 1999-2010 Gentoo Foundation, Inc. To report bugs please use bugs.gentoo.org with [networkmanager] or [dagger] prefix."
|
#define IFNET_PLUGIN_INFO "(C) 1999-2010 Gentoo Foundation, Inc. To report bugs please use bugs.gentoo.org with [networkmanager] or [qiaomuf] prefix."
|
||||||
#define IFNET_SYSTEM_HOSTNAME_FILE "/etc/conf.d/hostname"
|
#define IFNET_SYSTEM_HOSTNAME_FILE "/etc/conf.d/hostname"
|
||||||
#define IFNET_MANAGE_WELL_KNOWN_DEFAULT TRUE
|
#define IFNET_MANAGE_WELL_KNOWN_DEFAULT TRUE
|
||||||
#define IFNET_KEY_FILE_KEY_MANAGED "managed"
|
#define IFNET_KEY_FILE_KEY_MANAGED "managed"
|
||||||
|
@@ -6,8 +6,7 @@ INCLUDES=-I$(top_srcdir)/system-settings/plugins/ifnet\
|
|||||||
TESTS = check_ifnet
|
TESTS = check_ifnet
|
||||||
check_PROGRAMS = check_ifnet
|
check_PROGRAMS = check_ifnet
|
||||||
check_ifnet_SOURCES = test_all.c
|
check_ifnet_SOURCES = test_all.c
|
||||||
check_ifnet_LDFLAGS = -g
|
check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS)
|
||||||
check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) -g
|
|
||||||
check_ifnet_LDADD = $(top_srcdir)/libnm-util/libnm-util.la\
|
check_ifnet_LDADD = $(top_srcdir)/libnm-util/libnm-util.la\
|
||||||
$(top_srcdir)/system-settings/plugins/ifnet/lib-ifnet-io.la\
|
$(top_srcdir)/system-settings/plugins/ifnet/lib-ifnet-io.la\
|
||||||
$(CHECK_LIBS)\
|
$(CHECK_LIBS)\
|
||||||
|
@@ -58,17 +58,22 @@ test_read_hostname ()
|
|||||||
"get hostname",
|
"get hostname",
|
||||||
"hostname is not correctly read, read:%s, expected: gentoo",
|
"hostname is not correctly read, read:%s, expected: gentoo",
|
||||||
hostname);
|
hostname);
|
||||||
|
g_free (hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_write_hostname ()
|
test_write_hostname ()
|
||||||
{
|
{
|
||||||
gchar *hostname = read_hostname ("hostname");
|
gchar *hostname = read_hostname ("hostname");
|
||||||
|
gchar *tmp;
|
||||||
|
|
||||||
write_hostname ("gentoo-nm", "hostname");
|
write_hostname ("gentoo-nm", "hostname");
|
||||||
ASSERT (strcmp (read_hostname ("hostname"), "gentoo-nm") == 0,
|
tmp = read_hostname ("hostname");
|
||||||
|
ASSERT (strcmp (tmp, "gentoo-nm") == 0,
|
||||||
"write hostname", "write hostname error");
|
"write hostname", "write hostname error");
|
||||||
write_hostname (hostname, "hostname");
|
write_hostname (hostname, "hostname");
|
||||||
|
g_free (tmp);
|
||||||
|
g_free (hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -85,14 +90,13 @@ test_is_static ()
|
|||||||
static void
|
static void
|
||||||
test_has_default_route ()
|
test_has_default_route ()
|
||||||
{
|
{
|
||||||
ASSERT (has_default_ip4_route ("eth0"), "has default route",
|
ASSERT (has_default_ip4_route ("eth0"),
|
||||||
"eth0 should have a default ipv4 route");
|
"has default route", "eth0 should have a default ipv4 route");
|
||||||
ASSERT (has_default_ip6_route ("eth4"), "has default route",
|
ASSERT (has_default_ip6_route ("eth4"),
|
||||||
"eth4 should have a default ipv6 route");
|
"has default route", "eth4 should have a default ipv6 route");
|
||||||
|
|
||||||
ASSERT (!has_default_ip4_route ("eth5")
|
ASSERT (!has_default_ip4_route ("eth5")
|
||||||
&& !has_default_ip6_route ("eth5"), "has default route",
|
&& !has_default_ip6_route ("eth5"),
|
||||||
"eth5 shouldn't have a default route");
|
"has default route", "eth5 shouldn't have a default route");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -138,8 +142,8 @@ check_ip_block (ip_block * iblock, gchar * ip, gchar * netmask, gchar * gateway)
|
|||||||
str = malloc (INET_ADDRSTRLEN);
|
str = malloc (INET_ADDRSTRLEN);
|
||||||
tmp_ip4_addr.s_addr = iblock->ip;
|
tmp_ip4_addr.s_addr = iblock->ip;
|
||||||
inet_ntop (AF_INET, &tmp_ip4_addr, str, INET_ADDRSTRLEN);
|
inet_ntop (AF_INET, &tmp_ip4_addr, str, INET_ADDRSTRLEN);
|
||||||
ASSERT (strcmp (ip, str) == 0, "check ip", "ip expected:%s, find:%s",
|
ASSERT (strcmp (ip, str) == 0, "check ip",
|
||||||
ip, str);
|
"ip expected:%s, find:%s", ip, str);
|
||||||
tmp_ip4_addr.s_addr = iblock->netmask;
|
tmp_ip4_addr.s_addr = iblock->netmask;
|
||||||
inet_ntop (AF_INET, &tmp_ip4_addr, str, INET_ADDRSTRLEN);
|
inet_ntop (AF_INET, &tmp_ip4_addr, str, INET_ADDRSTRLEN);
|
||||||
ASSERT (strcmp (netmask, str) == 0, "check netmask",
|
ASSERT (strcmp (netmask, str) == 0, "check netmask",
|
||||||
@@ -170,8 +174,8 @@ test_convert_ipv4_config_block ()
|
|||||||
destroy_ip_block (iblock);
|
destroy_ip_block (iblock);
|
||||||
iblock = convert_ip4_config_block ("eth2");
|
iblock = convert_ip4_config_block ("eth2");
|
||||||
ASSERT (iblock != NULL
|
ASSERT (iblock != NULL
|
||||||
&& iblock->next == NULL, "convert error IPv4 address",
|
&& iblock->next == NULL,
|
||||||
"should only get one address");
|
"convert error IPv4 address", "should only get one address");
|
||||||
check_ip_block (iblock, "192.168.4.121", "255.255.255.0", "0.0.0.0");
|
check_ip_block (iblock, "192.168.4.121", "255.255.255.0", "0.0.0.0");
|
||||||
destroy_ip_block (iblock);
|
destroy_ip_block (iblock);
|
||||||
iblock = convert_ip4_config_block ("eth3");
|
iblock = convert_ip4_config_block ("eth3");
|
||||||
@@ -182,7 +186,6 @@ test_convert_ipv4_config_block ()
|
|||||||
ASSERT (iblock != NULL, "convert config_block",
|
ASSERT (iblock != NULL, "convert config_block",
|
||||||
"convert error configuration");
|
"convert error configuration");
|
||||||
destroy_ip_block (iblock);
|
destroy_ip_block (iblock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -209,10 +212,13 @@ test_wpa_parser ()
|
|||||||
ASSERT (exist_ssid ("static-wep-test"), "exist_ssid",
|
ASSERT (exist_ssid ("static-wep-test"), "exist_ssid",
|
||||||
"ssid static-wep-test is not found");
|
"ssid static-wep-test is not found");
|
||||||
value = wpa_get_value ("static-wep-test", "key_mgmt");
|
value = wpa_get_value ("static-wep-test", "key_mgmt");
|
||||||
ASSERT (value && strcmp (value, "NONE") == 0, "get wpa data",
|
ASSERT (value
|
||||||
|
&& strcmp (value, "NONE") == 0, "get wpa data",
|
||||||
"key_mgmt of static-wep-test should be NONE, find %s", value);
|
"key_mgmt of static-wep-test should be NONE, find %s", value);
|
||||||
value = wpa_get_value ("static-wep-test", "wep_key0");
|
value = wpa_get_value ("static-wep-test", "wep_key0");
|
||||||
ASSERT (value && strcmp (value, "\"abcde\"") == 0, "get wpa data",
|
ASSERT (value
|
||||||
|
&& strcmp (value, "\"abcde\"") == 0,
|
||||||
|
"get wpa data",
|
||||||
"wep_key0 of static-wep-test should be abcde, find %s", value);
|
"wep_key0 of static-wep-test should be abcde, find %s", value);
|
||||||
ASSERT (exist_ssid ("leap-example"), "get wsec",
|
ASSERT (exist_ssid ("leap-example"), "get wsec",
|
||||||
"ssid leap-example is not found");
|
"ssid leap-example is not found");
|
||||||
@@ -228,8 +234,9 @@ test_strip_string ()
|
|||||||
result = strip_string (result, '(');
|
result = strip_string (result, '(');
|
||||||
result = strip_string (result, ')');
|
result = strip_string (result, ')');
|
||||||
result = strip_string (result, '"');
|
result = strip_string (result, '"');
|
||||||
ASSERT (strcmp (result, "default via 202.117.16.1") == 0,
|
ASSERT (strcmp (result, "default via 202.117.16.1") ==
|
||||||
"strip_string", "string isn't stripped, result is: %s", result);
|
0, "strip_string",
|
||||||
|
"string isn't stripped, result is: %s", result);
|
||||||
g_free (result_b);
|
g_free (result_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +272,6 @@ test_new_connection ()
|
|||||||
"new connection failed: %s", error
|
"new connection failed: %s", error
|
||||||
&& (*error) ? (*error)->message : "NONE");
|
&& (*error) ? (*error)->message : "NONE");
|
||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -280,8 +286,9 @@ test_update_connection ()
|
|||||||
error == NULL ? "None" : (*error)->message);
|
error == NULL ? "None" : (*error)->message);
|
||||||
ASSERT (ifnet_update_parsers_by_connection
|
ASSERT (ifnet_update_parsers_by_connection
|
||||||
(connection, "eth0", NULL, "net.generate",
|
(connection, "eth0", NULL, "net.generate",
|
||||||
"wpa_supplicant.conf.generate", error), "update connection",
|
"wpa_supplicant.conf.generate", error),
|
||||||
"update connection failed %s", "eth0");
|
"update connection", "update connection failed %s", "eth0");
|
||||||
|
g_object_unref (connection);
|
||||||
connection =
|
connection =
|
||||||
ifnet_update_connection_from_config_block ("0xab3ace", error);
|
ifnet_update_connection_from_config_block ("0xab3ace", error);
|
||||||
ASSERT (connection != NULL, "get connection",
|
ASSERT (connection != NULL, "get connection",
|
||||||
@@ -289,8 +296,9 @@ test_update_connection ()
|
|||||||
error == NULL ? "None" : (*error)->message);
|
error == NULL ? "None" : (*error)->message);
|
||||||
ASSERT (ifnet_update_parsers_by_connection
|
ASSERT (ifnet_update_parsers_by_connection
|
||||||
(connection, "0xab3ace", NULL, "net.generate",
|
(connection, "0xab3ace", NULL, "net.generate",
|
||||||
"wpa_supplicant.conf.generate", error), "update connection",
|
"wpa_supplicant.conf.generate", error),
|
||||||
"update connection failed %s", "0xab3ace");
|
"update connection", "update connection failed %s", "0xab3ace");
|
||||||
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -301,14 +309,17 @@ test_add_connection ()
|
|||||||
|
|
||||||
connection = ifnet_update_connection_from_config_block ("eth0", error);
|
connection = ifnet_update_connection_from_config_block ("eth0", error);
|
||||||
ASSERT (ifnet_add_new_connection
|
ASSERT (ifnet_add_new_connection
|
||||||
(connection, "net.generate", "wpa_supplicant.conf.generate",
|
(connection, "net.generate",
|
||||||
error), "add connection", "add connection failed: %s", "eth0");
|
"wpa_supplicant.conf.generate", error),
|
||||||
|
"add connection", "add connection failed: %s", "eth0");
|
||||||
|
g_object_unref (connection);
|
||||||
connection =
|
connection =
|
||||||
ifnet_update_connection_from_config_block ("myxjtu2", error);
|
ifnet_update_connection_from_config_block ("myxjtu2", error);
|
||||||
ASSERT (ifnet_add_new_connection
|
ASSERT (ifnet_add_new_connection
|
||||||
(connection, "net.generate", "wpa_supplicant.conf.generate",
|
(connection, "net.generate",
|
||||||
error), "add connection", "add connection failed: %s",
|
"wpa_supplicant.conf.generate", error),
|
||||||
"myxjtu2");
|
"add connection", "add connection failed: %s", "myxjtu2");
|
||||||
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -322,16 +333,20 @@ test_delete_connection ()
|
|||||||
"get connection failed: %s",
|
"get connection failed: %s",
|
||||||
error == NULL ? "None" : (*error)->message);
|
error == NULL ? "None" : (*error)->message);
|
||||||
ASSERT (ifnet_delete_connection_in_parsers
|
ASSERT (ifnet_delete_connection_in_parsers
|
||||||
("eth7", "net.generate", "wpa_supplicant.conf.generate"),
|
("eth7", "net.generate",
|
||||||
|
"wpa_supplicant.conf.generate"),
|
||||||
"delete connection", "delete connection failed: %s", "eth7");
|
"delete connection", "delete connection failed: %s", "eth7");
|
||||||
|
g_object_unref (connection);
|
||||||
connection =
|
connection =
|
||||||
ifnet_update_connection_from_config_block ("qiaomuf", error);
|
ifnet_update_connection_from_config_block ("qiaomuf", error);
|
||||||
ASSERT (connection != NULL, "get connection",
|
ASSERT (connection != NULL, "get connection",
|
||||||
"get connection failed: %s",
|
"get connection failed: %s",
|
||||||
error == NULL ? "None" : (*error)->message);
|
error == NULL ? "None" : (*error)->message);
|
||||||
ASSERT (ifnet_delete_connection_in_parsers
|
ASSERT (ifnet_delete_connection_in_parsers
|
||||||
("qiaomuf", "net.generate", "wpa_supplicant.conf.generate"),
|
("qiaomuf", "net.generate",
|
||||||
|
"wpa_supplicant.conf.generate"),
|
||||||
"delete connection", "delete connection failed: %s", "qiaomuf");
|
"delete connection", "delete connection failed: %s", "qiaomuf");
|
||||||
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -369,10 +384,8 @@ main (void)
|
|||||||
wpa_parser_destroy ();
|
wpa_parser_destroy ();
|
||||||
ifnet_init ("net");
|
ifnet_init ("net");
|
||||||
wpa_parser_init ("wpa_supplicant.conf");
|
wpa_parser_init ("wpa_supplicant.conf");
|
||||||
printf("Initialization complete\n");
|
printf ("Initialization complete\n");
|
||||||
|
|
||||||
run_all (TRUE);
|
run_all (TRUE);
|
||||||
|
|
||||||
ifnet_destroy ();
|
ifnet_destroy ();
|
||||||
wpa_parser_destroy ();
|
wpa_parser_destroy ();
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user