ops: make support for wireless extensions optional
authorFelix Fietkau <nbd@nbd.name>
Thu, 22 Sep 2022 11:20:15 +0000 (13:20 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 22 Sep 2022 11:20:17 +0000 (13:20 +0200)
It is usually not needed anymore and only wastes space

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Makefile
iwinfo_lib.c
iwinfo_lua.c

index 57b6a09b9fc36fa70ed1e7d2436aa59dbf1e0a8f..71b26d86bc8bcdeccdaca11b6775f2278917beeb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ IWINFO_LDFLAGS     = -luci -lubox -lubus
 
 IWINFO_LIB         = libiwinfo.so
 IWINFO_LIB_LDFLAGS = $(LDFLAGS) -shared -Wl,-soname -Wl,$(IWINFO_LIB).$(IWINFO_SOVERSION)
-IWINFO_LIB_OBJ     = iwinfo_utils.o iwinfo_wext.o iwinfo_wext_scan.o iwinfo_lib.o
+IWINFO_LIB_OBJ     = iwinfo_utils.o iwinfo_lib.o
 
 IWINFO_LUA         = iwinfo.so
 IWINFO_LUA_LDFLAGS = $(LDFLAGS) -shared -L. -liwinfo -llua
@@ -17,6 +17,11 @@ IWINFO_CLI_LDFLAGS = $(LDFLAGS) -L. -liwinfo
 IWINFO_CLI_OBJ     = iwinfo_cli.o
 
 
+ifneq ($(filter wl wext madwifi,$(IWINFO_BACKENDS)),)
+       IWINFO_CFLAGS  += -DUSE_WEXT
+       IWINFO_LIB_OBJ += iwinfo_wext.o iwinfo_wext_scan.o
+endif
+
 ifneq ($(filter wl,$(IWINFO_BACKENDS)),)
        IWINFO_CFLAGS  += -DUSE_WL
        IWINFO_LIB_OBJ += iwinfo_wl.o
index 3364cfcecbf0068383f622c85f64e87bef2f205e..22571f04ff6d341c80285c4247f0193e6720a24c 100644 (file)
@@ -344,7 +344,9 @@ static const struct iwinfo_ops *backends[] = {
 #ifdef USE_WL
        &wl_ops,
 #endif
+#ifdef USE_WEXT
        &wext_ops,
+#endif
 };
 
 const char * iwinfo_type(const char *ifname)
index a2fe9d18ffbfe630fe3b3a5e2c3409e39d10c72c..996f2911e2755c4c3279e08833fa55153bab72b9 100644 (file)
@@ -776,6 +776,7 @@ LUA_WRAP_STRUCT_OP(nl80211,hardware_id)
 #endif
 
 /* Wext */
+#ifdef USE_WEXT
 LUA_WRAP_INT_OP(wext,channel)
 LUA_WRAP_INT_OP(wext,frequency)
 LUA_WRAP_INT_OP(wext,frequency_offset)
@@ -802,6 +803,7 @@ LUA_WRAP_STRUCT_OP(wext,htmodelist)
 LUA_WRAP_STRUCT_OP(wext,encryption)
 LUA_WRAP_STRUCT_OP(wext,mbssid_support)
 LUA_WRAP_STRUCT_OP(wext,hardware_id)
+#endif
 
 #ifdef USE_WL
 /* Broadcom table */
@@ -903,6 +905,7 @@ static const luaL_reg R_nl80211[] = {
 #endif
 
 /* Wext table */
+#ifdef USE_WEXT
 static const luaL_reg R_wext[] = {
        LUA_REG(wext,channel),
        LUA_REG(wext,frequency),
@@ -932,6 +935,7 @@ static const luaL_reg R_wext[] = {
        LUA_REG(wext,phyname),
        { NULL, NULL }
 };
+#endif
 
 /* Common */
 static const luaL_reg R_common[] = {
@@ -971,12 +975,14 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
        lua_setfield(L, -2, "nl80211");
 #endif
 
+#ifdef USE_WEXT
        luaL_newmetatable(L, IWINFO_WEXT_META);
        luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_wext);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");
        lua_setfield(L, -2, "wext");
+#endif
 
        return 1;
 }