* [PATCH] iw: misc minor updates
@ 2007-09-29 23:20 Mike Kershaw
2007-09-30 14:44 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Mike Kershaw @ 2007-09-29 23:20 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless
[-- Attachment #1.1: Type: text/plain, Size: 408 bytes --]
Miscellaneous minor updates:
Fixed char *phydev init in main()
Whitespace cleanups
Minimal help
Aliased 'master' to 'ap' in nl modes list
--
Mike Kershaw/Dragorn <dragorn@kismetwireless.net>
GPG Fingerprint: 3546 89DF 3C9D ED80 3381 A661 D7B2 8822 738B BDB1
"We're sorry, Susy won't be attending classes for the rest of this academic
year. She caught the measles, and we had her shot."
[-- Attachment #1.2: iw-miscminor-mk.diff --]
[-- Type: text/plain, Size: 2816 bytes --]
From e86e4c5a5ff1bbe3a5e9c2fef7e28a8376646cb9 Mon Sep 17 00:00:00 2001
From: Mike Kershaw <dragorn@kismetwireless.net>
Date: Sat, 29 Sep 2007 19:17:20 -0400
Subject: [PATCH] Minor whitespace updates
Fixed char *phy initialization in main() preventing add from working
Aliased 'master' to 'ap' for nl80211 mode definitions
Added minimal help
Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net>
---
interface.c | 15 +++++++++------
iw.c | 14 ++++++++++++--
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/interface.c b/interface.c
index 580a952..ec81614 100644
--- a/interface.c
+++ b/interface.c
@@ -33,7 +33,7 @@ static int get_if_type(int *argc, char ***argv, enum nl80211_iftype *type)
} else if (strcmp(tpstr, "monitor") == 0) {
*type = NL80211_IFTYPE_MONITOR;
return 1;
- } else if (strcmp(tpstr, "ap") == 0) {
+ } else if (strcmp(tpstr, "ap") == 0 || strcmp(tpstr, "master") == 0) {
*type = NL80211_IFTYPE_AP;
return 1;
} else if (strcmp(tpstr, "ap_vlan") == 0) {
@@ -70,7 +70,7 @@ static int handle_interface_add(struct nl80211_state *state,
if (argc) {
tpset = get_if_type(&argc, &argv, &type);
- if (tpset < 0)
+ if (tpset < 0)
return -1;
}
@@ -79,16 +79,19 @@ static int handle_interface_add(struct nl80211_state *state,
return -1;
}
- msg = nlmsg_alloc();
- if (!msg)
- return -1;
+ msg = nlmsg_alloc();
+ if (!msg) {
+ fprintf(stderr, "failed to allocate netlink msg\n");
+ return -1;
+ }
genlmsg_put(msg, 0, 0, genl_family_get_id(state->nl80211), 0,
0, NL80211_CMD_NEW_INTERFACE, 0);
if (dev)
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(dev));
- if (phy)
+ if (phy) {
return -1; /* XXX TODO */
+ }
NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, name);
if (tpset)
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, type);
diff --git a/iw.c b/iw.c
index 1d04d58..ffbd691 100644
--- a/iw.c
+++ b/iw.c
@@ -90,11 +90,16 @@ static int get_phy_or_dev(int *argc, char ***argv, char **name)
return 0;
}
+void usage(char *argv0) {
+ fprintf(stderr, "Usage: %s [options] {dev <phydev>} {interface <interface> } {COMMAND}\n"
+ "where COMMAND := { add | del }\n", argv0);
+}
+
int main(int argc, char **argv)
{
struct nl80211_state nlstate;
int err = 0, pod;
- char *ifname, *phyname, *type;
+ char *ifname = NULL, *phyname = NULL, *type, *argv0;
err = nl80211_init(&nlstate);
if (err)
@@ -102,7 +107,12 @@ int main(int argc, char **argv)
/* strip off self */
argc--;
- argv++;
+ argv0 = *argv++;
+
+ if (argc == 0 || (argc == 1 && strcmp(*argv, "help") == 0)) {
+ usage(argv0);
+ goto out;
+ }
pod = get_phy_or_dev(&argc, &argv, &ifname);
if (pod == 0) {
--
1.5.3.2
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iw: misc minor updates
2007-09-29 23:20 [PATCH] iw: misc minor updates Mike Kershaw
@ 2007-09-30 14:44 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2007-09-30 14:44 UTC (permalink / raw)
To: Mike Kershaw; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
On Sat, 2007-09-29 at 19:20 -0400, Mike Kershaw wrote:
> Miscellaneous minor updates:
> Fixed char *phydev init in main()
> Whitespace cleanups
> Minimal help
> Aliased 'master' to 'ap' in nl modes list
Thanks, applied with some small fixes. It'd help if you could inline
patches and make the description just in the mail :)
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-30 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-29 23:20 [PATCH] iw: misc minor updates Mike Kershaw
2007-09-30 14:44 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox