Bssid to supplicant config
Hi all, I'm trying to pass the AP bssid to a connection setting (at wireless_new_auto_connection) so when I want to connect, I also check the bssid. I do this because I notice that it doesn't connect if there is 2 aps with the same SSID and one is with WEP encryption (the one I want to connect to). I tried many ways, saving a ether_addr inside the bssid-data, saving the string that I get with the function nm_access_point_get_hw_address and changing the settings verify, nm_ap_check_compatible and nm_supplicant_config_add_setting_wireless. But either ways work. Can someone help me? Charly Liu ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Configuring DHCP
On Fri, May 2, 2008 at 5:50 PM, Dan Williams [EMAIL PROTECTED] wrote: BTW, if debian puts interface-specific dhclient config files somewhere else normally, I'm happy to have NM pass that location on the dhclient command line for debian-based distros instead. /etc/dhcp3/dhclient-wlan0.conf perhaps? Here's a patch to fix it. Uses /etc/dhclient-$iface.conf on redhat, /etc/dhclient.conf on suse and /etc/dhcp3/dhclient.conf on debian. Any additions? Tambet diff --git a/ChangeLog b/ChangeLog index b9e50bc..24c05cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-16 Tambet Ingo [EMAIL PROTECTED] + + * src/dhcp-manager/nm-dhcp-manager.c (dhclient_find_conf_file): + Implement. + (dhclient_run): Try to locate the dhclient.conf. + 2008-05-15 Tambet Ingo [EMAIL PROTECTED] Move crypto functions from nm-applet to libnm-util. diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index 3f338e0..16df573 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ + /* nm-dhcp-manager.c - Handle the DHCP daemon for NetworkManager * * Copyright (C) 2005 Dan Williams @@ -590,6 +592,35 @@ dhclient_child_setup (gpointer user_data G_GNUC_UNUSED) setpgid (pid, pid); } +static char * +dhclient_find_conf_file (const char *iface) +{ + char *file; + + /* redhat */ + file = g_strdup_printf (SYSCONFDIR /dhclient-%s.conf, iface); + if (g_file_test (file, G_FILE_TEST_IS_REGULAR)) + return file; + + g_free (file); + + /* suse */ + file = g_build_filename (SYSCONFDIR, dhclient.conf, NULL); + if (g_file_test (file, G_FILE_TEST_IS_REGULAR)) + return file; + + g_free (file); + + /* debian */ + file = g_build_filename (SYSCONFDIR, dhcp3, dhclient.conf, NULL); + if (g_file_test (file, G_FILE_TEST_IS_REGULAR)) + return file; + + g_free (file); + + return NULL; +} + static gboolean dhclient_run (NMDHCPDevice *device) { @@ -628,11 +659,9 @@ dhclient_run (NMDHCPDevice *device) goto out; } - conffile = g_strdup_printf (SYSCONFDIR /dhclient-%s.conf, device-iface); - if (!conffile) { - nm_warning (%s: not enough memory for dhclient options., device-iface); - goto out; - } + conffile = dhclient_find_conf_file (device-iface); + if (!conffile) + nm_warning (%s: Could not find dhclient configuration file., device-iface); /* Kill any existing dhclient bound to this interface */ if (g_file_get_contents (pidfile, pid_contents, NULL, NULL)) { @@ -657,8 +686,10 @@ dhclient_run (NMDHCPDevice *device) g_ptr_array_add (dhclient_argv, (gpointer) -lf); /* Set lease file */ g_ptr_array_add (dhclient_argv, (gpointer) leasefile); - g_ptr_array_add (dhclient_argv, (gpointer) -cf); /* Set interface config file */ - g_ptr_array_add (dhclient_argv, (gpointer) conffile); + if (conffile) { + g_ptr_array_add (dhclient_argv, (gpointer) -cf); /* Set interface config file */ + g_ptr_array_add (dhclient_argv, (gpointer) conffile); + } g_ptr_array_add (dhclient_argv, (gpointer) device-iface); g_ptr_array_add (dhclient_argv, NULL); ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Disconnecting from current wifi network
Hi! I haven't been following this list for very long - apologies in advance since this subject probably already came up. For multiple reasons, I may want to disconnect from my current wifi network without connecting to another one, but keeping wireless on. Doing so currently requires me to disable wireless, unplug my wifi key, replug my wifi key, reenable wireless. Seeing it recently came up as popular on the Ubuntu Brainstorm website (http://brainstorm.ubuntu.com/idea/8612/), I guess I'm not the only one having such problems. Are there any plans to add this little feature? If not - why, and can it be added externally? Thanks -- Adys ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Bssid to supplicant config
On Fri, 2008-05-16 at 15:46 +0800, charlyliu wrote: Hi all, I'm trying to pass the AP bssid to a connection setting (at wireless_new_auto_connection) so when I want to connect, I also check the bssid. I do this because I notice that it doesn't connect if there is 2 aps with the same SSID and one is with WEP encryption (the one I want to connect to). This sounds somewhat like a driver problem. Given an SSID and security parameters (via ENCODE, or ENCODEEXT + GENIE + AUTH), the driver takes the intersection of the parameters given to it by userspace, and it's own internal scan list, and uses one of the resulting BSSIDs to associate with. So given an SSID and WEP encryption, the driver should not even be considering association with the non-WEP AP. However, if both APs have the same SSID, and the same security parameters, then the driver would be free to choose either AP to associate with since there's no discernable difference between their capabilities. I tried many ways, saving a ether_addr inside the bssid-data, saving the string that I get with the function nm_access_point_get_hw_address and changing the settings verify, nm_ap_check_compatible and nm_supplicant_config_add_setting_wireless. But either ways work. bssid is a GByteArray, so you'll need to initialize it with something like: void set_bssid(struct ether_addr *addr, NMSetting80211Wireless *s_wireless) { if (s_wireless-bssid) g_byte_array_free (s_wireless-bssid, TRUE); s_wireless-bssid = g_byte_array_sized_new (ETH_ALEN); g_byte_array_append (s_wireless-bssid, (const guint8 *) addr-ether_addr_octet, ETH_ALEN); } Then of course that setting information gets pushed down to NetworkManager, which pushes it further down to the supplicant. In your syslog messages during connection, do you see anything like: NetworkManager: info Config: added 'bssid' value 'xx:xx:xx:xx:xx:xx' after setting the BSSID correctly in your settings service? If not, then there's a bug in NetworkManager. Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Disconnecting from current wifi network
On Fri, 2008-05-16 at 11:22 +0200, Jerome Leclanche wrote: Hi! I haven't been following this list for very long - apologies in advance since this subject probably already came up. For multiple reasons, I may want to disconnect from my current wifi network without connecting to another one, but keeping wireless on. Ok; what's the use-case here? If you're not connected to a wireless network, you're not using the device, and not much useful can be done with it. If you'd like to use it for sniffing or monitor mode or whatever, you want to unmanage the device from NM. Doing so currently requires me to disable wireless, unplug my wifi key, replug my wifi key, reenable wireless. You shouldn't need to unplug your wifi adapter, disable wireless should be enough. If it's not, then your driver needs to be fixed. Seeing it recently came up as popular on the Ubuntu Brainstorm website (http://brainstorm.ubuntu.com/idea/8612/), I guess I'm not the only one having such problems. Are there any plans to add this little feature? If not - why, and can it be added externally? The current applet doesn't really lend itself to this; but reworking some aspects of the applet would make it more feasible. The real question is how this plays with automatic connection. Currently, if you were to tear down that connection, NM would simply re-activate it, because that AP is available and it's likely the best connection to use. Were NM to somehow mark that connection, and not re-connect automatically, that's just confusing, because the connection probably has autoconnect set to TRUE, but NM isn't autoconnecting to it. When you want to connect to the network again, what do you do? How does the connection get back to reconnect automatically? The problem is that most things people can come up with for this problem are not simple. They will result in unexpected, quirky, hidden behavior. We already had something like this in earlier 0.6 versions, where if you manually chose a device from the menu, NM would stick with that device even if you unplugged the wired cable. This was because people wanted a bit of lag time to plug/replug the cable when moving rooms or whatever before NM tore the device down. Turned out to be really confusing for most people, because NM wasn't automatically switch devices around when the cable got pulled. I guess I'd need to hear more about the use-cases. It seems like you do want to set Wireless Enabled to off. Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Configuring DHCP
On Fri, 2008-05-16 at 13:38 +0300, Tambet Ingo wrote: On Fri, May 2, 2008 at 5:50 PM, Dan Williams [EMAIL PROTECTED] wrote: BTW, if debian puts interface-specific dhclient config files somewhere else normally, I'm happy to have NM pass that location on the dhclient command line for debian-based distros instead. /etc/dhcp3/dhclient-wlan0.conf perhaps? Here's a patch to fix it. Uses /etc/dhclient-$iface.conf on redhat, /etc/dhclient.conf on suse and /etc/dhcp3/dhclient.conf on debian. Any additions? I'd rather key off the distro defined at configure time actually... dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: NetworkManager and rf_kill
On Thu, May 15, 2008 at 7:23 PM, Khashayar Naderehvandi [EMAIL PROTECTED] wrote: I at least restored the previous behavior of marking the device down when wireless is disabled; svn r3666. Again, most drivers should be entering low-power state when down, since you're not expected to be able to do much of anything in !IFF_UP state anyway, irregardless of any other setting of txpower. There is a slight problem with this on my machine. When deactivating wireless, the wifi device is put in low power state as expected. If I re-enable wireless, I usually won't get the list of access points back. I've tried waiting for at least a couple of minutes, but the WLAN list remains empty until I open a terminal and issue an iwlist scan. The command lists available APs, and after a moment network-manager-applet shows them as well. Regards, K. ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list