Beispiel #1
0
        protected bool AllIaPrefixesOnLink(DhcpV6IaPdOption dhcpIaPdOption, DhcpLink clientLink)
        {
            bool onLink = true;

            //  assume all IPs are on link
            if ((dhcpIaPdOption != null))
            {
                List <DhcpV6IaPrefixOption> iaPrefixOpts = dhcpIaPdOption.GetIaPrefixOptions();
                if ((iaPrefixOpts != null))
                {
                    foreach (DhcpV6IaPrefixOption iaPrefixOpt in iaPrefixOpts)
                    {
                        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
                            v6PrefixPool p = DhcpServerConfiguration.FindPrefixPool(this.clientLink.GetLink(), iaPrefixOpt.GetInetAddress());
                            if ((p == null))
                            {
                                log.Info(("No local prefix pool found for requested IA_PD: "
                                          + (iaPrefixOpt.GetInetAddress().ToString() + " - considered to be off link")));
                                iaPrefixOpt.SetPreferredLifetime(0);
                                iaPrefixOpt.SetValidLifetime(0);
                                onLink = false;
                            }
                        }
                        else if (!this.clientLink.GetSubnet().Contains(iaPrefixOpt.GetInetAddress()))
                        {
                            log.Info(("Setting zero(0) lifetimes for off link prefix: " + iaPrefixOpt.GetInetAddress().ToString()));
                            iaPrefixOpt.SetPreferredLifetime(0);
                            iaPrefixOpt.SetValidLifetime(0);
                            onLink = false;
                        }
                    }
                }
            }

            return(onLink);
        }