1 From c3d10a1132ada7baa80914f61abb720f94400465 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
3 Date: Tue, 14 Mar 2017 15:23:22 +0100
4 Subject: [PATCH 1/2] Warn when using label in default mode
9 src/network.c | 13 +++++++++++++
10 3 files changed, 17 insertions(+), 1 deletion(-)
12 diff --git a/src/dnsmasq.c b/src/dnsmasq.c
13 index 456b0e8..d2cc7cc 100644
16 @@ -771,6 +771,8 @@ int main (int argc, char **argv)
18 if (option_bool(OPT_NOWILD))
19 warn_bound_listeners();
20 + else if (!option_bool(OPT_CLEVERBIND))
25 diff --git a/src/dnsmasq.h b/src/dnsmasq.h
26 index a27fbc1..6b44e53 100644
29 @@ -522,7 +522,7 @@ struct ipsets {
31 union mysockaddr addr;
32 struct in_addr netmask; /* only valid for IPv4 */
33 - int tftp_ok, dhcp_ok, mtu, done, warned, dad, dns_auth, index, multicast_done, found;
34 + int tftp_ok, dhcp_ok, mtu, done, warned, dad, dns_auth, index, multicast_done, found, label;
38 @@ -1252,6 +1252,7 @@ int enumerate_interfaces(int reset);
39 void create_wildcard_listeners(void);
40 void create_bound_listeners(int die);
41 void warn_bound_listeners(void);
42 +void warn_wild_labels(void);
43 void warn_int_names(void);
44 int is_dad_listeners(void);
45 int iface_check(int family, struct all_addr *addr, char *name, int *auth_dns);
46 diff --git a/src/network.c b/src/network.c
47 index eb41624..e5ceb76 100644
50 @@ -244,6 +244,7 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
51 int tftp_ok = !!option_bool(OPT_TFTP);
55 #if defined(HAVE_DHCP) || defined(HAVE_TFTP)
58 @@ -264,6 +265,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
63 + is_label = strcmp(label, ifr.ifr_name);
65 /* maintain a list of all addresses on all interfaces for --local-service option */
66 if (option_bool(OPT_LOCAL_SERVICE))
67 @@ -482,6 +485,7 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
69 iface->done = iface->multicast_done = iface->warned = 0;
70 iface->index = if_index;
71 + iface->label = is_label;
72 if ((iface->name = whine_malloc(strlen(ifr.ifr_name)+1)))
74 strcpy(iface->name, ifr.ifr_name);
75 @@ -1034,6 +1038,15 @@ void warn_bound_listeners(void)
76 my_syslog(LOG_WARNING, _("LOUD WARNING: use --bind-dynamic rather than --bind-interfaces to avoid DNS amplification attacks via these interface(s)"));
79 +void warn_wild_labels(void)
83 + for (iface = daemon->interfaces; iface; iface = iface->next)
84 + if (iface->found && iface->name && iface->label)
85 + my_syslog(LOG_WARNING, _("warning: using interface %s instead"), iface->name);
88 void warn_int_names(void)
90 struct interface_name *intname;