4 MAKEFLAGS += --no-print-directory
7 -BINDIR ?= $(PREFIX)/bin
8 +SBINDIR ?= $(PREFIX)/sbin
9 MANDIR ?= $(PREFIX)/share/man
10 PKG_CONFIG ?= pkg-config
12 @@ -85,8 +85,8 @@ check:
16 - $(Q)$(MKDIR) $(DESTDIR)$(BINDIR)
17 - $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(BINDIR) iw
18 + $(Q)$(MKDIR) $(DESTDIR)$(SBINDIR)
19 + $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(SBINDIR) iw
21 $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/
22 $(Q)$(INSTALL) -m 644 -t $(DESTDIR)$(MANDIR)/man8/ iw.8.gz
25 @@ -223,9 +223,12 @@ static int phy_lookup(char *name)
28 pos = read(fd, buf, sizeof(buf) - 1);
42 * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
43 * %NL80211_ATTR_REASON_CODE attributes are used.
45 + * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
46 + * associated with this wiphy must be down and will follow.
48 * @NL80211_CMD_MAX: highest used command number
49 * @__NL80211_CMD_AFTER_LAST: internal use
51 @@ -336,6 +339,8 @@ enum nl80211_commands {
53 NL80211_CMD_DISCONNECT,
55 + NL80211_CMD_SET_WIPHY_NETNS,
57 /* add new commands above here */
59 /* used to define NL80211_CMD_MAX below */
60 @@ -475,10 +480,6 @@ enum nl80211_commands {
61 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
62 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
63 * scanning and include a zero-length SSID (wildcard) for wildcard scan
64 - * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
65 - * scan result list changes (BSS expired or added) so that applications
66 - * can verify that they got a single, consistent snapshot (when all dump
67 - * messages carried the same generation number)
68 * @NL80211_ATTR_BSS: scan result BSS
70 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
71 @@ -573,6 +574,16 @@ enum nl80211_commands {
72 * and join_ibss(), key information is in a nested attribute each
73 * with %NL80211_KEY_* sub-attributes
75 + * @NL80211_ATTR_PID: Process ID of a network namespace.
77 + * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
78 + * dumps. This number increases whenever the object list being
79 + * dumped changes, and as such userspace can verify that it has
80 + * obtained a complete and consistent snapshot by verifying that
81 + * all dump messages contain the same generation number. If it
82 + * changed then the list changed and the dump should be repeated
83 + * completely from scratch.
85 * @NL80211_ATTR_MAX: highest attribute number currently defined
86 * @__NL80211_ATTR_AFTER_LAST: internal use
88 @@ -644,7 +655,7 @@ enum nl80211_attrs {
90 NL80211_ATTR_SCAN_FREQUENCIES,
91 NL80211_ATTR_SCAN_SSIDS,
92 - NL80211_ATTR_SCAN_GENERATION,
93 + NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
96 NL80211_ATTR_REG_INITIATOR,
97 @@ -701,12 +712,17 @@ enum nl80211_attrs {
103 /* add attributes here, update the policy in nl80211.c */
105 __NL80211_ATTR_AFTER_LAST,
106 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
109 +/* source-level API compatibility */
110 +#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
113 * Allow user space programs to use #ifdef on new attributes by defining them
117 @@ -140,3 +140,27 @@ static int handle_rts(struct nl80211_sta
118 COMMAND(set, rts, "<rts threshold|off>",
119 NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
120 "Set rts threshold.");
122 +static int handle_netns(struct nl80211_state *state,
124 + struct nl_msg *msg,
125 + int argc, char **argv)
132 + NLA_PUT_U32(msg, NL80211_ATTR_PID,
133 + strtoul(argv[0], &end, 10));
142 +COMMAND(set, netns, "<pid>",
143 + NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns,
144 + "Put this wireless device into a different network namespace");
147 @@ -127,7 +127,7 @@ static int print_sta_handler(struct nl_m
148 printf("\n\tmesh plid:\t%d",
149 nla_get_u16(sinfo[NL80211_STA_INFO_PLID]));
150 if (sinfo[NL80211_STA_INFO_PLINK_STATE]) {
151 - switch (nla_get_u16(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
152 + switch (nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
154 strcpy(state_name, "LISTEN");