mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 09:12:39 +00:00
8c0f6a010a
Backport upstream commits. Most interesting 122392e which changes how SERVFAIL is handled especially in event of genuine server down/failure scenarios with multiple servers. a799ca0 also interesting in that answered received via TCP are now cached, DNSSEC typically using TCP meant until now answers weren't cached, hence reducing performance. 59e4703 Free config file values on parsing errors. 48d12f1 Remove the NO_FORK compile-time option, and support for uclinux. 122392e Revert 68f6312d4bae30b78daafcd6f51dc441b8685b1e 3a5a84c Fix Makefile lines generating UBUS linker config. 24b8760 Do not rely on dead code elimination, use array instead. Make options bits derived from size and count. Use size of option bits and last supported bit in computation. No new change would be required when new options are added. Just change OPT_LAST constant. 6f7812d Fix spurious AD flags in some DNS replies from local config. cbb5b17 Fix logging in cf5984367bc6a949e3803a576512c5a7bc48ebab cf59843 Don't forward *.bind/*.server queries upstream ee87504 Remove ability to compile without IPv6 support. a220545 Ensure that AD bit is reset on answers from --address=/<domain>/<address>. a799ca0 Impove cache behaviour for TCP connections. Along with an additional patch to fix compilation without DHCPv6, sent upstream. I've been running this for aaaages without obvious issue hence brave step of opening to wider openwrt community. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
65 lines
1.9 KiB
Diff
65 lines
1.9 KiB
Diff
--- a/src/ipset.c
|
|
+++ b/src/ipset.c
|
|
@@ -22,7 +22,6 @@
|
|
#include <errno.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
-#include <sys/utsname.h>
|
|
#include <arpa/inet.h>
|
|
#include <linux/version.h>
|
|
#include <linux/netlink.h>
|
|
@@ -72,7 +71,7 @@ struct my_nfgenmsg {
|
|
|
|
#define NL_ALIGN(len) (((len)+3) & ~(3))
|
|
static const struct sockaddr_nl snl = { .nl_family = AF_NETLINK };
|
|
-static int ipset_sock, old_kernel;
|
|
+static int ipset_sock;
|
|
static char *buffer;
|
|
|
|
static inline void add_attr(struct nlmsghdr *nlh, uint16_t type, size_t len, const void *data)
|
|
@@ -87,25 +86,7 @@ static inline void add_attr(struct nlmsg
|
|
|
|
void ipset_init(void)
|
|
{
|
|
- struct utsname utsname;
|
|
- int version;
|
|
- char *split;
|
|
-
|
|
- if (uname(&utsname) < 0)
|
|
- die(_("failed to find kernel version: %s"), NULL, EC_MISC);
|
|
-
|
|
- split = strtok(utsname.release, ".");
|
|
- version = (split ? atoi(split) : 0);
|
|
- split = strtok(NULL, ".");
|
|
- version = version * 256 + (split ? atoi(split) : 0);
|
|
- split = strtok(NULL, ".");
|
|
- version = version * 256 + (split ? atoi(split) : 0);
|
|
- old_kernel = (version < KERNEL_VERSION(2,6,32));
|
|
-
|
|
- if (old_kernel && (ipset_sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) != -1)
|
|
- return;
|
|
-
|
|
- if (!old_kernel &&
|
|
+ if (
|
|
(buffer = safe_malloc(BUFF_SZ)) &&
|
|
(ipset_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER)) != -1 &&
|
|
(bind(ipset_sock, (struct sockaddr *)&snl, sizeof(snl)) != -1))
|
|
@@ -211,16 +192,9 @@ int add_to_ipset(const char *setname, co
|
|
if (flags & F_IPV6)
|
|
{
|
|
af = AF_INET6;
|
|
- /* old method only supports IPv4 */
|
|
- if (old_kernel)
|
|
- {
|
|
- errno = EAFNOSUPPORT ;
|
|
- ret = -1;
|
|
- }
|
|
}
|
|
|
|
- if (ret != -1)
|
|
- ret = old_kernel ? old_add_to_ipset(setname, ipaddr, remove) : new_add_to_ipset(setname, ipaddr, af, remove);
|
|
+ ret = new_add_to_ipset(setname, ipaddr, af, remove);
|
|
|
|
if (ret == -1)
|
|
my_syslog(LOG_ERR, _("failed to update ipset %s: %s"), setname, strerror(errno));
|