Example #1
0
 public V6BindingAddress(IaAddress iaAddr, DhcpConfigObject configObj)
 {
     //  populate *this* IaAddress from the given one
     this.SetDhcpOptions(iaAddr.GetDhcpOptions());
     this.SetId(iaAddr.GetId());
     this.SetIdentityAssocId(iaAddr.GetIdentityAssocId());
     this.SetIpAddress(iaAddr.GetIpAddress());
     this.SetPreferredEndTime(iaAddr.GetPreferredEndTime());
     this.SetStartTime(iaAddr.GetStartTime());
     this.SetState(iaAddr.GetState());
     this.SetValidEndTime(iaAddr.GetValidEndTime());
     this.configObj = configObj;
 }
 /**
  * Instantiates a new binding address.
  *
  * @param iaPrefix the ia addr
  * @param configObj the config object
  */
 public V6BindingPrefix(IaPrefix iaPrefix, DhcpConfigObject configObj)
 {
     // populate *this* IaPrefix from the given one
     this.SetDhcpOptions(iaPrefix.GetDhcpOptions());
     this.SetId(iaPrefix.GetId());
     this.SetIdentityAssocId(iaPrefix.GetIdentityAssocId());
     this.SetIpAddress(iaPrefix.GetIpAddress());
     this.SetPreferredEndTime(iaPrefix.GetPreferredEndTime());
     this.SetPrefixLength(iaPrefix.GetPrefixLength());
     this.SetStartTime(iaPrefix.GetStartTime());
     this.SetState(iaPrefix.GetState());
     this.SetValidEndTime(iaPrefix.GetValidEndTime());
     this.configObj = configObj;
 }
 /// <summary>
 /// Sets the lifetimes of the given collection of binding objects.
 /// </summary>
 /// <param name="bindingObjs">Sets the collection of binding objects to set lifetimes in</param>
 protected void SetBindingObjsTimes(HashSet <BindingObject> bindingObjs)
 {
     if ((bindingObjs != null) && bindingObjs.Count > 0)
     {
         foreach (BindingObject bindingObj in bindingObjs)
         {
             DhcpConfigObject configObj = bindingObj.GetConfigObj();
             SetBindingObjectTimes(bindingObj,
                                   configObj.GetPreferredLifetimeMs(),
                                   configObj.GetValidLifetimeMs());
             //TODO: if we store the options, and they have changed,
             //      then we must update those options here somehow
         }
     }
 }
Example #4
0
 /**
  * Instantiates a new ddns updater.
  *
  * @param requestMsg the request msg
  * @param clientLink the client link
  * @param bindingAddr the binding addr
  * @param fqdn the fqdn
  * @param doForwardUpdate the do forward update
  * @param isDelete the is delete
  */
 public DdnsUpdater(DhcpMessage requestMsg, link clientLink, DhcpConfigObject configObj,
                    IPAddress addr, string fqdn, byte[] duid, long lifetime,
                    bool doForwardUpdate, bool isDelete,
                    DdnsCallback callback)
 {
     this.requestMsg      = requestMsg;
     this.duid            = duid;
     this.clientLink      = clientLink;
     this.configObj       = configObj;
     this.addr            = addr;
     this.fqdn            = fqdn;
     this.lifetime        = lifetime;
     this.doForwardUpdate = doForwardUpdate;
     this.isDelete        = isDelete;
     this.callback        = callback;
 }
 public static string EffectivePolicy(DhcpMessage requestMsg,
                                      DhcpConfigObject configObj, link link, Property prop)
 {
     //string policy = null;
     //if ((requestMsg != null) && (configObj != null))
     //{
     //    if (configObj.GetFilters() != null)
     //    {
     //        List<filter> filters = configObj.GetFilters().filter;
     //        if (filters != null)
     //        {
     //            for (Filter filter : filters)
     //            {
     //                if (DhcpServerConfiguration.msgMatchesFilter(requestMsg, filter))
     //                {
     //                    policy = getPolicy(filter.getPolicies(), prop.key());
     //                }
     //            }
     //            // if the client request matches at least one filter on the pool,
     //            // and that filter has configured a value for the policy, then return
     //            // that value from the last filter that the client matches
     //            if (policy != null)
     //            {
     //                return policy;
     //            }
     //        }
     //    }
     //}
     //if (configObj != null)
     //{
     //    // client does not match a pool filter
     //    // get the value of the policy on the pool, if any
     //    policy = getPolicy(configObj.getPolicies(), prop.key());
     //    if (policy != null)
     //    {
     //        return policy;
     //    }
     //}
     return(EffectivePolicy(requestMsg, link, prop));
 }
        /**
         * Effective policy.
         *
         * @param pool the pool
         * @param link the link
         * @param prop the prop
         *
         * @return the string
         */
        public static string EffectivePolicy(DhcpConfigObject configObj, link link, Property prop)
        {
            string policy = null;

            if (configObj != null)
            {
                policy = GetPolicy(configObj.GetPolicies(), prop.Key());
                if (policy != null)
                {
                    return(policy);
                }
            }
            if (link != null)
            {
                policy = GetPolicy(link.policies, prop.Key());
                if (policy != null)
                {
                    return(policy);
                }
            }
            return(GlobalPolicy(prop));
        }
Example #7
0
        //private link link;
        //private IPAddress iPAddress;
        //private byte[] v1;
        //private bool v2;
        //private bool v3;
        //private DdnsCallback ddnsComplete;

        /**
         * Instantiates a new ddns updater.
         *
         * @param clientLink the client link
         * @param bindingAddr the binding addr
         * @param fqdn the fqdn
         * @param duid the duid
         * @param doForwardUpdate the do forward update
         * @param isDelete the is delete
         */
        public DdnsUpdater(link clientLink, DhcpConfigObject configObj,
                           IPAddress addr, string fqdn, byte[] duid, long lifetime,
                           bool doForwardUpdate, bool isDelete, DdnsCallback callback) :
            this(null, clientLink, configObj, addr, fqdn, duid, lifetime, doForwardUpdate, isDelete, callback)
        {
        }
Example #8
0
        protected void ProcessDdnsUpdates(bool sendUpdates)
        {
            bool doForwardUpdate = true;

            DhcpV4ClientFqdnOption clientFqdnOption = (DhcpV4ClientFqdnOption)_requestMsg.GetDhcpOption(DhcpConstants.V4OPTION_CLIENT_FQDN);
            DhcpV4HostnameOption   hostnameOption   = (DhcpV4HostnameOption)_requestMsg.GetDhcpOption(DhcpConstants.V4OPTION_HOSTNAME);

            if (clientFqdnOption == null && hostnameOption == null)
            {
                //TODO allow name generation?
                log.Debug("No Client FQDN nor hostname option in request.  Skipping DDNS update processing.");
                return;
            }

            string fqdn   = "";
            string domain = DhcpServerPolicies.DffectivePolicy(_clientLink.GetLink(), Property.DDNS_DOMAIN);
            DhcpV4ClientFqdnOption replyFqdnOption = null;

            if (clientFqdnOption != null)
            {
                replyFqdnOption = new DhcpV4ClientFqdnOption();
                replyFqdnOption.SetDomainName(clientFqdnOption.GetDomainName());
                replyFqdnOption.SetUpdateABit(false);
                replyFqdnOption.SetOverrideBit(false);
                replyFqdnOption.SetNoUpdateBit(false);
                replyFqdnOption.SetEncodingBit(clientFqdnOption.GetEncodingBit());
                replyFqdnOption.SetRcode1((short)0xff);     // RFC 4702 says server should set to 255
                replyFqdnOption.SetRcode2((short)0xff);     // RFC 4702 says server should set to 255

                fqdn = clientFqdnOption.GetDomainName();
                if ((fqdn == null) || (fqdn.Length <= 0))
                {
                    log.Error("Client FQDN option domain name is null/empty.  No DDNS udpates performed.");
                    replyFqdnOption.SetNoUpdateBit(true);   // tell client that server did no updates
                    _replyMsg.PutDhcpOption(replyFqdnOption);
                    return;
                }

                string policy = DhcpServerPolicies.EffectivePolicy(_requestMsg, _clientLink.GetLink(), Property.DDNS_UPDATE);
                log.Info("Server configuration for ddns.update policy: " + policy);
                if ((policy == null) || policy.Contains("none"))
                {
                    log.Info("Server configuration for ddns.update policy is null or 'none'." + "  No DDNS updates performed.");
                    replyFqdnOption.SetNoUpdateBit(true);   // tell client that server did no updates
                    _replyMsg.PutDhcpOption(replyFqdnOption);
                    return;
                }

                if (clientFqdnOption.GetNoUpdateBit() && policy.Contains("honorNoUpdate"))
                {
                    log.Info("Client FQDN NoUpdate flag set.  Server configured to honor request." + "  No DDNS updates performed.");
                    replyFqdnOption.SetNoUpdateBit(true);   // tell client that server did no updates
                    _replyMsg.PutDhcpOption(replyFqdnOption);
                    //TODO: RFC 4704 Section 6.1
                    //		...the server SHOULD delete any RRs that it previously added
                    //		via DNS updates for the client.
                    return;
                }

                if (!clientFqdnOption.GetUpdateABit() && policy.Contains("honorNoA"))
                {
                    log.Info("Client FQDN NoA flag set.  Server configured to honor request." + "  No FORWARD DDNS updates performed.");
                    doForwardUpdate = false;
                }
                else
                {
                    replyFqdnOption.SetUpdateABit(true);    // server will do update
                    if (!clientFqdnOption.GetUpdateABit())
                    {
                        replyFqdnOption.SetOverrideBit(true);   // tell client that we overrode request flag
                    }
                }

                if (!String.IsNullOrEmpty(domain))
                {
                    log.Info("Server configuration for domain policy: " + domain);
                    // if there is a configured domain, then replace the domain provide by the client
                    int dot = fqdn.IndexOf('.');
                    if (dot > 0)
                    {
                        fqdn = fqdn.Substring(0, dot + 1) + domain;
                    }
                    else
                    {
                        fqdn = fqdn + "." + domain;
                    }
                    replyFqdnOption.SetDomainName(fqdn);
                }
                // since the client DID send option 81, return it in the reply
                _replyMsg.PutDhcpOption(replyFqdnOption);
            }
            else
            {
                // The client did not send an FQDN option, so we'll try to formulate the FQDN
                // from the hostname option combined with the DDNS_DOMAIN policy setting.
                // A replyFqdnOption is fabricated to be stored with the binding for use
                // with the release/expire binding processing to remove the DDNS entry.
                replyFqdnOption = new DhcpV4ClientFqdnOption();
                fqdn            = hostnameOption.GetString();
                if (!String.IsNullOrEmpty(domain))
                {
                    log.Info("Server configuration for domain policy: " + domain);
                    fqdn = fqdn + "." + domain;
                    // since the client did NOT send option 81, do not put
                    // the fabricated fqdnOption into the reply packet
                    // but set the option so that is can be used below
                    // when storing the fqdnOption to the database, so
                    // that it can be used if/when the lease expires
                    replyFqdnOption.SetDomainName(fqdn);
                    // server will do the A record update, so set the flag
                    // for the option stored in the database, so server will
                    // remove the A record when the lease expires
                    replyFqdnOption.SetUpdateABit(true);
                }
                else
                {
                    log.Error("No DDNS domain configured.  No DDNS udpates performed.");
                    replyFqdnOption.SetNoUpdateBit(true);   // tell client that server did no updates
                    _replyMsg.PutDhcpOption(replyFqdnOption);
                    return;
                }
            }

            if (sendUpdates)
            {
                foreach (Binding binding in _bindings)
                {
                    if (binding.GetState() == Binding.COMMITTED)
                    {
                        HashSet <BindingObject> bindingObjs = binding.GetBindingObjects();
                        if (bindingObjs != null)
                        {
                            foreach (var bindingObj in bindingObjs)
                            {
                                V4BindingAddress bindingAddr  = (V4BindingAddress)bindingObj;
                                DhcpConfigObject configObj    = bindingAddr.GetConfigObj();
                                DdnsCallback     ddnsComplete = new DhcpV4DdnsComplete(bindingAddr, replyFqdnOption);
                                DdnsUpdater      ddns         = new DdnsUpdater(_requestMsg, _clientLink.GetLink(), configObj, bindingAddr.GetIpAddress(), fqdn, _requestMsg.GetChAddr(), configObj.GetValidLifetime(), doForwardUpdate, false, ddnsComplete);
                                ddns.ProcessUpdates();
                            }
                        }
                    }
                }
            }
        }
Example #9
0
        protected void ProcessDdnsUpdates(bool sendUpdates)
        {
            DhcpV6ClientFqdnOption clientFqdnOption = ((DhcpV6ClientFqdnOption)(this.requestMsg.GetDhcpOption(DhcpConstants.V6OPTION_CLIENT_FQDN)));

            if ((clientFqdnOption == null))
            {
                // TODO allow name generation?
                log.Debug("No Client FQDN option in request.  Skipping DDNS update processing.");
                return;
            }

            bool includeFqdnOptionInReply = false;

            if (((this.requestMsg.GetRequestedOptionCodes() != null) &&
                 this.requestMsg.GetRequestedOptionCodes().Contains(DhcpConstants.V6OPTION_CLIENT_FQDN)))
            {
                //  RFC 4704 section 6 says:
                //    Servers MUST only include a Client FQDN option in ADVERTISE and REPLY
                //    messages if the client included a Client FQDN option and the Client
                //    FQDN option is requested by the Option Request option in the client's
                //    message to which the server is responding.
                includeFqdnOptionInReply = true;
            }

            DhcpV6ClientFqdnOption replyFqdnOption = new DhcpV6ClientFqdnOption();

            replyFqdnOption.SetDomainName(clientFqdnOption.GetDomainName());
            replyFqdnOption.SetUpdateAaaaBit(false);
            replyFqdnOption.SetOverrideBit(false);
            replyFqdnOption.SetNoUpdateBit(false);
            string fqdn = clientFqdnOption.GetDomainName();

            if (((fqdn == null) ||
                 (fqdn.Length <= 0)))
            {
                log.Error("Client FQDN option domain name is null/empty.  No DDNS udpates performed.");
                if (includeFqdnOptionInReply)
                {
                    replyFqdnOption.SetNoUpdateBit(true);
                    //  tell client that server did no updates
                    this.replyMsg.PutDhcpOption(replyFqdnOption);
                }

                return;
            }

            String policy = DhcpServerPolicies.EffectivePolicy(this.requestMsg, this.clientLink.GetLink(), Property.DDNS_UPDATE);

            log.Info(("Server configuration for ddns.update policy: " + policy));
            if (((policy == null) ||
                 policy.ToLower() == "none"))
            {
                log.Info(("Server configuration for ddns.update policy is null or \'none\'." + "  No DDNS updates performed."));
                if (includeFqdnOptionInReply)
                {
                    replyFqdnOption.SetNoUpdateBit(true);
                    //  tell client that server did no updates
                    this.replyMsg.PutDhcpOption(replyFqdnOption);
                }

                return;
            }

            if ((clientFqdnOption.GetNoUpdateBit() && policy.ToLower() == "honorNoUpdate".ToLower()))
            {
                log.Info(("Client FQDN NoUpdate flag set.  Server configured to honor request." + "  No DDNS updates performed."));
                if (includeFqdnOptionInReply)
                {
                    replyFqdnOption.SetNoUpdateBit(true);
                    //  tell client that server did no updates
                    this.replyMsg.PutDhcpOption(replyFqdnOption);
                }

                // TODO: RFC 4704 Section 6.1
                //         ...the server SHOULD delete any RRs that it previously added
                //         via DNS updates for the client.
                return;
            }

            bool doForwardUpdate = true;

            if ((!clientFqdnOption.GetUpdateAaaaBit() &&
                 policy.ToLower() == "honorNoAAAA".ToLower()))
            {
                log.Info(("Client FQDN NoAAAA flag set.  Server configured to honor request." + "  No FORWARD DDNS updates performed."));
                doForwardUpdate = false;
            }
            else
            {
                replyFqdnOption.SetUpdateAaaaBit(true);
                //  server will do update
                if (!clientFqdnOption.GetUpdateAaaaBit())
                {
                    replyFqdnOption.SetOverrideBit(true);
                }

                //  tell client that we overrode request flag
            }

            string domain = DhcpServerPolicies.EffectivePolicy(this.clientLink.GetLink(), Property.DDNS_DOMAIN);

            if (((domain != null) &&
                 domain.Count() > 0))
            {
                log.Info(("Server configuration for domain policy: " + domain));
                //  if there is a configured domain, then replace the domain provide by the client
                int dot = fqdn.IndexOf('.');
                if ((dot > 0))
                {
                    fqdn = (fqdn.Substring(0, (dot + 1)) + domain);
                }
                else
                {
                    fqdn = (fqdn + ("." + domain));
                }

                replyFqdnOption.SetDomainName(fqdn);
            }

            if (includeFqdnOptionInReply)
            {
                this.replyMsg.PutDhcpOption(replyFqdnOption);
            }

            if (sendUpdates)
            {
                foreach (Binding binding in this.bindings)
                {
                    if ((binding.GetState() == Binding.COMMITTED))
                    {
                        HashSet <BindingObject> bindingObjs = binding.GetBindingObjects();
                        if ((bindingObjs != null))
                        {
                            foreach (BindingObject bindingObj in bindingObjs)
                            {
                                V6BindingAddress bindingAddr  = ((V6BindingAddress)(bindingObj));
                                DhcpConfigObject configObj    = bindingAddr.GetConfigObj();
                                DdnsCallback     ddnsComplete = new DhcpV6DdnsComplete(bindingAddr, replyFqdnOption);
                                DdnsUpdater      ddns         = new DdnsUpdater(this.requestMsg, this.clientLink.GetLink(), configObj, bindingAddr.GetIpAddress(), fqdn, this.requestMsg.GetDhcpClientIdOption().GetDuid(), configObj.GetValidLifetime(), doForwardUpdate, false, ddnsComplete);
                                ddns.ProcessUpdates();
                            }
                        }
                    }
                }
            }
        }
Example #10
0
        /**
         * Perform the DDNS delete processing when a lease is released or expired.
         *
         * @param ia the IdentityAssoc of the client
         * @param iaAddr the released or expired IaAddress
         */
        protected override void DdnsDelete(IdentityAssoc ia, IaAddress iaAddr)
        {
            DhcpV6ClientFqdnOption clientFqdnOption = null;

            try
            {
                if ((ia != null) && (iaAddr != null))
                {
                    List <DhcpOption> opts = iaAddr.GetDhcpOptions();
                    if (opts != null)
                    {
                        foreach (DhcpOption opt in opts)
                        {
                            if (opt.GetCode() == DhcpConstants.V6OPTION_CLIENT_FQDN)
                            {
                                clientFqdnOption = new DhcpV6ClientFqdnOption();
                                //clientFqdnOption.Decode(ByteBuffer.Wrap(opt.GetValue()));
                                break;
                            }
                        }
                    }
                    if (clientFqdnOption != null)
                    {
                        string fqdn = clientFqdnOption.GetDomainName();
                        if (!String.IsNullOrEmpty(fqdn))
                        {
                            DhcpLink link = serverConfig.FindLinkForAddress(iaAddr.GetIpAddress());
                            if (link != null)
                            {
                                V6BindingAddress bindingAddr   = null;
                                StaticBinding    staticBinding =
                                    FindStaticBinding(link.GetLink(), ia.GetDuid(),
                                                      ia.GetIatype(), ia.GetIaid(), null);
                                if (staticBinding != null)
                                {
                                    bindingAddr =
                                        BuildV6StaticBindingFromIaAddr(iaAddr, staticBinding);
                                }
                                else
                                {
                                    bindingAddr =
                                        BuildV6BindingAddressFromIaAddr(iaAddr, link, null);    // safe to send null requestMsg
                                }
                                if (bindingAddr != null)
                                {
                                    DdnsCallback ddnsComplete =
                                        new DhcpV6DdnsComplete(bindingAddr, clientFqdnOption);

                                    DhcpConfigObject configObj = bindingAddr.GetConfigObj();

                                    DdnsUpdater ddns =
                                        new DdnsUpdater(link.GetLink(), configObj,
                                                        bindingAddr.GetIpAddress(), fqdn, ia.GetDuid(),
                                                        configObj.GetValidLifetime(),
                                                        clientFqdnOption.GetUpdateAaaaBit(), true,
                                                        ddnsComplete);

                                    ddns.ProcessUpdates();
                                }
                                else
                                {
                                    log.Error("Failed to find binding for address: " +
                                              iaAddr.GetIpAddress().ToString());
                                }
                            }
                            else
                            {
                                log.Error("Failed to find link for binding address: " +
                                          iaAddr.GetIpAddress().ToString());
                            }
                        }
                        else
                        {
                            log.Error("FQDN is null or empty.  No DDNS deletes performed.");
                        }
                    }
                    else
                    {
                        log.Warn("No Client FQDN option in current binding.  No DDNS deletes performed.");
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("Failed to perform DDNS delete");
            }
        }
 public void SetConfigObj(DhcpConfigObject configObj)
 {
     this.configObj = configObj;
 }
 /**
  * Effective policy as int.
  *
  * @param requestMsg the request msg
  * @param pool the pool
  * @param link the link
  * @param prop the prop
  * @return the int
  */
 public static int EffectivePolicyAsInt(DhcpMessage requestMsg,
                                        DhcpConfigObject configObj, link link, Property prop)
 {
     return(int.Parse(EffectivePolicy(requestMsg, configObj, link, prop)));
 }
 /**
  * Effective policy as long.
  *
  * @param pool the pool
  * @param link the link
  * @param prop the prop
  *
  * @return the long
  */
 public static long EffectivePolicyAsLong(DhcpConfigObject configObj,
                                          link link, Property prop)
 {
     return(long.Parse(EffectivePolicy(configObj, link, prop)));
 }
 /**
  * Effective policy as boolean.
  *
  * @param pool the pool
  * @param link the link
  * @param prop the prop
  *
  * @return true, if successful
  */
 public static bool EffectivePolicyAsBoolean(DhcpConfigObject configObj,
                                             link link, Property prop)
 {
     return(bool.Parse(EffectivePolicy(configObj, link, prop)));
 }
 /**
  * Effective policy as float.
  *
  * @param requestMsg the request msg
  * @param pool the pool
  * @param link the link
  * @param prop the prop
  * @return the float
  */
 public static float EffectivePolicyAsFloat(DhcpMessage requestMsg,
                                            DhcpConfigObject configObj, link link, Property prop)
 {
     return(long.Parse(EffectivePolicy(requestMsg, configObj, link, prop)));
 }
 public void SetConfigObj(DhcpV6OptionConfigObject configObj)
 {
     this.configObj = configObj;
 }
Example #17
0
        /* (non-Javadoc)
         * @see java.lang.Runnable#run()
         */
        //public void Run()
        //{
        //    SetupPolicies(configObj, lifetime);
        //    try
        //    {
        //        if (doForwardUpdate)
        //        {
        //            ForwardDdnsUpdate fwdUpdate = new ForwardDdnsUpdate(fqdn, addr, duid);
        //            fwdUpdate.SetServer(fwdServer);
        //            fwdUpdate.SetZone(fwdZone);
        //            fwdUpdate.SetTtl(fwdTtl);
        //            fwdUpdate.SetTsigKeyName(fwdTsigKeyName);
        //            fwdUpdate.SetTsigAlgorithm(fwdTsigAlgorithm);
        //            fwdUpdate.SetTsigKeyData(fwdTsigKeyData);
        //            if (!isDelete)
        //                callback.FwdAddComplete(fwdUpdate.SendAdd());
        //            else
        //                callback.FwdDeleteComplete(fwdUpdate.SendDelete());
        //        }
        //        ReverseDdnsUpdate revUpdate = new ReverseDdnsUpdate(fqdn, addr, duid);
        //        revUpdate.SetServer(revServer);
        //        revUpdate.SetZone(revZone);
        //        revUpdate.SetRevZoneBitLength(revZoneBitLength);
        //        revUpdate.SetTtl(revTtl);
        //        revUpdate.SetTsigKeyName(revTsigKeyName);
        //        revUpdate.SetTsigAlgorithm(revTsigAlgorithm);
        //        revUpdate.SetTsigKeyData(revTsigKeyData);
        //        if (!isDelete)
        //            callback.RevAddComplete(revUpdate.SendAdd());
        //        else
        //            callback.RevDeleteComplete(revUpdate.SendDelete());
        //    }
        //    catch (Exception ex)
        //    {
        //        log.Error(ex, "Failure performing DDNS updates");
        //        callback.FwdAddComplete(false);
        //        callback.FwdDeleteComplete(false);
        //        callback.RevAddComplete(false);
        //        callback.RevDeleteComplete(false);
        //    }
        //}

        /**
         * Sets the up policies.
         *
         * @param addrBindingPool the new up policies
         */
        private void SetupPolicies(DhcpConfigObject addrBindingPool, long lifetime)
        {
            sync = DhcpServerPolicies.EffectivePolicyAsbool(requestMsg,
                                                            addrBindingPool, clientLink, Property.DDNS_SYNCHRONIZE);

            string zone = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                             addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_NAME);

            if ((zone != null) && !string.IsNullOrEmpty(zone))
            {
                fwdZone = zone;
            }

            zone = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                      addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_NAME);
            if ((zone != null) && !string.IsNullOrEmpty(zone))
            {
                revZone = zone;
            }

            revZoneBitLength = DhcpServerPolicies.EffectivePolicyAsInt(requestMsg,
                                                                       addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_BITLENGTH);

            long  ttl      = 0;
            float ttlFloat = DhcpServerPolicies.EffectivePolicyAsFloat(requestMsg,
                                                                       addrBindingPool, clientLink, Property.DDNS_TTL);

            if (ttlFloat < 1)
            {
                // if less than one, then percentage of lifetime seconds
                ttl = (long)(lifetime * ttlFloat);
            }
            else
            {
                // if greater than one, then absolute number of seconds
                ttl = (long)ttlFloat;
            }

            fwdTtl   = ttl;
            ttlFloat = DhcpServerPolicies.EffectivePolicyAsFloat(requestMsg,
                                                                 addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_TTL);
            if (ttlFloat < 1)
            {
                // if less than one, then percentage of lifetime seconds
                fwdTtl = (long)(lifetime * ttlFloat);
            }
            else
            {
                // if greater than one, then absolute number of seconds
                fwdTtl = (long)ttlFloat;
            }

            revTtl   = ttl;
            ttlFloat = DhcpServerPolicies.EffectivePolicyAsFloat(requestMsg,
                                                                 addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_TTL);
            if (ttlFloat < 1)
            {
                // if less than one, then percentage of lifetime seconds
                revTtl = (long)(lifetime * ttlFloat);
            }
            else
            {
                // if greater than one, then absolute number of seconds
                revTtl = (long)ttlFloat;
            }

            string server = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                               addrBindingPool, clientLink, Property.DDNS_SERVER);

            fwdServer = server;
            revServer = server;

            server = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                        addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_SERVER);
            if ((server != null) && !string.IsNullOrEmpty(server))
            {
                fwdServer = server;
            }
            server = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                        addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_SERVER);
            if ((server != null) && !string.IsNullOrEmpty(server))
            {
                revServer = server;
            }

            string tsigKeyName = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                                    addrBindingPool, clientLink, Property.DDNS_TSIG_KEYNAME);

            fwdTsigKeyName = tsigKeyName;
            revTsigKeyName = tsigKeyName;

            tsigKeyName = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                             addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_TSIG_KEYNAME);
            if ((tsigKeyName != null) && !string.IsNullOrEmpty(tsigKeyName))
            {
                fwdTsigKeyName = tsigKeyName;
            }
            tsigKeyName = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                             addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_TSIG_KEYNAME);
            if ((tsigKeyName != null) && !string.IsNullOrEmpty(tsigKeyName))
            {
                revTsigKeyName = tsigKeyName;
            }

            string tsigAlgorithm = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                                      addrBindingPool, clientLink, Property.DDNS_TSIG_ALGORITHM);

            fwdTsigAlgorithm = tsigAlgorithm;
            revTsigAlgorithm = tsigAlgorithm;

            tsigAlgorithm = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                               addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_TSIG_ALGORITHM);
            if ((tsigAlgorithm != null) && !string.IsNullOrEmpty(tsigAlgorithm))
            {
                fwdTsigAlgorithm = tsigAlgorithm;
            }
            tsigAlgorithm = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                               addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_TSIG_ALGORITHM);
            if ((tsigAlgorithm != null) && !string.IsNullOrEmpty(tsigAlgorithm))
            {
                revTsigAlgorithm = tsigAlgorithm;
            }

            string tsigKeyData = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                                    addrBindingPool, clientLink, Property.DDNS_TSIG_KEYDATA);

            fwdTsigKeyData = tsigKeyData;
            revTsigKeyData = tsigKeyData;

            tsigKeyData = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                             addrBindingPool, clientLink, Property.DDNS_FORWARD_ZONE_TSIG_KEYDATA);
            if ((tsigKeyData != null) && !string.IsNullOrEmpty(tsigKeyData))
            {
                fwdTsigKeyData = tsigKeyData;
            }
            tsigKeyData = DhcpServerPolicies.EffectivePolicy(requestMsg,
                                                             addrBindingPool, clientLink, Property.DDNS_REVERSE_ZONE_TSIG_KEYDATA);
            if ((tsigKeyData != null) && !string.IsNullOrEmpty(tsigKeyData))
            {
                revTsigKeyData = tsigKeyData;
            }
        }
 /**
  * Effective policy as boolean.
  *
  * @param requestMsg the request msg
  * @param pool the pool
  * @param link the link
  * @param prop the prop
  * @return true, if successful
  */
 public static bool EffectivePolicyAsbool(DhcpMessage requestMsg, DhcpConfigObject configObj, link link, Property prop)
 {
     return(bool.Parse(EffectivePolicy(requestMsg, configObj, link, prop)));
 }