Exemplo n.º 1
0
TClntMsgInfRequest::TClntMsgInfRequest(SPtr<TClntCfgIface> iface)
    :TClntMsg(iface->getID(), 0, INFORMATION_REQUEST_MSG) {

    IRT = INF_TIMEOUT;
    MRT = INF_MAX_RT;
    MRC = 0;
    MRD = 0;
    RT= 0 ;
    
    Iface=iface->getID();
    IsDone=false;

    if (!ClntCfgMgr().anonInfRequest()) {
        Options.push_back(new TOptDUID(OPTION_CLIENTID, ClntCfgMgr().getDUID(), this));
    } else {
        Log(Info) << "Sending anonymous INF-REQUEST (ClientID not included)." << LogEnd;
    }

    // Append the options we want to configure
    appendRequestedOptions();

    // If there is no ORO (or it is empty), skip the message.
    SPtr<TClntOptOptionRequest> oro = (Ptr*) getOption(OPTION_ORO);
    if (!oro || !oro->count()) {
        IsDone = true;
        return;
    }

    appendAuthenticationOption();
    appendElapsedOption();
    send();
}
Exemplo n.º 2
0
//opts - all options list WITHOUT serverDUID including server id
TClntMsgInfRequest::TClntMsgInfRequest(TOptList ReqOpts,
				       int iface)
    :TClntMsg(iface, 0, INFORMATION_REQUEST_MSG) {
    IRT = INF_TIMEOUT;
    MRT = INF_MAX_RT;
    MRC = 0;
    MRD = 0;
    RT=0;

    Iface=iface;
    IsDone=false;
    
    SPtr<TIfaceIface> ptrIface = ClntIfaceMgr().getIfaceByID(iface);
    if (!ptrIface) {
        Log(Error) << "Unable to find interface with ifindex=" << iface 
                   << " while trying to generate INF-REQUEST." << LogEnd;
        IsDone = true;
        return;
    }
    Log(Debug) << "Creating INF-REQUEST on the " << ptrIface->getFullName()
	           << "." << LogEnd;
    
    // copy whole list from Verify ...
    Options = ReqOpts;
    
    SPtr<TOpt> opt;
    firstOption();
    while(opt=getOption())
    {
        switch (opt->getOptType())
        {       
            //These options possibly receipt from verify transaction
            //can't appear in request message and have to be deleted
            case OPTION_UNICAST:
            case OPTION_STATUS_CODE:
            case OPTION_PREFERENCE:
            case OPTION_IA_TA:
            case OPTION_RELAY_MSG:
            case OPTION_SERVERID:
            case OPTION_IA_NA:
            case OPTION_IAADDR:
            case OPTION_RAPID_COMMIT:
            case OPTION_INTERFACE_ID:
            case OPTION_RECONF_MSG:
            case OPTION_AUTH:
	    case OPTION_ELAPSED_TIME:       //delete the old elapsed option,as we will append a new one
                delOption(opt->getOptType());
                break;        
        }
        //The other options can be included in Information request option
        //CLIENTID,ORO,ELAPSED_TIME,USER_CLASS,VENDOR_CLASS,
        //VENDOR_OPTS,DNS_RESOLVERS,DOMAIN_LIST,NTP_SERVERS,TIME_ZONE,
        //RECONF_ACCEPT - maybe also SERVERID if information request
        //is answer to reconfigure message
    }
    appendElapsedOption();
    appendAuthenticationOption();

    this->send();
}
Exemplo n.º 3
0
TClntMsgInfRequest::TClntMsgInfRequest(SPtr<TClntCfgIface> iface)
    :TClntMsg(iface->getID(), 0, INFORMATION_REQUEST_MSG) {

    IRT = INF_TIMEOUT;
    MRT = INF_MAX_RT;
    MRC = 0;
    MRD = 0;
    RT= 0 ;
    
    Iface=iface->getID();
    IsDone=false;

    if (!ClntCfgMgr().anonInfRequest()) {
        Options.push_back(new TOptDUID(OPTION_CLIENTID, ClntCfgMgr().getDUID(), this));
    } else {
        Log(Info) << "Sending anonymous INF-REQUEST (ClientID not included)." << LogEnd;
    }

    this->appendRequestedOptions();

    appendAuthenticationOption();
    appendElapsedOption();
    send();
}
Exemplo n.º 4
0
  :TClntMsg(iface, addr, RELEASE_MSG)
{
    SPtr<TDUID> srvDUID;
    
    IRT=REL_TIMEOUT;
    MRT=0;
    MRC=REL_MAX_RC;
    MRD=0;
    RT=0;

    // obtain IA, TA or PD, so server DUID can be obtained
    SPtr<TAddrIA> x = 0;
    if (iaLst.count()) {
        iaLst.first();
        x=iaLst.get();
    }
    if (!x)
        x = ta;
    if (!x) {
        pdLst.first();
        x = pdLst.get();
    }
    if (!x) {
        Log(Error) << "Unable to send RELEASE. No IA, TA or PD provided." << LogEnd;
        this->IsDone = true;
        return;
    }
    if (!x->getDUID()) {
        Log(Error) << "Unable to send RELEASE. Unable to find DUID. " << LogEnd;
        this->IsDone = true;
        return;
    }
    srvDUID = x->getDUID();

    Options.push_back(new TOptDUID(OPTION_SERVERID, srvDUID,this));
    Options.push_back(new TOptDUID(OPTION_CLIENTID, ClntCfgMgr().getDUID(),this));

#if 0
    if (ClntCfgMgr().getNotifyScripts()) {
	// release workaround (add removed IAs)
        /// @todo: WTF? Why are those IAs removed?
        iaLst.first();
        SPtr<TAddrIA> ia;
	while (ia = iaLst.get()) 
	{
	    ClntAddrMgr().addIA(ia);
	}
	
	
	iaLst.first();
	while (ia = iaLst.get())
	{
	    ClntAddrMgr().delIA(ia->getIAID());
	}
    }
#endif

    // --- RELEASE IA ---
    iaLst.first();
    while(x=iaLst.get()) {
        Options.push_back(new TClntOptIA_NA(x,this));
        SPtr<TAddrAddr> ptrAddr;
        SPtr<TClntIfaceIface> ptrIface;
        ptrIface = (Ptr*)ClntIfaceMgr().getIfaceByID(x->getIface());
        x->firstAddr();
        while (ptrAddr = x->getAddr()) {
            ptrIface->delAddr(ptrAddr->get(), ptrAddr->getPrefix());
        }

	// --- DNS Update ---
	SPtr<TIPv6Addr> dns = x->getFQDNDnsServer();
	if (dns) {
	    string fqdn = ptrIface->getFQDN();
	    ClntIfaceMgr().fqdnDel(ptrIface, x, fqdn);
	}
	// --- DNS Update ---
    }
    
    // --- RELEASE TA ---
    if (ta)
	Options.push_back(new TClntOptTA(ta, this));

    // --- RELEASE PD ---

    SPtr<TAddrIA> pd = 0;
    
    pdLst.first();
    while(pd=pdLst.get()) {
        SPtr<TClntOptIA_PD> pdOpt = new TClntOptIA_PD(pd,this);
        Options.push_back( (Ptr*)pdOpt );
        pdOpt->setContext(srvDUID, addr, this);
        pdOpt->delPrefixes();

        ClntAddrMgr().delPD(pd->getIAID() );
    }

    appendElapsedOption();
    appendAuthenticationOption();

    IsDone = false;
    send();
}