Re: Proposed ad-hoc channel bug patch



On Dec 25, 2007 4:03 PM, Dan Williams <dcbw redhat com> wrote:
> On Tue, 2007-12-25 at 10:29 +0200, Ohad Lutzky wrote:
> > Hi Dan,
> >
> > Thanks for the info. A few questions -
> >
> > * Is there any chance indeed that the feature will be backported into
> > wpa_supplicant 0.5.x? Or is it a big restructuring of wpa_sup which
> > will make this very difficult?
>
> No, it's pretty easy and fairly contained.  It's just the config option
> and the driver hooks for setting the frequency.
>
> > * Which version of NM uses wpa_supplicant 0.6.x, with the new feature?
> > Is a GUI for setting the channel present? Is any sort of channel set
> > for ad-hoc mode?
>
> No version of NM requires 0.6.x.  All the D-Bus interface work has been
> done on wpa_supplicant 0.5.7 and later but the changes also get applied
> to the 0.6.x branch.
>
> NM does not yet honor the channel setting for either adhoc or
> infrastructure mode because the backend wpa_supplicant support is not
> yet there.

I'm not sure I understand... is the wpa_supplicant support for channel
setting there in 0.6.x or not? When can we expect NM to use this
support?

I'm trying to use NM from my application which uses ad-hoc networking
heavily (a port of a Windows application, specifically), and current
behavior is completely broken for all of the cards I have. Would it be
acceptable to use this patch downstream (Debian, Ubuntu) for the time
being?

>
> Dan
>
>
> > Much thanks,
> > Ohad.
> >
> > On Dec 25, 2007 12:57 AM, Dan Williams <dcbw redhat com> wrote:
> > > On Thu, 2007-12-20 at 10:55 +0200, Ohad Lutzky wrote:
> > > > Hi all,
> > > >
> > > > Apparently it's not a WPA issue after all. Please check patch attached here:
> > > >
> > > > https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/112009/comments/12
> > >
> > > Contrary to the bug report, it's _totally_ a wpa_supplicant issue.
> > > wpa_supplicant 0.6.x has the required config option, it needs to be
> > > backported to wpa_supplicant 0.5.x.  NM should _not_ be setting any
> > > wireless attributes like channel, BSSID, or SSID itself.
> > >
> > > So the patch is wrong.
> > >
> > > Dan
> > >
> > >
> > >
> >
> >
> >
>
>



-- 
Man is the only animal that laughs and weeps, for he is the only
animal that is struck with the difference between what things are and
what they ought to be.
 - William Hazlitt

Ohad Lutzky
commit eff52595e8dccf2e1adc575530ff09b43c7affb4
Author: Ohad Lutzky <lutzky gmail com>
Date:   Sun Dec 23 20:56:07 2007 +0200

    Second version of patch

diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c
index 46516e7..57509b7 100644
--- a/src/nm-device-802-11-wireless.c
+++ b/src/nm-device-802-11-wireless.c
@@ -2855,6 +2855,9 @@ supplicant_send_network_config (NMDevice80211Wireless *self,
 	char *			response = NULL;
 	int				nwid;
 	const char *		essid;
+	const char * iface = nm_device_get_iface (NM_DEVICE (self));
+	struct iwreq wreq;
+	NMSock * sk;
 	struct wpa_ctrl *	ctrl;
 	gboolean			is_adhoc;
 	char *		hex_essid = NULL;
@@ -2973,8 +2976,25 @@ supplicant_send_network_config (NMDevice80211Wireless *self,
 	if (is_adhoc)
 	{
 		if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
-				"SET_NETWORK %i mode 1", nwid))
+					"SET_NETWORK %i mode 1", nwid))
 			goto out;
+
+		nm_info("setting iface %s to channel 11 for ad-hoc networking", iface);
+
+		if (!(sk = nm_dev_sock_open (NM_DEVICE (self), DEV_WIRELESS, __FUNCTION__, NULL))) {
+			nm_warning ("Couldn't get NM sock to set channel 11");
+			goto out;
+		}
+
+		wreq.u.freq.m = 11;
+		wreq.u.freq.e = 0;
+		wreq.u.freq.i = 0;
+		wreq.u.freq.flags = IW_FREQ_FIXED;
+
+		if (iw_set_ext(nm_dev_sock_get_fd (sk), iface, SIOCSIWFREQ, &wreq) != 0) {
+			nm_warning("Error setting card %s to channel 11 for ad-hoc networking", iface);
+			goto out;
+		}
 	}
 
 	if (nm_device_activation_should_cancel (NM_DEVICE (self)))


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