Re: AD-Hoc network specify channel



On 04/14/2010 10:42 PM, Dan Williams wrote:
On Tue, 2010-04-13 at 21:36 +0200, Simon Schampijer wrote:
Hi,

I am trying to create an Ad-Hoc Network with a specific channel. From
the spec [1] I know that I have to set the band as well. However the
created network always has channel 1. The nm-applet does not have an
option to set the channel, and is using channel one, too.

Using iwconfig to create an Ad-Hoc network I can set a channel fine. Is
it fully implemented or do I miss something else?

It should be, though it's likely not possible if you're using
nm-connection-editor since the channel/band aren't accessible there.
But looking at it now, they *should* be accessible for ad-hoc
connections.  So we'll need to whip up some code for page-wifi.c to
hide/show them when ad-hoc is selected.

Yes, agreed. Having it accessible as a setting from within nm-applet would be nice.

(this is because wpa_supplicant only has the ability to set the channel
for ad-hoc networks, not a limitation in NM.  wpa_supplicant does not
have the ability to set a band limitation for infrastructure networks,
which means we can't let users limit particular connection to only
802.11a for example)

See nm_supplicant_config_add_setting_wireless() in NM for where the
frequency gets sent to the supplicant, and build_supplicant_config() for
where the channel/band get translated into a frequency.

Also check nm_ap_new_fake_from_connection() to ensure that the frequency
is getting correctly set on the fake AP.

This all should work as long as the connection dict has the band/freq
specified.

Dan

Actually when looking at the logs something caught my eye. The frequency was listed as being 5210 when I specified channel 11 and 'bg' as the band. Looking at the code I found a little typo. Patches for master and the NETWORKMANAGER_0_7 branch are attached.

Dan, as always, thanks for taking the time to reply that detailed,
   Simon

diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c
index 80b69a3..c7b5d8a 100644
--- a/src/nm-wifi-ap.c
+++ b/src/nm-wifi-ap.c
@@ -1469,7 +1469,7 @@ channel_to_freq (guint32 channel, const char *band)
 	} else if (!strcmp (band, "bg")) {
 		while (bg_table[i].chan && (bg_table[i].chan != channel))
 			i++;
-		return a_table[i].freq;
+		return bg_table[i].freq;
 	}
 
 	return 0;
diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c
index 9b95924..3c3042a 100644
--- a/src/NetworkManagerAP.c
+++ b/src/NetworkManagerAP.c
@@ -1468,7 +1468,7 @@ channel_to_freq (guint32 channel, const char *band)
 	} else if (!strcmp (band, "bg")) {
 		while (bg_table[i].chan && (bg_table[i].chan != channel))
 			i++;
-		return a_table[i].freq;
+		return bg_table[i].freq;
 	}
 
 	return 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]