From: Mike Kershaw <dragorn@kismetwireless.net>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] iw: misc minor updates
Date: Sat, 29 Sep 2007 19:20:06 -0400 [thread overview]
Message-ID: <20070929232006.GQ12844@drd1813.lan> (raw)
[-- 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 --]
next reply other threads:[~2007-09-29 23:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-29 23:20 Mike Kershaw [this message]
2007-09-30 14:44 ` [PATCH] iw: misc minor updates Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070929232006.GQ12844@drd1813.lan \
--to=dragorn@kismetwireless.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox