Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / dnsmasq / dnsmasq / stx / dnsmasq-2.76-label-warning.patch
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
5
6 ---
7  src/dnsmasq.c |  2 ++
8  src/dnsmasq.h |  3 ++-
9  src/network.c | 13 +++++++++++++
10  3 files changed, 17 insertions(+), 1 deletion(-)
11
12 diff --git a/src/dnsmasq.c b/src/dnsmasq.c
13 index 456b0e8..d2cc7cc 100644
14 --- a/src/dnsmasq.c
15 +++ b/src/dnsmasq.c
16 @@ -771,6 +771,8 @@ int main (int argc, char **argv)
17  
18    if (option_bool(OPT_NOWILD))
19      warn_bound_listeners();
20 +  else if (!option_bool(OPT_CLEVERBIND))
21 +    warn_wild_labels();
22  
23    warn_int_names();
24    
25 diff --git a/src/dnsmasq.h b/src/dnsmasq.h
26 index a27fbc1..6b44e53 100644
27 --- a/src/dnsmasq.h
28 +++ b/src/dnsmasq.h
29 @@ -522,7 +522,7 @@ struct ipsets {
30  struct irec {
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;
35    char *name; 
36    struct irec *next;
37  };
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
48 --- a/src/network.c
49 +++ b/src/network.c
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);
52    int dhcp_ok = 1;
53    int auth_dns = 0;
54 +  int is_label = 0;
55  #if defined(HAVE_DHCP) || defined(HAVE_TFTP)
56    struct iname *tmp;
57  #endif
58 @@ -264,6 +265,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
59    
60    if (!label)
61      label = ifr.ifr_name;
62 +  else
63 +    is_label = strcmp(label, ifr.ifr_name);
64   
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,
68        iface->found = 1;
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)))
73         {
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)")); 
77  }
78  
79 +void warn_wild_labels(void)
80 +{
81 +  struct irec *iface;
82 +
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);
86 +}
87 +
88  void warn_int_names(void)
89  {
90    struct interface_name *intname;
91 -- 
92 2.9.3
93