diff options
Diffstat (limited to 'libs')
24 files changed, 52 insertions, 39 deletions
diff --git a/libs/luci-lib-ip/src/ip.c b/libs/luci-lib-ip/src/ip.c index 34a120d1ae..10d11a365b 100644 --- a/libs/luci-lib-ip/src/ip.c +++ b/libs/luci-lib-ip/src/ip.c @@ -216,6 +216,9 @@ static bool parse_cidr(const char *dest, cidr_t *pp) if (pp->scope == 0) return false; } + else { + pp->scope = 0; + } if (p) { @@ -327,18 +330,21 @@ static void L_setaddr(struct lua_State *L, const char *name, p->family = AF_INET; p->bits = (bits < 0) ? AF_BITS(AF_INET) : bits; p->addr.v4 = *(struct in_addr *)addr; + p->scope = 0; } else if (family == AF_INET6) { p->family = AF_INET6; p->bits = (bits < 0) ? AF_BITS(AF_INET6) : bits; p->addr.v6 = *(struct in6_addr *)addr; + p->scope = 0; } else { p->family = AF_PACKET; p->bits = (bits < 0) ? AF_BITS(AF_PACKET) : bits; p->addr.mac = *(struct ether_addr *)addr; + p->scope = 0; } luaL_getmetatable(L, LUCI_IP_CIDR); @@ -741,6 +747,7 @@ static int cidr_mask(lua_State *L) if (!(p2 = lua_newuserdata(L, sizeof(*p2)))) return 0; + p2->scope = 0; p2->bits = AF_BITS(p1->family); p2->family = p1->family; @@ -784,6 +791,7 @@ static int cidr_mapped4(lua_State *L) if (!(p2 = lua_newuserdata(L, sizeof(*p2)))) return 0; + p2->scope = 0; p2->family = AF_INET; p2->bits = (p1->bits > AF_BITS(AF_INET)) ? AF_BITS(AF_INET) : p1->bits; memcpy(&p2->addr.v4, p1->addr.v6.s6_addr + 12, sizeof(p2->addr.v4)); @@ -824,6 +832,7 @@ static int cidr_tolinklocal(lua_State *L) if (!(p2 = lua_newuserdata(L, sizeof(*p2)))) return 0; + p2->scope = p1->scope; p2->family = AF_INET6; p2->bits = AF_BITS(AF_INET6); p2->addr.u8[0] = 0xFE; @@ -864,6 +873,7 @@ static int cidr_tomac(lua_State *L) if (!(p2 = lua_newuserdata(L, sizeof(*p2)))) return 0; + p2->scope = 0; p2->family = AF_PACKET; p2->bits = AF_BITS(AF_PACKET); p2->addr.u8[0] = p1->addr.u8[8] ^ 0x02; diff --git a/libs/luci-lib-nixio/docsrc/nixio.bin.lua b/libs/luci-lib-nixio/docsrc/nixio.bin.lua index 13e125d3cc..2a3b93c77e 100644 --- a/libs/luci-lib-nixio/docsrc/nixio.bin.lua +++ b/libs/luci-lib-nixio/docsrc/nixio.bin.lua @@ -29,5 +29,5 @@ module "nixio.bin" --- Base64 decode a given buffer. -- @class function -- @name b64decode --- @param buffer Base 64 Encoded data --- @return binary data
\ No newline at end of file +-- @param buffer Base64 Encoded data +-- @return binary data diff --git a/libs/luci-lib-nixio/src/address.c b/libs/luci-lib-nixio/src/address.c index 7957e8cc19..0bf53caf82 100644 --- a/libs/luci-lib-nixio/src/address.c +++ b/libs/luci-lib-nixio/src/address.c @@ -544,7 +544,7 @@ static int nixio_getifaddrs(lua_State *L) { /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { #if defined(__linux__) || defined(BSD) {"getifaddrs", nixio_getifaddrs}, #endif @@ -554,7 +554,7 @@ static const luaL_reg R[] = { }; /* object table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"getsockname", nixio_sock_getsockname}, {"getpeername", nixio_sock_getpeername}, {NULL, NULL} diff --git a/libs/luci-lib-nixio/src/binary.c b/libs/luci-lib-nixio/src/binary.c index 2c41622280..da794536ce 100644 --- a/libs/luci-lib-nixio/src/binary.c +++ b/libs/luci-lib-nixio/src/binary.c @@ -296,7 +296,7 @@ static int nixio_bin_b64decode(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"hexlify", nixio_bin_hexlify}, {"unhexlify", nixio_bin_unhexlify}, {"crc32", nixio_bin_crc32}, diff --git a/libs/luci-lib-nixio/src/bind.c b/libs/luci-lib-nixio/src/bind.c index 68e1df8a8c..664d3e0634 100644 --- a/libs/luci-lib-nixio/src/bind.c +++ b/libs/luci-lib-nixio/src/bind.c @@ -269,14 +269,14 @@ static int nixio_sock_accept(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"bind", nixio_bind}, {"connect", nixio_connect}, {NULL, NULL} }; /* object table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"bind", nixio_sock_bind}, {"connect", nixio_sock_connect}, {"listen", nixio_sock_listen}, diff --git a/libs/luci-lib-nixio/src/bit.c b/libs/luci-lib-nixio/src/bit.c index 1b352c51c5..8c3c1b7980 100644 --- a/libs/luci-lib-nixio/src/bit.c +++ b/libs/luci-lib-nixio/src/bit.c @@ -120,7 +120,7 @@ static int nixio_bit_swap(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"bor", nixio_bit_or}, {"set", nixio_bit_or}, {"band", nixio_bit_and}, diff --git a/libs/luci-lib-nixio/src/file.c b/libs/luci-lib-nixio/src/file.c index cfa35dfd17..91468a258a 100644 --- a/libs/luci-lib-nixio/src/file.c +++ b/libs/luci-lib-nixio/src/file.c @@ -379,7 +379,7 @@ static int nixio_file__tostring(lua_State *L) { } /* method table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"write", nixio_file_write}, {"read", nixio_file_read}, {"tell", nixio_file_tell}, @@ -394,7 +394,7 @@ static const luaL_reg M[] = { }; /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"dup", nixio_dup}, {"open", nixio_open}, {"open_flags", nixio_open_flags}, diff --git a/libs/luci-lib-nixio/src/fs.c b/libs/luci-lib-nixio/src/fs.c index ba184ed119..28c675a106 100644 --- a/libs/luci-lib-nixio/src/fs.c +++ b/libs/luci-lib-nixio/src/fs.c @@ -519,7 +519,7 @@ static int nixio_statvfs(lua_State *L) { /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { #ifndef __WINNT__ {"glob", nixio_glob}, {"mkfifo", nixio_mkfifo}, diff --git a/libs/luci-lib-nixio/src/io.c b/libs/luci-lib-nixio/src/io.c index 12d5c7df45..a3b800e996 100644 --- a/libs/luci-lib-nixio/src/io.c +++ b/libs/luci-lib-nixio/src/io.c @@ -208,7 +208,7 @@ static int nixio_sock_recvfrom(lua_State *L) { /* module table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"send", nixio_sock_send}, {"sendto", nixio_sock_sendto}, {"recv", nixio_sock_recv}, diff --git a/libs/luci-lib-nixio/src/nixio.c b/libs/luci-lib-nixio/src/nixio.c index ae81c6f964..bb0a3270b5 100644 --- a/libs/luci-lib-nixio/src/nixio.c +++ b/libs/luci-lib-nixio/src/nixio.c @@ -102,7 +102,7 @@ static int nixio_strerror(lua_State *L) { } /* object table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"errno", nixio_errno}, {"strerror", nixio_strerror}, {NULL, NULL} diff --git a/libs/luci-lib-nixio/src/nixio.h b/libs/luci-lib-nixio/src/nixio.h index 8802e92043..5eb84d11ae 100644 --- a/libs/luci-lib-nixio/src/nixio.h +++ b/libs/luci-lib-nixio/src/nixio.h @@ -21,6 +21,10 @@ #include <lauxlib.h> #include <luaconf.h> +#if LUA_VERSION_NUM < 501 +#define luaL_Reg luaL_reg +#endif + #define NIXIO_BUFFERSIZE 8192 typedef struct nixio_socket { diff --git a/libs/luci-lib-nixio/src/poll.c b/libs/luci-lib-nixio/src/poll.c index 1211bc72ac..b013303ebd 100644 --- a/libs/luci-lib-nixio/src/poll.c +++ b/libs/luci-lib-nixio/src/poll.c @@ -197,7 +197,7 @@ static int nixio_poll(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"gettimeofday", nixio_gettimeofday}, {"nanosleep", nixio_nanosleep}, {"poll", nixio_poll}, diff --git a/libs/luci-lib-nixio/src/process.c b/libs/luci-lib-nixio/src/process.c index 5ae9b829ea..c7b52769b6 100644 --- a/libs/luci-lib-nixio/src/process.c +++ b/libs/luci-lib-nixio/src/process.c @@ -412,7 +412,7 @@ static int nixio_sysinfo(lua_State *L) { /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { #ifdef __linux__ {"sysinfo", nixio_sysinfo}, #endif diff --git a/libs/luci-lib-nixio/src/protoent.c b/libs/luci-lib-nixio/src/protoent.c index bda68a5845..e74b155b4f 100644 --- a/libs/luci-lib-nixio/src/protoent.c +++ b/libs/luci-lib-nixio/src/protoent.c @@ -91,7 +91,7 @@ static int nixio_getproto(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"getprotobyname", nixio_getprotobyname}, {"getprotobynumber", nixio_getprotobynumber}, {"getproto", nixio_getproto}, diff --git a/libs/luci-lib-nixio/src/socket.c b/libs/luci-lib-nixio/src/socket.c index 17c6afc790..b4b052eaa0 100644 --- a/libs/luci-lib-nixio/src/socket.c +++ b/libs/luci-lib-nixio/src/socket.c @@ -150,13 +150,13 @@ static int nixio_sock_shutdown(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"socket", nixio_socket}, {NULL, NULL} }; /* object table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"close", nixio_sock_close}, {"shutdown", nixio_sock_shutdown}, {"__gc", nixio_sock__gc}, diff --git a/libs/luci-lib-nixio/src/sockopt.c b/libs/luci-lib-nixio/src/sockopt.c index cede884ce4..7b6f0488b6 100644 --- a/libs/luci-lib-nixio/src/sockopt.c +++ b/libs/luci-lib-nixio/src/sockopt.c @@ -366,7 +366,7 @@ static int nixio_sock_setsockopt(lua_State *L) { } /* module table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"setblocking", nixio_sock_setblocking}, {"getsockopt", nixio_sock_getsockopt}, {"setsockopt", nixio_sock_setsockopt}, diff --git a/libs/luci-lib-nixio/src/splice.c b/libs/luci-lib-nixio/src/splice.c index db63ea9a89..7b6095a7be 100644 --- a/libs/luci-lib-nixio/src/splice.c +++ b/libs/luci-lib-nixio/src/splice.c @@ -161,7 +161,7 @@ static int nixio_sendfile(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { #ifdef _GNU_SOURCE #ifdef SPLICE_F_MOVE {"splice", nixio_splice}, diff --git a/libs/luci-lib-nixio/src/syslog.c b/libs/luci-lib-nixio/src/syslog.c index 89f1b1dda1..5ea181b74a 100644 --- a/libs/luci-lib-nixio/src/syslog.c +++ b/libs/luci-lib-nixio/src/syslog.c @@ -102,7 +102,7 @@ static int nixio_syslog(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"openlog", nixio_openlog}, {"syslog", nixio_syslog}, {"setlogmask", nixio_setlogmask}, diff --git a/libs/luci-lib-nixio/src/tls-context.c b/libs/luci-lib-nixio/src/tls-context.c index e9a833f590..29b1c8bd00 100644 --- a/libs/luci-lib-nixio/src/tls-context.c +++ b/libs/luci-lib-nixio/src/tls-context.c @@ -203,13 +203,13 @@ static int nixio_tls_ctx__tostring(lua_State *L) { } /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"tls", nixio_tls_ctx}, {NULL, NULL} }; /* ctx function table */ -static const luaL_reg CTX_M[] = { +static const luaL_Reg CTX_M[] = { {"set_cert", nixio_tls_ctx_set_cert}, {"set_verify_locations", nixio_tls_ctx_set_verify_locations}, {"set_key", nixio_tls_ctx_set_key}, diff --git a/libs/luci-lib-nixio/src/tls-crypto.c b/libs/luci-lib-nixio/src/tls-crypto.c index 714ec4e60c..1d4945c8c8 100644 --- a/libs/luci-lib-nixio/src/tls-crypto.c +++ b/libs/luci-lib-nixio/src/tls-crypto.c @@ -154,14 +154,14 @@ static int nixio_crypto_hash__tostring(lua_State *L) { /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"hash", nixio_crypto_hash}, {"hmac", nixio_crypto_hmac}, {NULL, NULL} }; /* hash table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"update", nixio_crypto_hash_update}, {"final", nixio_crypto_hash_final}, {"__gc", nixio_crypto_hash__gc}, diff --git a/libs/luci-lib-nixio/src/tls-socket.c b/libs/luci-lib-nixio/src/tls-socket.c index fe4cb60755..122f598e0a 100644 --- a/libs/luci-lib-nixio/src/tls-socket.c +++ b/libs/luci-lib-nixio/src/tls-socket.c @@ -239,7 +239,7 @@ static int nixio_tls_sock__tostring(lua_State *L) { /* ctx function table */ -static const luaL_reg M[] = { +static const luaL_Reg M[] = { {"recv", nixio_tls_sock_recv}, {"send", nixio_tls_sock_send}, {"read", nixio_tls_sock_recv}, diff --git a/libs/luci-lib-nixio/src/user.c b/libs/luci-lib-nixio/src/user.c index b701bac955..b4f5ea1d53 100644 --- a/libs/luci-lib-nixio/src/user.c +++ b/libs/luci-lib-nixio/src/user.c @@ -238,7 +238,7 @@ static int nixio_crypt(lua_State *L) { /* module table */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {"crypt", nixio_crypt}, {"getgr", nixio_getgr}, {"getpw", nixio_getpw}, @@ -252,7 +252,7 @@ static const luaL_reg R[] = { #else /* __WINNT__ */ -static const luaL_reg R[] = { +static const luaL_Reg R[] = { {NULL, NULL} }; diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c index 5dc436164d..1a1524d49e 100644 --- a/libs/rpcd-mod-luci/src/luci.c +++ b/libs/rpcd-mod-luci/src/luci.c @@ -783,7 +783,7 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname, int nret; if (!iw_backend || !iw_close || !iw_modenames) { - iwlib = dlopen("libiwinfo.so", RTLD_LOCAL); + iwlib = dlopen("libiwinfo.so", RTLD_LAZY | RTLD_LOCAL); if (!iwlib) return false; @@ -1283,14 +1283,14 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) ptr.option = "ip"; ptr.o = NULL; - if (uci_lookup_ptr(uci, &ptr, NULL, true) || ptr.o == NULL) - continue; - - if (ptr.o->type != UCI_TYPE_STRING) - continue; + if (!uci_lookup_ptr(uci, &ptr, NULL, true) && ptr.o != NULL && + ptr.o->type != UCI_TYPE_STRING) + n = ptr.o->v.string; + else + n = NULL; - if (inet_pton(AF_INET, ptr.o->v.string, &in) != 1) - continue; + if (!n || inet_pton(AF_INET, n, &in) != 1) + in.s_addr = 0; ptr.option = "name"; ptr.o = NULL; @@ -1316,7 +1316,7 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) if (!hint) continue; - if (hint->ip.s_addr == 0) + if (hint->ip.s_addr == 0 && in.s_addr != 0) hint->ip = in; if (n && !hint->hostname) @@ -1330,7 +1330,7 @@ rpc_luci_get_host_hints_uci(struct reply_context *rctx) if (!hint) continue; - if (hint->ip.s_addr == 0) + if (hint->ip.s_addr == 0 && in.s_addr != 0) hint->ip = in; if (n && !hint->hostname) diff --git a/libs/rpcd-mod-rad2-enc/Makefile b/libs/rpcd-mod-rad2-enc/Makefile index 4cffc01cd3..121e3a274f 100644 --- a/libs/rpcd-mod-rad2-enc/Makefile +++ b/libs/rpcd-mod-rad2-enc/Makefile @@ -8,7 +8,6 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd-mod-rad2-enc PKG_VERSION:=20190109 -PKG_MAINTAINER:=Daniel Dickinson <cshored@thecshore.com> PKG_LICENSE:=Apache-2.0 |