Search Linux Wireless

Re: Userspace tools: Roadmap?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg wrote:
> On Mon, 2008-12-08 at 18:18 -0500, Dan E wrote:
> There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I
> guess it needs 1.0 or 1.1, will fix the page.
> 
following is a patch that gets iw working with the development versions
of libnl.  I keep it uptodate at: http://wireless.erley.org/

The Makefile changes may not be the 'best' way to do it, but it works
for me.

Pat Erley

---

diff --git a/Makefile b/Makefile
index df59b51..1bc8310 100644
--- a/Makefile
+++ b/Makefile
@@ -10,10 +10,11 @@ MKDIR ?= mkdir -p
 INSTALL ?= install
 CC ?= "gcc"

-CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
`pkg-config --cflags libnl-1`
+NLVERSION = 2.0
+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
`pkg-config --cflags libnl-$(NLVERSION)`
 CFLAGS += -O2 -g
-LDFLAGS += `pkg-config --libs libnl-1`
-NLVERSION = 1.0
+LDFLAGS += `pkg-config --libs libnl-$(NLVERSION)`
+LIBS += -lnl -lnl-genl -lnl-nf -lnl-route

 OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o
mesh.o genl.o
 ALL = iw
@@ -29,7 +30,7 @@ endif
 all: version_check $(ALL)

 version_check:
-	@if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo
"You need at least libnl version $(NLVERSION)"; exit 1; fi
+	@if ! pkg-config --atleast-version=$(NLVERSION) libnl-$(NLVERSION);
then echo "You need at least libnl version $(NLVERSION)"; exit 1; fi


 version.h: version.sh
@@ -42,7 +43,7 @@ version.h: version.sh

 iw:	$(OBJS)
 	@$(NQ) ' CC  ' iw
-	$(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw
+	$(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw

 check:
 	$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
diff --git a/iw.c b/iw.c
index 5859180..11af7d6 100644
--- a/iw.c
+++ b/iw.c
@@ -29,7 +29,7 @@ static int nl80211_init(struct nl80211_state *state)
 {
 	int err;

-	state->nl_handle = nl_handle_alloc();
+	state->nl_handle = nl_socket_alloc();
 	if (!state->nl_handle) {
 		fprintf(stderr, "Failed to allocate netlink handle.\n");
 		return -ENOMEM;
@@ -41,8 +41,7 @@ static int nl80211_init(struct nl80211_state *state)
 		goto out_handle_destroy;
 	}

-	state->nl_cache = genl_ctrl_alloc_cache(state->nl_handle);
-	if (!state->nl_cache) {
+	if (genl_ctrl_alloc_cache(state->nl_handle, &(state->nl_cache))) {
 		fprintf(stderr, "Failed to allocate generic netlink cache.\n");
 		err = -ENOMEM;
 		goto out_handle_destroy;
@@ -60,7 +59,7 @@ static int nl80211_init(struct nl80211_state *state)
  out_cache_free:
 	nl_cache_free(state->nl_cache);
  out_handle_destroy:
-	nl_handle_destroy(state->nl_handle);
+	nl_socket_free(state->nl_handle);
 	return err;
 }

@@ -68,7 +67,7 @@ static void nl80211_cleanup(struct nl80211_state *state)
 {
 	genl_family_put(state->nl80211);
 	nl_cache_free(state->nl_cache);
-	nl_handle_destroy(state->nl_handle);
+	nl_socket_free(state->nl_handle);
 }

 __COMMAND(NULL, NULL, NULL, 0, 0, 0, CIB_NONE, NULL);
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux