Compare commits

...
4 Commits
6 changed files with 30 additions and 15 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
interfaces work in the same way as the default. Implementing this
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
.B \-y, --localise-queries
Return answers to DNS queries from /etc/hosts which depend on the interface over which the query was
+8 -3
View File
@@ -114,11 +114,16 @@ int main (int argc, char **argv)
set_option_bool(OPT_NOWILD);
}
# endif
/* -- bind-dynamic not supported on !Linux, fall back to --bind-interfaces */
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
#ifndef HAVE_TFTP
if (daemon->tftp_unlimited || daemon->tftp_interfaces)
die(_("TFTP server not available: set HAVE_TFTP in src/config.h"), NULL, EC_BADCONF);
+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);
void reread_dhcp(void);
void set_option_bool(unsigned int opt);
void reset_option_bool(unsigned int opt);
struct hostsfile *expand_filelist(struct hostsfile *list);
/* 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)
{
/* May be multicast arriving async */
if (nl_async(h))
if (nl_async(h) && option_bool(OPT_CLEVERBIND))
newaddr = 1;
}
else if (h->nlmsg_type == NLMSG_DONE)
@@ -319,7 +319,7 @@ void netlink_multicast(void)
if ((len = netlink_recv()) != -1)
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;
/* restore non-blocking status */
@@ -357,7 +357,7 @@ static int nl_async(struct nlmsghdr *h)
iface_enumerate and can't re-enter it now */
send_alarm(0, 0);
}
return !!option_bool(OPT_CLEVERBIND); /* clever bind mode - rescan */
return 1; /* clever bind mode - rescan */
}
#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)
{
int port;
char *s;
/* No error if the kernel just doesn't support this IP flavour */
if (errno == EPROTONOSUPPORT ||
@@ -355,15 +356,15 @@ static int make_sock(union mysockaddr *addr, int type, int dienow)
return -1;
err:
port = prettyprint_addr(addr, daemon->addrbuff);
if (!option_bool(OPT_NOWILD) && !option_bool(OPT_CLEVERBIND))
sprintf(daemon->addrbuff, "port %d", port);
s = _("failed to create listening socket for %s: %s");
if (dienow)
{
port = prettyprint_addr(addr, daemon->namebuff);
if (!option_bool(OPT_NOWILD))
sprintf(daemon->namebuff, "port %d", port);
die(_("failed to create listening socket for %s: %s"),
daemon->namebuff, EC_BADNET);
}
die(s, daemon->addrbuff, EC_BADNET);
my_syslog(LOG_ERR, s, daemon->addrbuff, strerror(errno));
return -1;
}
+8
View File
@@ -1119,6 +1119,14 @@ void set_option_bool(unsigned int opt)
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)
{
int i;