/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Aug 23 23:17:09 2011 UTC (3 years, 4 months ago) by nirbheek
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Bump for the 0.9.0 release, go forth and test. Also, remove old ebuilds and unused patches.

(Portage version: 2.2.0_alpha51/cvs/Linux x86_64)

1 --- NetworkManager_Patched/system-settings/plugins/ifnet/net_utils.c 2010-11-04 04:10:52.000000000 +0800
2 +++ NetworkManager-0.8.2/system-settings/plugins/ifnet/net_utils.c 2010-11-23 15:11:08.024000011 +0800
3 @@ -19,7 +19,6 @@
4 * Copyright (C) 1999-2010 Gentoo Foundation, Inc.
5 */
6
7 -#include <config.h>
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <string.h>
11 @@ -194,6 +193,32 @@
12 return error_quark;
13 }
14
15 +static char *
16 +find_default_gateway_str (char *str)
17 +{
18 + char *tmp;
19 +
20 + if ((tmp = strstr (str, "default via ")) != NULL) {
21 + return tmp + strlen ("default via ");
22 + } else if ((tmp = strstr (str, "default gw ")) != NULL) {
23 + return tmp + strlen ("default gw ");
24 + }
25 + return NULL;
26 +}
27 +
28 +static char *
29 +find_gateway_str (char *str)
30 +{
31 + char *tmp;
32 +
33 + if ((tmp = strstr (str, "via ")) != NULL) {
34 + return tmp + strlen ("via ");
35 + } else if ((tmp = strstr (str, "gw ")) != NULL) {
36 + return tmp + strlen ("gw ");
37 + }
38 + return NULL;
39 +}
40 +
41 gboolean
42 reload_parsers ()
43 {
44 @@ -362,11 +387,10 @@
45 if (!tmp)
46 return FALSE;
47 routes = g_strdup (tmp);
48 - tmp = strstr (routes, "default via ");
49 + tmp = find_default_gateway_str (routes);
50 if (!tmp) {
51 goto error;
52 }
53 - tmp += strlen ("default via ");
54 g_strstrip (tmp);
55 if ((end = strstr (tmp, "\"")) != NULL)
56 *end = '\0';
57 @@ -483,8 +507,13 @@
58
59 if (!gateway)
60 return 0;
61 - tmp = strstr (gateway, "via ");
62 - tmp = g_strdup (tmp + strlen ("via "));
63 + tmp = find_gateway_str(gateway);
64 + if (!tmp) {
65 + PLUGIN_WARN (IFNET_PLUGIN_NAME,
66 + "Couldn't obtain gateway in \"%s\"", gateway);
67 + return 0;
68 + }
69 + tmp = g_strdup (tmp);
70 strip_string (tmp, ' ');
71 strip_string (tmp, '"');
72 if ((split = strstr (tmp, "\"")) != NULL)
73 @@ -509,8 +538,13 @@
74
75 if (!next_hop)
76 return 0;
77 - tmp = strstr (next_hop, "via ");
78 - tmp = g_strdup (tmp + strlen ("via "));
79 + tmp = find_gateway_str(next_hop);
80 + if (!tmp) {
81 + PLUGIN_WARN (IFNET_PLUGIN_NAME,
82 + "Couldn't obtain next_hop in \"%s\"", next_hop);
83 + return 0;
84 + }
85 + tmp = g_strdup (tmp);
86 strip_string (tmp, ' ');
87 strip_string (tmp, '"');
88 g_strstrip (tmp);
89 @@ -671,8 +705,8 @@
90 length = g_strv_length (ipset);
91 for (i = 0; i < length; i++) {
92 ip = ipset[i];
93 - if (strstr (ip, "default via ") || strstr (ip, "::")
94 - || !strstr (ip, "via"))
95 + if (find_default_gateway_str (ip) || strstr (ip, "::")
96 + || !find_gateway_str (ip))
97 continue;
98 ip = strip_string (ip, '"');
99 iblock = create_ip4_block (ip);
100 @@ -712,9 +746,7 @@
101 ip = strip_string (ip, '"');
102 if (ip[0] == '\0')
103 continue;
104 - printf ("ip:%s\n", ip);
105 - if ((tmp_addr = strstr (ip, "default via ")) != NULL) {
106 - tmp_addr += strlen ("default via ");
107 + if ((tmp_addr = find_default_gateway_str (ip)) != NULL) {
108 if (!is_ip6_address (tmp_addr))
109 continue;
110 else {
111 @@ -855,7 +887,7 @@
112 void
113 get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
114 {
115 - gchar *dhcp_client = ifnet_get_global_setting ("main", "dhcp");
116 + gchar *dhcp_client = NULL;
117 const gchar *dhcpcd_conf = "/etc/dhcpcd.conf";
118 const gchar *dhclient_conf = "/etc/dhcp/dhclient.conf";
119 gchar *line = NULL, *tmp = NULL, *contents = NULL;
120 @@ -864,6 +896,7 @@
121
122 *hostname = NULL;
123 *client_id = NULL;
124 + dhcp_client = ifnet_get_global_setting ("main", "dhcp");
125 if (dhcp_client) {
126 if (!strcmp (dhcp_client, "dhclient"))
127 g_file_get_contents (dhclient_conf, &contents, NULL,
128 @@ -871,6 +904,7 @@
129 else if (!strcmp (dhcp_client, "dhcpcd"))
130 g_file_get_contents (dhcpcd_conf, &contents, NULL,
131 NULL);
132 + g_free (dhcp_client);
133 } else {
134 if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR))
135 g_file_get_contents (dhclient_conf, &contents, NULL,

  ViewVC Help
Powered by ViewVC 1.1.20