u_int eb=0, et=0;

    get_enginetime( session->securityEngineID,
                    session->securityEngineIDLen,
                    (u_int *) &eb,
                    (u_int *) &

printf("Setting engineBoots to %d  Setting engineTime to %d", eb, et);

________________________________
 From: "Zheng, Wenjie (Barclay)" <barclay.zh...@alcatel-lucent.com>
To: Dave Shield <d.t.shi...@liverpool.ac.uk> 
Cc: "net-snmp-cod...@lists.sourceforge.net" 
<net-snmp-cod...@lists.sourceforge.net>; "net-snmp-users@lists.sourceforge.net" 
<net-snmp-users@lists.sourceforge.net> 
Sent: Saturday, 5 January 2013 6:51 PM
Subject: RE: SNMP Agent engineboot
 
Dave

Thanks for your help!


>  But when this process re-started, and there is another request comes in,
> SNMP agent will replies error:usmstatus not in timewindow.

That is correct - an SNMPv3 request will fail if the boot time/count
values in the
request don't match the agent's idea of the current values.   I
believe this is to
avoid replay attacks.


> I learnt that SNMP agent should increase the engineboot if agent restarted,
> how should I implement this function that SNMP Manager don't
> need do a handshake again if SNMP agent restarted?

The manager will need to resend the request, with updated boot
count/time values.These can be taken from the "not in timewindow" Report 
message that was sent by the agent.
   If the manager is written using the Net-SNMP libraries, then I'd expect this 
to happen automatically.   If it's using a different toolkit, then you'd need 
to talk to the appropriate vendor to find out how to handle this with their 
code.

<<<Barclay >>>
I try to use  set_enginetime() by set the engineboots to a value stored in out 
side of agent.
set_enginetime(c_engineID, engineIDLen,
                     get_snmpEngineBoots(),
                     snmpv3_local_snmpEngineTime(), TRUE);
Then when Manager side send request, agent will return with new engineboot, 
then manager side will send request again with new engineboot and time. I 
thought this time, agent will think its in sync with manager side.
But unfortunately, seems usm_check_and_update_timeliness() will still return 
error, it will compare the the static engineBoots stored in agent with the new 
engineboots value. boots_uint != myBoots

        if (boots_uint == ENGINEBOOT_MAX
            || boots_uint != myBoots
            || time_difference > USM_TIME_WINDOW) {
.....
            *error = SNMPERR_USM_NOTINTIMEWINDOW;
            return -1;
        }
myBoots is get from snmpv3_local_snmpEngineBoots:
    snmpv3_local_snmpEngineBoots(void)
    {
            return engineBoots;
    }

Seems I can not set this static engineBoots?
<<<Barclay >>>


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Net-snmp-coders mailing list
net-snmp-cod...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to