diff options
author | Luis Medinas <metalgod@gentoo.org> | 2006-11-26 06:40:36 +0000 |
---|---|---|
committer | Luis Medinas <metalgod@gentoo.org> | 2006-11-26 06:40:36 +0000 |
commit | dd8f49a7ac7c539eab6203b6fda3ee7a6c63ed52 (patch) | |
tree | 703a0d8cd99bf89d64adcbcd05e3b0fa15d8ace4 /net-misc | |
parent | Handle package.use.mask (#154628) and read /etc/portage/profile (#156191) (diff) | |
download | historical-dd8f49a7ac7c539eab6203b6fda3ee7a6c63ed52.tar.gz historical-dd8f49a7ac7c539eab6203b6fda3ee7a6c63ed52.tar.bz2 historical-dd8f49a7ac7c539eab6203b6fda3ee7a6c63ed52.zip |
Added a patch with Gentoo backend updated done by Nathan Caldwell <saintdev@gmail.com>. Please test the backend and report any bug.
Package-Manager: portage-2.1.2_rc2-r2
Diffstat (limited to 'net-misc')
5 files changed, 773 insertions, 8 deletions
diff --git a/net-misc/networkmanager/ChangeLog b/net-misc/networkmanager/ChangeLog index dd4e1bf4a801..1c146b11341f 100644 --- a/net-misc/networkmanager/ChangeLog +++ b/net-misc/networkmanager/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-misc/networkmanager # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.3 2006/11/10 01:14:49 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.4 2006/11/26 06:40:36 metalgod Exp $ + +*networkmanager-0.6.4_pre20061028-r1 (26 Nov 2006) + + 26 Nov 2006; Luis Medinas <metalgod@gentoo.org> + +files/networkmanager-updatedbackend.patch, + +networkmanager-0.6.4_pre20061028-r1.ebuild: + Added a patch with Gentoo backend updated done by Nathan Caldwell + <saintdev@gmail.com>. Please test the backend and report any bug. 05 Nov 2006; Steev Klimaszewski <steev@gentoo.org> networkmanager-0.6.4_pre20061028.ebuild: diff --git a/net-misc/networkmanager/Manifest b/net-misc/networkmanager/Manifest index f86c4c4d4dcf..f62ff2c8c1eb 100644 --- a/net-misc/networkmanager/Manifest +++ b/net-misc/networkmanager/Manifest @@ -17,19 +17,27 @@ AUX networkmanager-resolvconf-perms.patch 532 RMD160 453ce19560e1872d1da1fa48e0c MD5 785dfadfffc8dc7119ea16c1ba3aa6d9 files/networkmanager-resolvconf-perms.patch 532 RMD160 453ce19560e1872d1da1fa48e0c9a365025e6b1b files/networkmanager-resolvconf-perms.patch 532 SHA256 e1786f34a75d2e0a27ceccb960cf975176260886f70cc3e9b172180f8a1d2e6e files/networkmanager-resolvconf-perms.patch 532 +AUX networkmanager-updatedbackend.patch 17700 RMD160 685132b4a98843416264f06c480ff205fa87f789 SHA1 a83d2b0ea7e4a563af3d14567ba1da3605fbf654 SHA256 ee4a1583db867fd6a1851a9dd243401166f29ee9d00ad6e03e5b677915e5bf43 +MD5 30c025bce7a637f37cb74ef44d848164 files/networkmanager-updatedbackend.patch 17700 +RMD160 685132b4a98843416264f06c480ff205fa87f789 files/networkmanager-updatedbackend.patch 17700 +SHA256 ee4a1583db867fd6a1851a9dd243401166f29ee9d00ad6e03e5b677915e5bf43 files/networkmanager-updatedbackend.patch 17700 AUX networkmanager-use-kernel-headers.patch 466 RMD160 cd16279966d4e3594a20aa0b89d08f3baa3c2e58 SHA1 a9e269c9021888ca058b9fb72f9a71dc25a7488b SHA256 952948f41676fafcf76210cbef46728cbb219d6c851d5417d892b984fd725402 MD5 e9879921dd5b0669337e27ca2196cfd4 files/networkmanager-use-kernel-headers.patch 466 RMD160 cd16279966d4e3594a20aa0b89d08f3baa3c2e58 files/networkmanager-use-kernel-headers.patch 466 SHA256 952948f41676fafcf76210cbef46728cbb219d6c851d5417d892b984fd725402 files/networkmanager-use-kernel-headers.patch 466 DIST NetworkManager-0.6.4_pre20061028.tar.bz2 1780993 RMD160 eef9c8fedaacba413b833b98ee56af5bd74ada2b SHA1 ddbdb4579908f2ce73ee9c6ce31b79fd4082e8a6 SHA256 4a7114367d0f14eeaee094e3c08bfb728a175fd23ac6b97a5868aa734011583c +EBUILD networkmanager-0.6.4_pre20061028-r1.ebuild 2612 RMD160 f43b36d49bb0b6a066216c542cd82088fcbd174b SHA1 e620b4955b0440cfe39e3c46f972cbca8e3b6d55 SHA256 80b70c0ccd2a58cce8cdfc3be9c378b4dfbd988986557d2c36d31ec61826f893 +MD5 29f63498103f038760b1133cab532ca5 networkmanager-0.6.4_pre20061028-r1.ebuild 2612 +RMD160 f43b36d49bb0b6a066216c542cd82088fcbd174b networkmanager-0.6.4_pre20061028-r1.ebuild 2612 +SHA256 80b70c0ccd2a58cce8cdfc3be9c378b4dfbd988986557d2c36d31ec61826f893 networkmanager-0.6.4_pre20061028-r1.ebuild 2612 EBUILD networkmanager-0.6.4_pre20061028.ebuild 2612 RMD160 b15a24544a4615070f4e5be2a70ec56616e27076 SHA1 646939b9209388bd48d0990b43c33399ef01a658 SHA256 e7939d1555baf444fe2cf61a3dec7295693fcb8834f603bd4ed7f90dab05ec3e MD5 9bb2f4e4ee5ef1942cf45412313b3fe5 networkmanager-0.6.4_pre20061028.ebuild 2612 RMD160 b15a24544a4615070f4e5be2a70ec56616e27076 networkmanager-0.6.4_pre20061028.ebuild 2612 SHA256 e7939d1555baf444fe2cf61a3dec7295693fcb8834f603bd4ed7f90dab05ec3e networkmanager-0.6.4_pre20061028.ebuild 2612 -MISC ChangeLog 1621 RMD160 b96a258a1b892a4dec7f4012efa860fe2e52ae6f SHA1 e32fb2187805123d4d17ba6d8d268451a6087dc9 SHA256 0a1b376a1b9083e76e254e3cb0fac6c8dda2a87fde31c3c42c84dac29d53b640 -MD5 581a3da3e4c4535eeef463504359e460 ChangeLog 1621 -RMD160 b96a258a1b892a4dec7f4012efa860fe2e52ae6f ChangeLog 1621 -SHA256 0a1b376a1b9083e76e254e3cb0fac6c8dda2a87fde31c3c42c84dac29d53b640 ChangeLog 1621 +MISC ChangeLog 1953 RMD160 3d1a054fca7661c2e3be9d95501fe8eafa0f6964 SHA1 673a505d47f18ef125f4e75ac51b5060517257bf SHA256 469727dc5562f45684fb500f89b3237a0e61dd7745f2e8820d8e35b7f6fb962b +MD5 91d818596f8da384f1395105a331b74f ChangeLog 1953 +RMD160 3d1a054fca7661c2e3be9d95501fe8eafa0f6964 ChangeLog 1953 +SHA256 469727dc5562f45684fb500f89b3237a0e61dd7745f2e8820d8e35b7f6fb962b ChangeLog 1953 MISC metadata.xml 382 RMD160 6502df804c9513d3b87069f5da390438254d794e SHA1 65051b628c33b7327089bb5893b0f49aafd4a1d1 SHA256 a9fca86b318190e2eaccf17e969626e2b9f71629c3e941e487520eda9b0801fc MD5 99b5f59e416ba77f0e3bc6b5ef912ec3 metadata.xml 382 RMD160 6502df804c9513d3b87069f5da390438254d794e metadata.xml 382 @@ -37,10 +45,13 @@ SHA256 a9fca86b318190e2eaccf17e969626e2b9f71629c3e941e487520eda9b0801fc metadata MD5 25e40b69e15e1d17224bf3a584bd3038 files/digest-networkmanager-0.6.4_pre20061028 304 RMD160 991b9fdcb07c2cc321db6e8c26cb5860b9905844 files/digest-networkmanager-0.6.4_pre20061028 304 SHA256 f06e1d714c3ceb634d637c0927c02176da3f4144d7fafb66ab646562102d43f7 files/digest-networkmanager-0.6.4_pre20061028 304 +MD5 25e40b69e15e1d17224bf3a584bd3038 files/digest-networkmanager-0.6.4_pre20061028-r1 304 +RMD160 991b9fdcb07c2cc321db6e8c26cb5860b9905844 files/digest-networkmanager-0.6.4_pre20061028-r1 304 +SHA256 f06e1d714c3ceb634d637c0927c02176da3f4144d7fafb66ab646562102d43f7 files/digest-networkmanager-0.6.4_pre20061028-r1 304 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) -iD8DBQFFU9KPI1lqEGTUzyQRAlMeAKCz2g704RaYB0k5gQEQAA51IuYzTQCgugIi -y6dT314bbOhC+96Q+nj42eM= -=Sqyb +iD8DBQFFaTcZwUpWvClEHQoRAtfcAJ9sWJLpB4oikokzZ0mlpb4Z6N/bmgCgg0qu +2KSf31MwDLeYOcqdp1KCwyQ= +=1Oat -----END PGP SIGNATURE----- diff --git a/net-misc/networkmanager/files/digest-networkmanager-0.6.4_pre20061028-r1 b/net-misc/networkmanager/files/digest-networkmanager-0.6.4_pre20061028-r1 new file mode 100644 index 000000000000..4e576bd825be --- /dev/null +++ b/net-misc/networkmanager/files/digest-networkmanager-0.6.4_pre20061028-r1 @@ -0,0 +1,3 @@ +MD5 730d6a1b66ff007c2cb52e29d7104f0c NetworkManager-0.6.4_pre20061028.tar.bz2 1780993 +RMD160 eef9c8fedaacba413b833b98ee56af5bd74ada2b NetworkManager-0.6.4_pre20061028.tar.bz2 1780993 +SHA256 4a7114367d0f14eeaee094e3c08bfb728a175fd23ac6b97a5868aa734011583c NetworkManager-0.6.4_pre20061028.tar.bz2 1780993 diff --git a/net-misc/networkmanager/files/networkmanager-updatedbackend.patch b/net-misc/networkmanager/files/networkmanager-updatedbackend.patch new file mode 100644 index 000000000000..767284a28233 --- /dev/null +++ b/net-misc/networkmanager/files/networkmanager-updatedbackend.patch @@ -0,0 +1,657 @@ +Index: NetworkManager/trunk/src/backends/NetworkManagerGentoo.c +=================================================================== +--- NetworkManagerGentoo.c (revision 15) ++++ NetworkManagerGentoo.c (revision 38) +@@ -1,2 +1,3 @@ ++ + /* NetworkManager -- Network link manager + * +@@ -250,8 +251,20 @@ + */ + void nm_system_restart_mdns_responder (void) +-{ +- nm_spawn_process("/etc/init.d/mDNSResponder stop"); +- nm_spawn_process("/etc/init.d/mDNSResponder zap"); +- nm_spawn_process("/etc/init.d/mDNSResponder start"); ++{ ++ /* Check if the daemon was already running - do not start a new instance */ ++ /* Howl */ ++ if (g_file_test("/var/run/mDNSResponder.pid", G_FILE_TEST_EXISTS)) ++ { ++ nm_info("Restarting mDNSResponder"); ++ nm_spawn_process("/etc/init.d/mDNSResponder stop"); ++ nm_spawn_process("/etc/init.d/mDNSResponder zap"); ++ nm_spawn_process("/etc/init.d/mDNSResponder start"); ++ } ++ /* Apple's mDNSResponder */ ++ if (g_file_test("/var/run/mDNSResponderPosix.pid", G_FILE_TEST_EXISTS)) ++ { ++ nm_info("Restarting mDNSResponderPosix"); ++ nm_spawn_process("/etc/init.d/mDNSResponderPosix restart"); ++ } + } + +@@ -266,5 +279,4 @@ + { + char *buf; +- char *addr; + struct ether_addr hw_addr; + unsigned char eui[8]; +@@ -288,4 +300,258 @@ + g_free(buf); + } ++/* Get the array associated with the key, and leave the current pointer ++ * pointing at the line containing the key. The char** returned MUST ++ * be freed by the caller. ++ */ ++gchar ** ++svGetArray(shvarFile *s, const char *key) ++{ ++ gchar **values = NULL, **lines, *line, *value; ++ GList *restore; ++ int len, strvlen, i, j; ++ ++ g_assert(s); ++ g_assert(key); ++ ++ /* Attempt to do things the easy way first */ ++ line = svGetValue(s, key); ++ if (!line) ++ return NULL; ++ ++ restore = s->current; ++ ++ g_strstrip(strtok(line, "#")); /* Remove comments and whitespace */ ++ ++ if (line[0] != '(') ++ { ++ /* This isn't an array, so pretend it's a one item array. */ ++ values = g_renew(char*, values, 2); ++ values[0] = line; ++ values[1] = NULL; ++ return values; ++ } ++ ++ while(!strrchr(line, ')')) ++ { ++ s->current = s->current->next; ++ value = g_strjoin(" ", line, g_strstrip(strtok(s->current->data, "#")), NULL); ++ g_free(line); ++ line = value; ++ value = NULL; ++ } ++ ++ lines = g_strsplit(line, "\"", 0); ++ ++ strvlen = g_strv_length(lines); ++ if (strvlen == 0) ++ { ++ /* didn't split, something's wrong */ ++ g_free(line); ++ return NULL; ++ } ++ ++ j = 0; ++ for (i = 0; i <= strvlen - 1; i++) ++ { ++ value = lines[i]; ++ len = strlen(g_strstrip(value)); ++ if ((value[0] == '(') || (value[0] == ')') || (len == 0)) ++ continue; ++ ++ values = g_renew(char*, values, j + 2); ++ values[j+1] = NULL; ++ values[j++] = g_strdup(value); ++ } ++ ++ g_free(line); ++ g_strfreev(lines); ++ s->current = restore; ++ ++ return values; ++} ++ ++/* ++* GentooReadConfig ++* ++* Most of this comes from the arch backend, no need to re-invent. ++* Read platform dependant config file and fill hash with relevant info ++*/ ++static GHashTable * GentooReadConfig(const char* dev) ++{ ++ GHashTable *ifs; ++ shvarFile *file; ++ int len, hits, i = 0; ++ guint32 maskval; ++ gchar buf[16], *value, *cidrprefix, *gateway; ++ gchar *config_str, *iface_str, *route_str, *mtu_str, *dnsserver_str, *dnssearch_str; /* Lookup keys */ ++ gchar **conf, **config = NULL, **routes = NULL; ++ struct in_addr mask; ++ ++ file = svNewFile(SYSCONFDIR"/conf.d/net"); ++ if (!file) ++ return NULL; ++ ++ ifs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); ++ if (ifs == NULL) ++ { ++ nm_debug("Unable to create g_hash_table."); ++ svCloseFile(file); ++ return NULL; ++ } ++ ++ /* Keys we will use for lookups later */ ++ config_str = g_strdup_printf("config_%s", dev); ++ iface_str = g_strdup_printf("iface_%s", dev); ++ route_str = g_strdup_printf("routes_%s", dev); ++ mtu_str = g_strdup_printf("mtu_%s", dev); ++ dnsserver_str = g_strdup_printf("dns_servers_%s", dev); ++ dnssearch_str = g_strdup_printf("dns_search_%s", dev); ++ ++ ++ if ((config = svGetArray(file, iface_str))) ++ { ++ /* This isn't tested, (or supported, really) so hopefully it works */ ++ nm_info("You are using a deprecated configuration syntax for %s.", dev); ++ nm_info("You are advised to read /etc/conf.d/net.example and upgrade it accordingly."); ++ value = svGetValue(file, "gateway"); ++ if ((value) && (gateway = strstr(value, dev)) && strtok(gateway, "/")) ++ { ++ /* Is it possible to specify multiple gateways using this variable? */ ++ gateway = strtok(NULL, "/"); ++ routes = g_renew(char*, routes, 2); ++ routes[0] = g_strdup_printf("default via %s", gateway); ++ routes[1] = NULL; ++ g_free(value); ++ } ++ } ++ else ++ { ++ config = svGetArray(file, config_str); ++ routes = svGetArray(file, route_str); ++ } ++ ++ ++ if ((config) && g_ascii_strcasecmp(config[0], "dhcp")) ++ { ++ nm_debug("Found %s in %s.", config_str, SYSCONFDIR"/conf.d/net"); ++ ++ if (!g_ascii_strcasecmp(config[0], "null")) ++ { ++ nm_debug("Config disables device %s.", dev); ++ g_hash_table_insert(ifs, g_strdup("disabled"), g_strdup("true")); ++ } ++ else ++ { ++ /* TODO: Handle "noop". */ ++ conf = g_strsplit(config[0], " ", 0); ++ hits = g_strv_length(conf); ++ ++ strtok(conf[0], "/"); ++ if ((cidrprefix = strtok(NULL, "/"))) ++ { ++ maskval = 0xffffffff; ++ maskval <<= (32 - atoi(cidrprefix)); ++ mask.s_addr = htonl(maskval); ++ g_hash_table_insert(ifs, g_strdup("netmask"), g_strdup(inet_ntoa(mask))); ++ } ++ ++ ++ if ((hits > 0) && inet_aton(conf[0], &mask)) ++ { ++ g_hash_table_insert(ifs, g_strdup(dev), g_strdup(conf[i++])); ++ while ((hits -= 2) > 0) ++ { ++ g_hash_table_insert(ifs, g_strdup(conf[i]), g_strdup(conf[i+1])); ++ i += 2; ++ } ++ } ++ else ++ { ++ nm_debug("Unhandled configuration. Switching to DHCP."); ++ nm_debug("\t%s = %s", config_str, config[0]); ++ g_hash_table_insert(ifs, g_strdup("dhcp"), g_strdup("true")); ++ } ++ g_strfreev(conf); ++ } ++ } ++ else ++ { ++ nm_debug("Enabling DHCP for device %s.", dev); ++ g_hash_table_insert(ifs, g_strdup("dhcp"), g_strdup("true")); ++ } ++ ++ g_strfreev(config); ++ ++ if (routes) ++ { ++ nm_debug("Found %s in config.", route_str); ++ ++ len = g_strv_length(routes); ++ for (i = 0; i < len; i++) ++ { ++ if (!sscanf(routes[i], "default via %[0-9.:]", buf)) ++ continue; ++ ++ g_hash_table_insert(ifs,g_strdup("gateway"),g_strdup( (char*) buf)); ++ } ++ } ++ ++ g_strfreev(routes); ++ ++ if ((value = svGetValue(file, mtu_str))) ++ { ++ nm_debug("Found %s in config.", mtu_str); ++ g_hash_table_insert(ifs, g_strdup("mtu"), g_strdup(value)); ++ } ++ ++ g_free(value); ++ ++ if (!(value = svGetValue(file, dnsserver_str))) ++ { ++ value = svGetValue(file, "dns_servers"); ++ } ++ if (value) ++ { ++ nm_debug("Found DNS nameservers in config."); ++ g_hash_table_insert(ifs, g_strdup("nameservers"), g_strdup(value)); ++ } ++ ++ g_free(value); ++ ++ if (!(value = svGetValue(file, dnssearch_str))) ++ { ++ value = svGetValue(file, "dns_search"); ++ } ++ if (value) ++ { ++ nm_debug("Found DNS search in config."); ++ g_hash_table_insert(ifs, g_strdup("dnssearch"), g_strdup(value)); ++ } ++ ++ g_free(value); ++ svCloseFile(file); ++ ++ if ((file = svNewFile(SYSCONFDIR"/conf.d/hostname"))) ++ { ++ if ((value = svGetValue(file, "HOSTNAME")) && (strlen(value) > 0)) ++ { ++ nm_debug("Found hostname."); ++ g_hash_table_insert(ifs, g_strdup("hostname"), g_strdup(value)); ++ } ++ ++ g_free(value); ++ svCloseFile(file); ++ } ++ ++ ++ g_free(config_str); ++ g_free(iface_str); ++ g_free(route_str); ++ g_free(mtu_str); ++ g_free(dnsserver_str); ++ g_free(dnssearch_str); ++ ++ return ifs; ++} + + typedef struct GentooSystemConfigData +@@ -293,6 +559,7 @@ + NMIP4Config * config; + gboolean use_dhcp; ++ gboolean system_disabled; ++ guint32 mtu; + } GentooSystemConfigData; +- + + /* +@@ -304,133 +571,172 @@ + * + */ +-void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) +-{ +- char *cfg_file_path = NULL; +- FILE *file = NULL; +- char buffer[100]; +- char confline[100], dhcpline[100], ipline[100]; +- int ipa, ipb, ipc, ipd; +- int nNext = 0, bNext = 0, count = 0; +- char *confToken; +- gboolean data_good = FALSE; +- gboolean use_dhcp = TRUE; +- GentooSystemConfigData *sys_data = NULL; +- guint32 ip4_address = 0; +- guint32 ip4_netmask = 0; +- guint32 ip4_gateway = 0; +- guint32 ip4_broadcast = 0; +- +- g_return_val_if_fail (dev != NULL, NULL); +- +- sys_data = g_malloc0 (sizeof (GentooSystemConfigData)); +- sys_data->config = nm_device_get_ip4_config(dev); +- /* We use DHCP on an interface unless told not to */ ++void* nm_system_device_get_system_config (NMDevice * dev, NMData *app_data) ++{ ++ GHashTable* ifh; ++ gpointer val; ++ gchar **strarr; ++ GentooSystemConfigData* sys_data = NULL; ++ int len, i; ++ ++ g_return_val_if_fail(dev != NULL, NULL); ++ ++ sys_data = g_malloc0(sizeof (GentooSystemConfigData)); + sys_data->use_dhcp = TRUE; +- nm_device_set_use_dhcp (dev, TRUE); +-// nm_ip4_config_set_address (sys_data->config, 0); +-// nm_ip4_config_set_gateway (sys_data->config, 0); +-// nm_ip4_config_set_netmask (sys_data->config, 0); +- +- /* Gentoo systems store this information in +- * /etc/conf.d/net, this is for all interfaces. +- */ +- +- cfg_file_path = g_strdup_printf ("/etc/conf.d/net"); +- if (!cfg_file_path) ++ sys_data->system_disabled = FALSE; ++ sys_data->mtu = 0; ++ sys_data->config=NULL; ++ ++ ifh = GentooReadConfig(nm_device_get_iface(dev)); ++ if (ifh == NULL) ++ { ++ g_free(sys_data); + return NULL; +- +- if (!(file = fopen (cfg_file_path, "r"))) +- { +- g_free (cfg_file_path); +- return NULL; +- } +- sprintf(confline, "iface_%s", nm_device_get_iface (dev)); +- sprintf(dhcpline, "iface_%s=\"dhcp\"", nm_device_get_iface (dev)); +- while (fgets (buffer, 499, file) && !feof (file)) +- { +- /* Kock off newline if any */ +- g_strstrip (buffer); +- +- if (strncmp (buffer, confline, strlen(confline)) == 0) ++ } ++ ++ val = g_hash_table_lookup(ifh, "disabled"); ++ if (val) ++ { ++ if (!strcasecmp (val, "true")) ++ { ++ nm_info ("System configuration disables device %s", nm_device_get_iface (dev)); ++ sys_data->system_disabled = TRUE; ++ } ++ } ++ ++ val = g_hash_table_lookup(ifh, "mtu"); ++ if (val) ++ { ++ guint32 mtu; ++ ++ mtu = strtoul(val, NULL, 10); ++ if (mtu > 500 && mtu < INT_MAX) ++ { ++ nm_debug("System configuration specifies a MTU of %i for device %s", mtu, nm_device_get_iface(dev)); ++ sys_data->mtu = mtu; ++ } ++ } ++ val = g_hash_table_lookup(ifh, "hostname"); ++ if (val) ++ { ++ nm_ip4_config_set_hostname(sys_data->config, val); ++ } ++ ++ val = g_hash_table_lookup(ifh, nm_device_get_iface(dev)); ++ if (val && !g_hash_table_lookup(ifh, "dhcp")) ++ { ++ /* This device does not use DHCP */ ++ ++ sys_data->use_dhcp=FALSE; ++ sys_data->config = nm_ip4_config_new(); ++ ++ nm_ip4_config_set_address (sys_data->config, inet_addr (val)); ++ ++ val = g_hash_table_lookup(ifh, "gateway"); ++ if (val) ++ nm_ip4_config_set_gateway (sys_data->config, inet_addr (val)); ++ else ++ { ++ nm_info ("Network configuration for device '%s' does not specify a gateway but is " ++ "statically configured (non-DHCP).", nm_device_get_iface (dev)); ++ } ++ ++ val = g_hash_table_lookup(ifh, "netmask"); ++ if (val) ++ nm_ip4_config_set_netmask (sys_data->config, inet_addr (val)); ++ else ++ { ++ guint32 addr = nm_ip4_config_get_address (sys_data->config); ++ ++ /* Make a default netmask if we have an IP address */ ++ if (((ntohl (addr) & 0xFF000000) >> 24) <= 127) ++ nm_ip4_config_set_netmask (sys_data->config, htonl (0xFF000000)); ++ else if (((ntohl (addr) & 0xFF000000) >> 24) <= 191) ++ nm_ip4_config_set_netmask (sys_data->config, htonl (0xFFFF0000)); ++ else ++ nm_ip4_config_set_netmask (sys_data->config, htonl (0xFFFFFF00)); ++ } ++ ++ val = g_hash_table_lookup(ifh, "broadcast"); ++ if (val) ++ nm_ip4_config_set_broadcast (sys_data->config, inet_addr (val)); ++ else if ((val = g_hash_table_lookup(ifh, "brd"))) ++ nm_ip4_config_set_broadcast (sys_data->config, inet_addr (val)); ++ else ++ { ++ guint32 broadcast = ((nm_ip4_config_get_address (sys_data->config) & nm_ip4_config_get_netmask (sys_data->config)) ++ | ~nm_ip4_config_get_netmask (sys_data->config)); ++ nm_ip4_config_set_broadcast (sys_data->config, broadcast); ++ } ++ ++ val = g_hash_table_lookup(ifh, "nameservers"); ++ if (val) ++ { ++ nm_debug("Using DNS nameservers \"%s\" from config for device %s.", val, nm_device_get_iface(dev)); ++ if ((strarr = g_strsplit(val, " ", 0))) + { +- /* Make sure this config file is for this device */ +- if (strncmp (&buffer[strlen(confline) - strlen(nm_device_get_iface (dev))], +- nm_device_get_iface (dev), strlen(nm_device_get_iface (dev))) != 0) ++ len = g_strv_length(strarr); ++ for(i = 0; i < len; i++) + { +- nm_warning ("System config file '%s' does not define device '%s'\n", +- cfg_file_path, nm_device_get_iface (dev)); +- break; +- } +- else +- data_good = TRUE; +- +- if (strncmp (buffer, dhcpline, strlen(dhcpline)) == 0) +- { +- use_dhcp = TRUE; ++ guint32 addr = (guint32) (inet_addr (strarr[i])); ++ ++ if (addr != (guint32) -1) ++ nm_ip4_config_add_nameserver(sys_data->config, addr); ++ } ++ ++ g_strfreev(strarr); + } + else + { +- use_dhcp = FALSE; +- confToken = strtok(&buffer[strlen(confline) + 2], " "); +- while (count < 3) +- { +- if (nNext == 1 && bNext == 1) +- { +- ip4_address = inet_addr (confToken); +- count++; +- continue; +- } +- if (strcmp(confToken, "netmask") == 0) +- { +- confToken = strtok(NULL, " "); +- ip4_netmask = inet_addr (confToken); +- count++; +- nNext = 1; +- } +- else if (strcmp(confToken, "broadcast") == 0) +- { +- confToken = strtok(NULL, " "); +- count++; +- bNext = 1; +- } +- else +- { +- ip4_address = inet_addr (confToken); +- count++; +- } +- confToken = strtok(NULL, " "); +- } ++ guint32 addr = (guint32) (inet_addr (val)); ++ ++ if (addr != (guint32) -1) ++ nm_ip4_config_add_nameserver(sys_data->config, addr); ++ } ++ } ++ ++ val = g_hash_table_lookup(ifh, "dnssearch"); ++ if (val) ++ { ++ nm_debug("Using DNS search \"%s\" from config for device %s.", val, nm_device_get_iface(dev)); ++ if ((strarr = g_strsplit(val, " ", 0))) ++ { ++ len = g_strv_length(strarr); ++ for(i = 0; i < len; i++) ++ { ++ if (strarr[i]) ++ nm_ip4_config_add_domain(sys_data->config, strarr[i]); + } ++ ++ g_strfreev(strarr); + } +- /* If we aren't using dhcp, then try to get the gateway */ +- if (!use_dhcp) ++ else + { +- sprintf(ipline, "gateway=\"%s/", nm_device_get_iface (dev)); +- if (strncmp(buffer, ipline, strlen(ipline) - 1) == 0) ++ nm_ip4_config_add_domain(sys_data->config, val); ++ } ++ } ++ ++ nm_ip4_config_set_mtu (sys_data->config, sys_data->mtu); ++ ++#if 0 ++ { ++ int j; ++ nm_debug ("------ Config (%s)", nm_device_get_iface (dev)); ++ nm_debug (" ADDR=%d", nm_ip4_config_get_address (sys_data->config)); ++ nm_debug (" GW =%d", nm_ip4_config_get_gateway (sys_data->config)); ++ nm_debug (" NM =%d", nm_ip4_config_get_netmask (sys_data->config)); ++ nm_debug (" NSs =%d",nm_ip4_config_get_num_nameservers(sys_data->config)); ++ for (j=0;j<nm_ip4_config_get_num_nameservers(sys_data->config);j++) + { +- sprintf(ipline, "gateway=\"%s/%%d.%%d.%%d.%%d\"", nm_device_get_iface (dev) ); +- sscanf(buffer, ipline, &ipa, &ipb, &ipc, &ipd); +- sprintf(ipline, "%d.%d.%d.%d", ipa, ipb, ipc, ipd); +- ip4_gateway = inet_addr (ipline); ++ nm_debug (" NS =%d",nm_ip4_config_get_nameserver(sys_data->config,j)); + } +- } +- } +- fclose (file); +- g_free (cfg_file_path); +- +- /* If successful, set values on the device */ +- if (data_good) +- { +- nm_warning("data good :-)"); +- nm_device_set_use_dhcp (dev, use_dhcp); +- if (ip4_address) +- nm_ip4_config_set_address (sys_data->config, ip4_address); +- if (ip4_gateway) +- nm_ip4_config_set_gateway (sys_data->config, ip4_gateway); +- if (ip4_netmask) +- nm_ip4_config_set_netmask (sys_data->config, ip4_netmask); +- if (ip4_broadcast) +- nm_ip4_config_set_broadcast (sys_data->config, ip4_broadcast); +- } ++ nm_debug ("---------------------\n"); ++ } ++#endif ++ ++ } ++ ++ g_hash_table_destroy(ifh); ++ ++ + return (void *)sys_data; + } +@@ -519,4 +825,11 @@ + gboolean nm_system_device_get_disabled (NMDevice *dev) + { ++ GentooSystemConfigData *sys_data; ++ ++ g_return_val_if_fail (dev != NULL, FALSE); ++ ++ if ((sys_data = nm_device_get_system_config_data (dev))) ++ return sys_data->system_disabled; ++ + return FALSE; + } +@@ -576,4 +889,35 @@ + void nm_system_set_hostname (NMIP4Config *config) + { ++ char *h_name = NULL; ++ const char *hostname; ++ ++ g_return_if_fail (config != NULL); ++ ++ hostname = nm_ip4_config_get_hostname (config); ++ if (!hostname) ++ { ++ struct in_addr temp_addr; ++ struct hostent *host; ++ ++ /* try to get hostname via dns */ ++ temp_addr.s_addr = nm_ip4_config_get_address (config); ++ host = gethostbyaddr ((char *) &temp_addr, sizeof (temp_addr), AF_INET); ++ if (host) ++ { ++ h_name = g_strdup (host->h_name); ++ hostname = strtok (h_name, "."); ++ } ++ else ++ nm_warning ("nm_system_set_hostname(): gethostbyaddr failed, h_errno = %d", h_errno); ++ } ++ ++ if (hostname) ++ { ++ nm_info ("Setting hostname to '%s'", hostname); ++ if (sethostname (hostname, strlen (hostname)) < 0) ++ nm_warning ("Could not set hostname."); ++ } ++ ++ g_free (h_name); + } + +@@ -596,4 +940,11 @@ + guint32 nm_system_get_mtu (NMDevice *dev) + { ++ GentooSystemConfigData *sys_data; ++ ++ g_return_val_if_fail (dev != NULL, 0); ++ ++ if ((sys_data = nm_device_get_system_config_data (dev))) ++ return sys_data->mtu; ++ + return 0; + } diff --git a/net-misc/networkmanager/networkmanager-0.6.4_pre20061028-r1.ebuild b/net-misc/networkmanager/networkmanager-0.6.4_pre20061028-r1.ebuild new file mode 100644 index 000000000000..1476370e7a36 --- /dev/null +++ b/net-misc/networkmanager/networkmanager-0.6.4_pre20061028-r1.ebuild @@ -0,0 +1,86 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.6.4_pre20061028-r1.ebuild,v 1.1 2006/11/26 06:40:36 metalgod Exp $ + +inherit gnome2 debug eutils + +DESCRIPTION="Network configuration and management in an easy way. Desktop env independent" +HOMEPAGE="http://www.gnome.org/projects/NetworkManager/" +SRC_URI="http://dev.gentoo.org/~metalgod/files/NetworkManager-0.6.4_pre20061028.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="crypt debug doc gnome" + +RDEPEND=">=sys-apps/dbus-0.60 + >=sys-apps/hal-0.5 + sys-apps/iproute2 + >=dev-libs/libnl-1.0_pre6 + net-misc/dhcdbd + >=net-wireless/wireless-tools-28_pre9 + >=net-wireless/wpa_supplicant-0.4.8 + >=dev-libs/glib-2.8 + >=x11-libs/libnotify-0.3.2 + gnome? ( >=x11-libs/gtk+-2.8 + >=gnome-base/libglade-2 + >=gnome-base/gnome-keyring-0.4 + >=gnome-base/gnome-panel-2 + >=gnome-base/gconf-2 + >=gnome-base/libgnomeui-2 ) + crypt? ( dev-libs/libgcrypt )" + +DEPEND="${RDEPEND} + dev-util/pkgconfig + dev-util/intltool" + +S=${WORKDIR}/NetworkManager + +DOCS="AUTHORS COPYING ChangeLog INSTALL NEWS README" +USE_DESTDIR="1" + +G2CONF="${G2CONF} \ + `use_with crypt gcrypt` \ + --disable-more-warnings \ + --localstatedir=/var \ + --with-distro=gentoo \ + --with-dbus-sys=/etc/dbus-1/system.d \ + --enable-notification-icon" + +src_unpack () { + unpack ${A} + cd ${S} + + epatch ${FILESDIR}/networkmanager-updatedbackend.patch + epatch ${FILESDIR}/networkmanager-use-kernel-headers.patch + epatch ${FILESDIR}/networkmanager-resolvconf-perms.patch + epatch ${FILESDIR}/networkmanager-0.6.4-gentooinitscript.patch + epatch ${FILESDIR}/networkmanager-0.6.4-confchanges.patch +} + +src_install() { + gnome2_src_install + keepdir /var/run/NetworkManager +} +pkg_postinst() { + gnome2_icon_cache_update + einfo + einfo "NetworkManager doesn't work with all wifi devices" + einfo "to see if your card is supported please visit" + einfo "http://live.gnome.org/NetworkManagerHardware" + einfo + einfo "You can use NetworkManager instead of baselayout" + einfo "to manage your networks but you are advised to use" + einfo "baselayout because NetworkManager is beta software" + einfo "and don't work fully as expected." + einfo + einfo "If it's the first time you run NetworkManager please" + einfo "restart dbus doing /etc/init.d/dbus restart" + einfo + einfo "To use NetworkManager disable all entries on runlevels" + einfo "net.***X and run /etc/init.d/NetworkManager" + einfo "you can add to runlevels writing on your terminal" + einfo "rc-update add NetworkManager default" + einfo + ebeep +} |