Exemplo n.º 1
0
        protected bool AllIaAddrsOnLink(DhcpV6IaTaOption dhcpIaTaOption, DhcpLink clientLink)
        {
            bool onLink = true;

            //  assume all IPs are on link
            if ((dhcpIaTaOption != null))
            {
                List <DhcpV6IaAddrOption> iaAddrOpts = dhcpIaTaOption.GetIaAddrOptions();
                if ((iaAddrOpts != null))
                {
                    foreach (DhcpV6IaAddrOption iaAddrOpt in iaAddrOpts)
                    {
                        if (this.clientLink.GetSubnet().GetSubnetAddress().IsIPv6LinkLocal)
                        {
                            //  if the Link address is link-local, then check if the
                            //  address is within one of the pools configured for this
                            //  local Link, which automatically makes this server
                            //  "authoritative" (in ISC parlance) for this local net
                            v6AddressPool p = DhcpServerConfiguration.FindTaAddrPool(this.clientLink.GetLink(), iaAddrOpt.GetInetAddress());
                            if ((p == null))
                            {
                                log.Info(("No local address pool found for requested IA_TA: "
                                          + (iaAddrOpt.GetInetAddress().ToString() + " - considered to be off link")));
                                iaAddrOpt.SetPreferredLifetime(0);
                                iaAddrOpt.SetValidLifetime(0);
                                onLink = false;
                            }
                        }
                        else if (!this.clientLink.GetSubnet().Contains(iaAddrOpt.GetInetAddress()))
                        {
                            log.Info(("Setting zero(0) lifetimes for off link address: " + iaAddrOpt.GetInetAddress().ToString()));
                            iaAddrOpt.SetPreferredLifetime(0);
                            iaAddrOpt.SetValidLifetime(0);
                            onLink = false;
                        }
                    }
                }
            }

            return(onLink);
        }