mac80211: implement wds sta support (wds ap support work in progress, needs hostapd...
[openwrt/staging/yousong.git] / package / iw / patches / 100-4addr.patch
1 --- a/interface.c
2 +++ b/interface.c
3 @@ -137,6 +137,20 @@ static int get_if_type(int *argc, char *
4 return 2;
5 }
6
7 +static int parse_wds_flag(const char *value, struct nl_msg *msg)
8 +{
9 + if (strcmp(value, "on") == 0)
10 + NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 1);
11 + else if (strcmp(value, "off") == 0)
12 + NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 0);
13 + else
14 + return 1;
15 + return 0;
16 +
17 +nla_put_failure:
18 + return 1;
19 +}
20 +
21 static int handle_interface_add(struct nl80211_state *state,
22 struct nl_cb *cb,
23 struct nl_msg *msg,
24 @@ -168,6 +182,15 @@ static int handle_interface_add(struct n
25 mesh_id = argv[0];
26 argc--;
27 argv++;
28 + } else if (strcmp(argv[0], "wds") == 0) {
29 + argc--;
30 + argv++;
31 + if (parse_wds_flag(argv[0], msg)) {
32 + fprintf(stderr, "wds error\n");
33 + return 2;
34 + }
35 + argc--;
36 + argv++;
37 } else if (strcmp(argv[0], "flags") == 0) {
38 argc--;
39 argv++;
40 @@ -192,14 +215,14 @@ static int handle_interface_add(struct n
41 nla_put_failure:
42 return -ENOBUFS;
43 }
44 -COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [flags <flag>*]",
45 +COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [wds on|off] [flags <flag>*]",
46 NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
47 "Add a new virtual interface with the given configuration.\n"
48 IFACE_TYPES "\n\n"
49 "The flags are only used for monitor interfaces, valid flags are:\n"
50 VALID_FLAGS "\n\n"
51 "The mesh_id is used only for mesh mode.");
52 -COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [flags <flag>*]",
53 +COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [wds on|off] [flags <flag>*]",
54 NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
55
56 static int handle_interface_del(struct nl80211_state *state,
57 --- a/nl80211.h
58 +++ b/nl80211.h
59 @@ -584,6 +584,8 @@ enum nl80211_commands {
60 * changed then the list changed and the dump should be repeated
61 * completely from scratch.
62 *
63 + * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface
64 + *
65 * @NL80211_ATTR_MAX: highest attribute number currently defined
66 * @__NL80211_ATTR_AFTER_LAST: internal use
67 */
68 @@ -714,6 +716,8 @@ enum nl80211_attrs {
69
70 NL80211_ATTR_PID,
71
72 + NL80211_ATTR_4ADDR,
73 +
74 /* add attributes here, update the policy in nl80211.c */
75
76 __NL80211_ATTR_AFTER_LAST,