* Johannes Berg <[EMAIL PROTECTED]> 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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to