public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug•ch>
To: Johannes Berg <johannes@sipsolutions•net>
Cc: netdev@vger•kernel.org,
	"John W. Linville" <linville@tuxdriver•com>,
	Michael Buesch <mb@bu3sch•de>, Jean Tourrilhes <jt@hpl•hp.com>,
	Jiri Benc <jbenc@suse•cz>,
	"James P. Ketrenos" <ipw2100-admin@linux•intel.com>,
	Mohamed Abbas <mabbas@linux•intel.com>,
	Ulrich Kunitz <kune@deine-taler•de>,
	Daniel Drake <dsd@gentoo•org>
Subject: Re: [RFC 3/3] cfg80211 thoughts on configuration
Date: Wed, 20 Sep 2006 08:33:06 +0200	[thread overview]
Message-ID: <20060920063306.GH18349@postel.suug.ch> (raw)
In-Reply-To: <1158231183.2936.55.camel@ux156>

* Johannes Berg <johannes@sipsolutions•net> 2006-09-14 12:53
> This is some preliminary code how I'm currently thinking (and that might
> change radically :) ) configuration might look like.
> 
> It uses the patch I previously posted to make genetlink attributes
> custom-definable.
> 
> --- wireless-dev.orig/include/linux/nl80211.h	2006-09-13 22:06:10.539647141 +0200
> +++ wireless-dev/include/linux/nl80211.h	2006-09-13 22:06:11.919647141 +0200
> @@ -45,6 +45,47 @@ enum {
>  	/* get list of all interfaces belonging to a wiphy */
>  	NL80211_CMD_NEW_INTERFACES,
>  
> +	/* configure device */
> +	NL80211_CMD_CONFIGURE,
> +
> +	/* request configuration */
> +	NL80211_CMD_GET_CONFIG,
> +
> +	/* configuration sent from kernel */
> +	NL80211_CMD_CONFIGURATION,

I think I brought this up already, it's a lot easier to understand
things if you keep it symmetric, i.e. NL80211_CMD_GET_CONFIG triggers
sending a NL80211_CMD_NEW_CONFIG.

> +static int check_information_element(struct nlattr *nla)
> +{
> +	int len = nla_len(nla);
> +	u8 *data = nla_data(nla);
> +	int elementlen;
> +
> +	while (len >= 2) {
> +		/* 1 byte ID, 1 byte len, `len' bytes data */
> +		elementlen = *(data+1) + 2;
> +		data += elementlen;
> +		len -= elementlen;
> +	}
> +	return len ? -EINVAL : 0;
> +}
> +
>  static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
>  	[NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
>  	[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
> @@ -33,6 +49,17 @@ static struct nla_policy nl80211_policy[
>  				 .len = NL80211_MAX_FRAME_LEN },
>  	[NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
>  	[NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
> +	[NL80211_ATTR_NETWORK_ID] = { .type = NLA_U16 },
> +	[NL80211_ATTR_CHANNEL] = { .type = NLA_U32 },
> +	[NL80211_ATTR_RX_SENSITIVITY] = { .type = NLA_U32 },
> +	[NL80211_ATTR_BSSID] = { .len = 6 },
> +	[NL80211_ATTR_SSID] = { .type = NLA_STRING, .len = 32 },
> +	[NL80211_ATTR_TRANSMIT_POWER] = { .type = NLA_U32 },
> +	[NL80211_ATTR_FRAG_THRESHOLD] = { .type = NLA_U32 },
> +	[NL80211_ATTR_INFORMATION_ELEMENT] = { .type = NLA_CUSTOM_CHECK,
> +					       .check = check_information_element },

Just use a nested attribute here, this new array format you introduce
having 1 byte ID, 1 byte len is equivalent to using a set of nested
attributes with nla_type=id, nla_len=len.

  reply	other threads:[~2006-09-20  6:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 10:46 more nl80211 stuff Johannes Berg
2006-09-14 10:49 ` [RFC 1/3] cfg80211/nl80211 core Johannes Berg
2006-09-22 15:48   ` Jiri Benc
2006-09-25  9:05     ` Johannes Berg
2006-10-06  9:51   ` Johannes Berg
2006-09-14 10:50 ` [RFC 2/3] make d80211 use cfg80211 Johannes Berg
2006-09-14 17:53   ` Simon Barber
2006-09-15  6:41     ` Johannes Berg
2006-09-14 10:53 ` [RFC 3/3] cfg80211 thoughts on configuration Johannes Berg
2006-09-20  6:33   ` Thomas Graf [this message]
2006-09-20  7:03     ` Johannes Berg
2006-09-20  7:07       ` Thomas Graf
2006-09-14 13:41 ` more nl80211 stuff Dan Williams
2006-09-14 13:55   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060920063306.GH18349@postel.suug.ch \
    --to=tgraf@suug$(echo .)ch \
    --cc=dsd@gentoo$(echo .)org \
    --cc=ipw2100-admin@linux$(echo .)intel.com \
    --cc=jbenc@suse$(echo .)cz \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=jt@hpl$(echo .)hp.com \
    --cc=kune@deine-taler$(echo .)de \
    --cc=linville@tuxdriver$(echo .)com \
    --cc=mabbas@linux$(echo .)intel.com \
    --cc=mb@bu3sch$(echo .)de \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox