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-gita3303e196.patch
1 From 2c1aec1e979a209eb2f2b035314a8c973b4ac269 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Thu, 7 Sep 2017 20:45:00 +0100
4 Subject: [PATCH 7/9]     Don't return arcount=1 if EDNS0 RR won't fit in the
5  packet.
6
7     Omitting the EDNS0 RR but setting arcount gives a malformed packet.
8     Also, don't accept UDP packet size less than 512 in recieved EDNS0.
9 ---
10  src/edns0.c   | 5 ++++-
11  src/forward.c | 2 ++
12  2 files changed, 6 insertions(+), 1 deletion(-)
13
14 diff --git a/src/edns0.c b/src/edns0.c
15 index 5bdc133..a8d0167 100644
16 --- a/src/edns0.c
17 +++ b/src/edns0.c
18 @@ -221,7 +221,10 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l
19           free(buff);
20           p += rdlen;
21         }
22 -      header->arcount = htons(ntohs(header->arcount) + 1);
23 +      
24 +      /* Only bump arcount if RR is going to fit */ 
25 +      if (((ssize_t)optlen) <= (limit - (p + 4)))
26 +       header->arcount = htons(ntohs(header->arcount) + 1);
27      }
28    
29    if (((ssize_t)optlen) > (limit - (p + 4)))
30 diff --git a/src/forward.c b/src/forward.c
31 index 9b464d3..0f8f462 100644
32 --- a/src/forward.c
33 +++ b/src/forward.c
34 @@ -1408,6 +1408,8 @@ void receive_query(struct listener *listen, time_t now)
35          defaults to 512 */
36        if (udp_size > daemon->edns_pktsz)
37         udp_size = daemon->edns_pktsz;
38 +      else if (udp_size < PACKETSZ)
39 +       udp_size = PACKETSZ; /* Sanity check - can't reduce below default. RFC 6891 6.2.3 */
40      }
41  
42  #ifdef HAVE_AUTH
43 -- 
44 2.9.5
45