public virtual bool PreProcess() { IPAddress localSocketAddr = _requestMsg.GetLocalAddress(); byte[] chAddr = _requestMsg.GetChAddr(); //判斷是否有MAC if ((chAddr == null) || (chAddr.Length == 0) || IsIgnoredMac(chAddr)) { //log.Warn("Ignorning request message from client: mac=" + Util.toHexString(chAddr)); return(false); } _clientLink = _dhcpServerConfig.FindDhcpLinkV4(localSocketAddr, (IPAddress)_clientLinkAddress); if (_clientLink == null) { //log.Error("No Link configured for DHCPv4 client request: " + " localAddress=" + localSocketAddr.GetAddress().GetHostAddress() +" clientLinkAddress=" + clientLinkAddress.getHostAddress()); return(false); // must configure link for server to reply } /* TODO: check if this DOS mitigation is useful * * boolean isNew = recentMsgs.add(requestMsg); * if (!isNew) { * if (log.isDebugEnabled()) * log.debug("Dropping recent message"); * return false; // don't process * } * * if (log.isDebugEnabled()) * log.debug("Processing new message"); * * long timer = DhcpServerPolicies.effectivePolicyAsLong(clientLink.getLink(), * Property.DHCP_PROCESSOR_RECENT_MESSAGE_TIMER); * if (timer > 0) { * recentMsgPruner.schedule(new RecentMsgTimerTask(requestMsg), timer); * } */ return(true); // ok to process }