Update to 2.79 05/182205/2
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 21 Jun 2018 07:36:11 +0000 (16:36 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 21 Jun 2018 07:54:17 +0000 (16:54 +0900)
Change-Id: I36382b896dd583a66872d458f1c3b55461a9e95d

1  2 
CMakeLists.txt
packaging/dnsmasq.spec
src/config.h
src/rfc1035.c
src/rfc3315.c

diff --cc CMakeLists.txt
index a31e829,0000000..4b27a71
mode 100644,000000..100644
--- /dev/null
@@@ -1,76 -1,0 +1,81 @@@
- SET(SRCS      src/auth.c
-               src/blockdata.c
-               src/bpf.c
-               src/cache.c
-               src/conntrack.c
-               src/dbus.c
-               src/dhcp6.c
-               src/dhcp.c
-               src/dhcp-common.c
-               src/dnsmasq.c
-               src/dnssec.c
-               src/domain.c
-               src/forward.c
-               src/helper.c
-               src/inotify.c
-               src/ipset.c
-               src/lease.c
-               src/log.c
-               src/loop.c
-               src/netlink.c
-               src/network.c
-               src/option.c
-               src/outpacket.c
-               src/poll.c
-               src/radv.c
-               src/rfc1035.c
-               src/rfc2131.c
-               src/rfc3315.c
-               src/slaac.c
-               src/tables.c
-               src/tftp.c
-               src/util.c
-    )
 +CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 +PROJECT(dnsmasq C)
 +
++SET(SRCS
++      src/arp.c
++      src/auth.c
++      src/blockdata.c
++      src/bpf.c
++      src/cache.c
++      src/conntrack.c
++      src/crypto.c
++      src/dbus.c
++      src/dhcp6.c
++      src/dhcp.c
++      src/dhcp-common.c
++      src/dnsmasq.c
++      src/dnssec.c
++      src/domain.c
++      src/edns0.c
++      src/forward.c
++      src/helper.c
++      src/inotify.c
++      src/ipset.c
++      src/lease.c
++      src/log.c
++      src/loop.c
++      src/netlink.c
++      src/network.c
++      src/option.c
++      src/outpacket.c
++      src/poll.c
++      src/radv.c
++      src/rfc1035.c
++      src/rfc2131.c
++      src/rfc3315.c
++      src/rrfilter.c
++      src/slaac.c
++      src/tables.c
++      src/tftp.c
++      src/util.c
++)
 +
 +SET(PACKAGE ${PROJECT_NAME})
 +SET(PKGNAME ${PACKAGE})
 +SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 +SET(BINDIR "${PREFIX}/bin")
 +
 +IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 +      SET(CMAKE_BUILD_TYPE "Release")
 +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 +
 +#INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 +
 +INCLUDE(FindPkgConfig)
 +pkg_check_modules(pkgs REQUIRED dbus-1)
 +
 +FOREACH(flag ${pkgs_CFLAGS})
 +      SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 +ENDFOREACH(flag)
 +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
 +
 +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
 +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 +SET(CMAKE_C_FLAGS_RELEASE "-O2")
 +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 +
 +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
 +ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
 +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 +
 +FIND_PROGRAM(UNAME NAMES uname)
 +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
 +#IF("${ARCH}" STREQUAL "arm")
 +#     ADD_DEFINITIONS("-D_MMICHECK_ARM_CODE_")
 +#ENDIF("${ARCH}" STREQUAL "arm")
 +
 +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 +
 +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
index cf899d3,0000000..51fb21b
mode 100644,000000..100644
--- /dev/null
@@@ -1,42 -1,0 +1,42 @@@
- Version:    2.74
 +Name:       dnsmasq
 +Summary:    dnsmasq, DNS forwarder.
++Version:    2.79
 +Release:    1
 +Group:      System/Network
 +License:    GPL-2.0+
 +Source0:    %{name}-%{version}.tar.gz
 +Source1001:     packaging/dnsmasq.manifest
 +BuildRequires: cmake
 +BuildRequires: pkgconfig(dbus-1)
 +BuildRequires: pkgconfig(libtzplatform-config)
 +
 +%description
 +Dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP server.
 +It is designed to provide DNS and, optionally, DHCP, to a small network.
 +It can serve the names of local machines that are not in the global DNS.
 +The DHCP server integrates with the DNS server and allows machines with
 +DHCP-allocated addresses to appear in DNS with names configured either
 +in each host or in a central configuration file. Dnsmasq supports static
 +and dynamic DHCP leases and BOOTP for network booting of diskless machines.
 +
 +%prep
 +%setup -q
 +cp %{SOURCE1001} .
 +
 +%build
 +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 +make %{?jobs:-j%jobs}
 +
 +%post
 +mkdir -p %{TZ_SYS_VAR}/lib/misc
 +
 +%install
 +%make_install
 +mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
 +cp dbus/dnsmasq.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/dnsmasq.conf
 +
 +%files
 +%manifest %{name}.manifest
 +%{_bindir}/dnsmasq
 +%license COPYING
 +%attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/*
diff --cc src/config.h
@@@ -14,8 -14,6 +14,8 @@@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
  
- #define VERSION "2.74"
++#define VERSION "2.79"
 +
  #define FTABSIZ 150 /* max number of outstanding requests (default) */
  #define MAX_PROCS 20 /* max no children for TCP requests */
  #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */
@@@ -172,8 -173,9 +175,9 @@@ RESOLVFIL
  */
  
  /* #define HAVE_LUASCRIPT */
 -/* #define HAVE_DBUS */
 +#define HAVE_DBUS
  /* #define HAVE_IDN */
+ /* #define HAVE_LIBIDN2 */
  /* #define HAVE_CONNTRACK */
  /* #define HAVE_DNSSEC */
  
diff --cc src/rfc1035.c
Simple merge
diff --cc src/rfc3315.c
@@@ -88,8 -88,8 +88,8 @@@ unsigned short dhcp6_reply(struct dhcp_
    /* Mark these so we only match each at most once, to avoid tangled linked lists */
    for (vendor = daemon->dhcp_vendors; vendor; vendor = vendor->next)
      vendor->netid.next = &vendor->netid;
 -  
 +
-   save_counter(0);
+   reset_counter();
    state.context = context;
    state.interface = interface;
    state.iface_name = iface_name;
@@@ -118,19 -118,19 +118,19 @@@ static int dhcp6_maybe_relay(struct sta
    void *opt;
    struct dhcp_vendor *vendor;
  
-   /* if not an encaplsulated relayed message, just do the stuff */
+   /* if not an encapsulated relayed message, just do the stuff */
    if (msg_type != DHCP6RELAYFORW)
      {
 -      /* if link_address != NULL if points to the link address field of the 
 +      /* if link_address != NULL if points to the link address field of the
         innermost nested RELAYFORW message, which is where we find the
         address of the network on which we can allocate an address.
 -       Recalculate the available contexts using that information. 
 +       Recalculate the available contexts using that information.
  
 -      link_address == NULL means there's no relay in use, so we try and find the client's 
 +      link_address == NULL means there's no relay in use, so we try and find the client's
        MAC address from the local ND cache. */
 -      
 +
        if (!state->link_address)
-       get_client_mac(client_addr, state->interface, state->mac, &state->mac_len, &state->mac_type);
+       get_client_mac(client_addr, state->interface, state->mac, &state->mac_len, &state->mac_type, now);
        else
        {
          struct dhcp_context *c;
        state->mac_len = opt6_len(opt) - 2;
        memcpy(&state->mac[0], opt6_ptr(opt, 2), state->mac_len);
      }
 -  
 +
    for (opt = opts; opt; opt = opt6_next(opt, end))
      {
-       if (opt6_ptr(opt, 0) + opt6_len(opt) >= end) {
 -      if (opt6_ptr(opt, 0) + opt6_len(opt) > end) 
++      if (opt6_ptr(opt, 0) + opt6_len(opt) > end)
          return 0;
-       }
 -     
++
        int o = new_opt6(opt6_type(opt));
        if (opt6_type(opt) == OPTION6_RELAY_MSG)
        {
@@@ -384,10 -384,10 +384,10 @@@ static int dhcp6_no_relay(struct state 
  
    if (option_bool(OPT_LOG_OPTS) && (opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4)))
      my_syslog(MS_DHCP | LOG_INFO, _("%u vendor class: %u"), state->xid, opt6_uint(opt, 0, 4));
 -  
 +
    /* dhcp-match. If we have hex-and-wildcards, look for a left-anchored match.
 -     Otherwise assume the option is an array, and look for a matching element. 
 -     If no data given, existence of the option is enough. This code handles 
 +     Otherwise assume the option is an array, and look for a matching element.
-      If no data given, existance of the option is enough. This code handles
++     If no data given, existence of the option is enough. This code handles
       V-I opts too. */
    for (opt_cfg = daemon->dhcp_match6; opt_cfg; opt_cfg = opt_cfg->next)
      {
        if (have_config(config, CONFIG_DISABLE))
        ignore = 1;
      }
 -  
+   else if (state->clid &&
+          find_config(daemon->dhcp_conf, NULL, state->clid, state->clid_len, state->mac, state->mac_len, state->mac_type, NULL))
+     {
+       known_id.net = "known-othernet";
+       known_id.next = state->tags;
+       state->tags = &known_id;
+     }
 +
  #ifdef OPTION6_PREFIX_CLASS
    /* OPTION_PREFIX_CLASS in ORO, send addresses in all prefix classes */
    if (daemon->prefix_classes && (msg_type == DHCP6SOLICIT || msg_type == DHCP6REQUEST))
  
             if (!ia_option)
               {
-                /* If we get a request with a IA_*A without addresses, treat it exactly like
+                /* If we get a request with an IA_*A without addresses, treat it exactly like
                    a SOLICT with rapid commit set. */
                 save_counter(start);
 -               goto request_no_address; 
 +               goto request_no_address;
               }
  
            o = build_ia(state, &t1cntr);
                put_opt6_short(DHCP6NOBINDING);
                put_opt6_string(_("no binding found"));
                end_opt6(o1);
 -              
 +
                end_opt6(o);
              }
 -          
 +
          }
  
-       /* We must anwser with 'success' in global section anyway */
+       /* We must answer with 'success' in global section anyway */
        o1 = new_opt6(OPTION6_STATUS_CODE);
        put_opt6_short(DHCP6SUCCESS);
        put_opt6_string(_("success"));
@@@ -1323,19 -1330,19 +1330,19 @@@ static struct dhcp_netid *add_options(s
          if (i >=  opt6_len(oro) - 1)
            continue;
        }
 -      
 +
        if (opt_cfg->opt == OPTION6_REFRESH_TIME)
        done_refresh = 1;
 -       
 +
+       if (opt_cfg->opt == OPTION6_DNS_SERVER)
+       done_dns = 1;
 -      
++
        if (opt_cfg->flags & DHOPT_ADDR6)
        {
          int len, j;
          struct in6_addr *a;
 -        
 -        for (a = (struct in6_addr *)opt_cfg->val, len = opt_cfg->len, j = 0; 
 +
-         if (opt_cfg->opt == OPTION6_DNS_SERVER)
-           done_dns = 1;
 +        for (a = (struct in6_addr *)opt_cfg->val, len = opt_cfg->len, j = 0;
               j < opt_cfg->len; j += IN6ADDRSZ, a++)
            if ((IN6_IS_ADDR_ULA_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ula_addr)) ||
                (IN6_IS_ADDR_LINK_LOCAL_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ll_addr)))
      {
        struct dhcp_context *c;
        unsigned int lease_time = 0xffffffff;
 -      
 +
        /* Find the smallest lease tie of all contexts,
-        subjext to the RFC-4242 stipulation that this must not
 -       subject to the RFC-4242 stipulation that this must not 
++       subject to the RFC-4242 stipulation that this must not
         be less than 600. */
        for (c = state->context; c; c = c->next)
        if (c->lease_time < lease_time)
@@@ -2053,17 -2060,18 +2060,18 @@@ static unsigned int opt6_uint(unsigned 
    unsigned int ret = 0;
    int i;
    unsigned char *p = opt6_ptr(opt, offset);
 -  
 +
    for (i = 0; i < size; i++)
      ret = (ret << 8) | *p++;
 -  
 +
    return ret;
 -} 
 +}
  
- void relay_upstream6(struct dhcp_relay *relay, ssize_t sz, struct in6_addr *peer_address, u32 scope_id)
 -void relay_upstream6(struct dhcp_relay *relay, ssize_t sz, 
++void relay_upstream6(struct dhcp_relay *relay, ssize_t sz,
+                    struct in6_addr *peer_address, u32 scope_id, time_t now)
  {
    /* ->local is same value for all relays on ->current chain */
 -  
 +
    struct all_addr from;
    unsigned char *header;
    unsigned char *inbuff = daemon->dhcp_packet.iov_base;
                  setsockopt(daemon->dhcp6fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, &multicast_iface, sizeof(multicast_iface)) == -1)
                my_syslog(MS_DHCP | LOG_ERR, _("Cannot multicast to DHCPv6 server without correct interface"));
            }
 -              
 +
-         send_from(daemon->dhcp6fd, 0, daemon->outpacket.iov_base, save_counter(0), &to, &from, 0);
+         send_from(daemon->dhcp6fd, 0, daemon->outpacket.iov_base, save_counter(-1), &to, &from, 0);
 -        
 +
          if (option_bool(OPT_LOG_OPTS))
            {
              inet_ntop(AF_INET6, &relay->local, daemon->addrbuff, ADDRSTRLEN);
@@@ -2165,8 -2173,8 +2173,8 @@@ unsigned short relay_reply6(struct sock
      if (IN6_ARE_ADDR_EQUAL(&link, &relay->local.addr.addr6) &&
        (!relay->interface || wildcard_match(relay->interface, arrival_interface)))
        break;
 -      
 +
-   save_counter(0);
+   reset_counter();
  
    if (relay)
      {