Compare commits

...
4 Commits
6 changed files with 28 additions and 13 deletions

No files matched your search

+1 -1
View File
@@ -213,7 +213,7 @@ addresses appear, it automatically listens on those (subject to any
access-control configuration). This makes dynamically created access-control configuration). This makes dynamically created
interfaces work in the same way as the default. Implementing this interfaces work in the same way as the default. Implementing this
option requires non-standard networking APIs and it is only availble option requires non-standard networking APIs and it is only availble
under Linux. under Linux. On other platforms it falls-back to --bind-interfaces mode.
.TP .TP
.B \-y, --localise-queries .B \-y, --localise-queries
Return answers to DNS queries from /etc/hosts which depend on the interface over which the query was Return answers to DNS queries from /etc/hosts which depend on the interface over which the query was
+6 -1
View File
@@ -115,8 +115,13 @@ int main (int argc, char **argv)
} }
# endif # endif
/* -- bind-dynamic not supported on !Linux, fall back to --bind-interfaces */
if (option_bool(OPT_CLEVERBIND)) if (option_bool(OPT_CLEVERBIND))
die(_("--bind-dynamic not available on this platform"), NULL, EC_BADCONF); {
bind_fallback = 1;
set_option_bool(OPT_NOWILD);
reset_option_bool(OPT_CLVERBIND);
}
#endif #endif
#ifndef HAVE_TFTP #ifndef HAVE_TFTP
+1
View File
@@ -932,6 +932,7 @@ char *option_string(int prot, unsigned int opt, unsigned char *val,
int opt_len, char *buf, int buf_len); int opt_len, char *buf, int buf_len);
void reread_dhcp(void); void reread_dhcp(void);
void set_option_bool(unsigned int opt); void set_option_bool(unsigned int opt);
void reset_option_bool(unsigned int opt);
struct hostsfile *expand_filelist(struct hostsfile *list); struct hostsfile *expand_filelist(struct hostsfile *list);
/* forward.c */ /* forward.c */
+3 -3
View File
@@ -188,7 +188,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
if (h->nlmsg_seq != seq || h->nlmsg_pid != netlink_pid || h->nlmsg_type == NLMSG_ERROR) if (h->nlmsg_seq != seq || h->nlmsg_pid != netlink_pid || h->nlmsg_type == NLMSG_ERROR)
{ {
/* May be multicast arriving async */ /* May be multicast arriving async */
if (nl_async(h)) if (nl_async(h) && option_bool(OPT_CLEVERBIND))
newaddr = 1; newaddr = 1;
} }
else if (h->nlmsg_type == NLMSG_DONE) else if (h->nlmsg_type == NLMSG_DONE)
@@ -319,7 +319,7 @@ void netlink_multicast(void)
if ((len = netlink_recv()) != -1) if ((len = netlink_recv()) != -1)
for (h = (struct nlmsghdr *)iov.iov_base; NLMSG_OK(h, (size_t)len); h = NLMSG_NEXT(h, len)) for (h = (struct nlmsghdr *)iov.iov_base; NLMSG_OK(h, (size_t)len); h = NLMSG_NEXT(h, len))
if (nl_async(h)) if (nl_async(h) && option_bool(OPT_CLEVERBIND))
newaddr = 1; newaddr = 1;
/* restore non-blocking status */ /* restore non-blocking status */
@@ -357,7 +357,7 @@ static int nl_async(struct nlmsghdr *h)
iface_enumerate and can't re-enter it now */ iface_enumerate and can't re-enter it now */
send_alarm(0, 0); send_alarm(0, 0);
} }
return !!option_bool(OPT_CLEVERBIND); /* clever bind mode - rescan */ return 1; /* clever bind mode - rescan */
} }
#endif #endif
+9 -8
View File
@@ -347,6 +347,7 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
if ((fd = socket(family, type, 0)) == -1) if ((fd = socket(family, type, 0)) == -1)
{ {
int port; int port;
char *s;
/* No error if the kernel just doesn't support this IP flavour */ /* No error if the kernel just doesn't support this IP flavour */
if (errno == EPROTONOSUPPORT || if (errno == EPROTONOSUPPORT ||
@@ -355,15 +356,15 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
return -1; return -1;
err: err:
if (dienow) port = prettyprint_addr(addr, daemon->addrbuff);
{ if (!option_bool(OPT_NOWILD) && !option_bool(OPT_CLEVERBIND))
port = prettyprint_addr(addr, daemon->namebuff); sprintf(daemon->addrbuff, "port %d", port);
if (!option_bool(OPT_NOWILD)) s = _("failed to create listening socket for %s: %s");
sprintf(daemon->namebuff, "port %d", port);
die(_("failed to create listening socket for %s: %s"),
daemon->namebuff, EC_BADNET);
} if (dienow)
die(s, daemon->addrbuff, EC_BADNET);
my_syslog(LOG_ERR, s, daemon->addrbuff, strerror(errno));
return -1; return -1;
} }
+8
View File
@@ -1119,6 +1119,14 @@ void set_option_bool(unsigned int opt)
daemon->options2 |= 1u << (opt - 32); daemon->options2 |= 1u << (opt - 32);
} }
void reset_option_bool(unsigned int opt)
{
if (opt < 32)
daemon->options &= ~(1u << opt);
else
daemon->options2 &= ~(1u << (opt - 32));
}
static char *one_opt(int option, char *arg, char *gen_prob, int command_line) static char *one_opt(int option, char *arg, char *gen_prob, int command_line)
{ {
int i; int i;