From patchwork Tue Nov 10 17:53:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 59114 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAAHrGD2002829 for ; Tue, 10 Nov 2009 17:53:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750931AbZKJRxJ (ORCPT ); Tue, 10 Nov 2009 12:53:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750970AbZKJRxI (ORCPT ); Tue, 10 Nov 2009 12:53:08 -0500 Received: from nbd.name ([88.198.39.176]:32992 "EHLO ds10.mine.nu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929AbZKJRxI (ORCPT ); Tue, 10 Nov 2009 12:53:08 -0500 Received: from p5ddc4c43.dip.t-dialin.net ([93.220.76.67] helo=pi.lan) by ds10.mine.nu with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1N7uxq-00065H-Hz; Tue, 10 Nov 2009 18:57:10 +0100 Message-ID: <4AF9A886.9090902@openwrt.org> Date: Tue, 10 Nov 2009 18:53:10 +0100 From: Felix Fietkau User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: linux-wireless CC: "John W. Linville" , Johannes Berg Subject: [PATCH 1/2] nl80211: add a parameter for using 4-address frames on virtual interfaces X-Enigmail-Version: 0.96.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -584,6 +584,8 @@ enum nl80211_commands { * changed then the list changed and the dump should be repeated * completely from scratch. * + * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -714,6 +716,8 @@ enum nl80211_attrs { NL80211_ATTR_PID, + NL80211_ATTR_4ADDR, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -207,10 +207,12 @@ struct ieee80211_supported_band { * struct vif_params - describes virtual interface parameters * @mesh_id: mesh ID to use * @mesh_id_len: length of the mesh ID + * @use_4addr: use 4-address frames */ struct vif_params { u8 *mesh_id; int mesh_id_len; + int use_4addr; }; /** --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -140,6 +140,7 @@ static struct nla_policy nl80211_policy[ [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, [NL80211_ATTR_PID] = { .type = NLA_U32 }, + [NL80211_ATTR_4ADDR] = { .type = NLA_U8 }, }; /* policy for the attributes */ @@ -989,6 +990,13 @@ static int nl80211_set_interface(struct change = true; } + if (info->attrs[NL80211_ATTR_4ADDR]) { + params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); + change = true; + } else { + params.use_4addr = -1; + } + if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { if (ntype != NL80211_IFTYPE_MONITOR) { err = -EINVAL; @@ -1055,6 +1063,9 @@ static int nl80211_new_interface(struct params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); } + if (info->attrs[NL80211_ATTR_4ADDR]) + params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); + err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, &flags);