ath9k: fix compiler warning without debug enabled
[openwrt.git] / package / iw / patches / 110-sta_vlan.patch
1 --- a/station.c
2 +++ b/station.c
3 @@ -196,7 +196,7 @@ COMMAND(station, del, "<MAC address>",
4 NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get,
5 "Remove the given station entry (use with caution!)");
6
7 -static int handle_station_set(struct nl80211_state *state,
8 +static int handle_station_set_plink(struct nl80211_state *state,
9 struct nl_cb *cb,
10 struct nl_msg *msg,
11 int argc, char **argv)
12 @@ -241,9 +241,56 @@ static int handle_station_set(struct nl8
13 return -ENOBUFS;
14 }
15 COMMAND(station, set, "<MAC address> plink_action <open|block>",
16 - NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set,
17 + NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
18 "Set mesh peer link action for this station (peer).");
19
20 +static int handle_station_set_vlan(struct nl80211_state *state,
21 + struct nl_cb *cb,
22 + struct nl_msg *msg,
23 + int argc, char **argv)
24 +{
25 + unsigned char mac_addr[ETH_ALEN];
26 + unsigned long sta_vlan = 0;
27 + char *err = NULL;
28 +
29 + if (argc < 3)
30 + return 1;
31 +
32 + if (mac_addr_a2n(mac_addr, argv[0])) {
33 + fprintf(stderr, "invalid mac address\n");
34 + return 2;
35 + }
36 + argc--;
37 + argv++;
38 +
39 + if (strcmp("vlan", argv[0]) != 0)
40 + return 1;
41 + argc--;
42 + argv++;
43 +
44 + sta_vlan = strtoul(argv[0], &err, 0);
45 + if (err && *err) {
46 + fprintf(stderr, "invalid vlan id\n");
47 + return 2;
48 + }
49 + argc--;
50 + argv++;
51 +
52 + if (argc)
53 + return 1;
54 +
55 + NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
56 + NLA_PUT_U32(msg, NL80211_ATTR_STA_VLAN, sta_vlan);
57 +
58 + return 0;
59 + nla_put_failure:
60 + return -ENOBUFS;
61 +}
62 +COMMAND(station, set, "<MAC address> vlan <ifindex>",
63 + NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_vlan,
64 + "Set an AP VLAN for this station.");
65 +
66 +
67 static int handle_station_dump(struct nl80211_state *state,
68 struct nl_cb *cb,
69 struct nl_msg *msg,
This page took 0.075307 seconds and 5 git commands to generate.