cl-net-snmp-general Mailing List for Common Lisp SNMP (Page 4)
Brought to you by:
binghe
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(4) |
Apr
(5) |
May
|
Jun
|
Jul
(5) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(22) |
Feb
(20) |
Mar
|
Apr
(2) |
May
(25) |
Jun
(1) |
Jul
(17) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: John F. <jf...@ms...> - 2009-02-06 10:26:29
|
And if anybody is interested in converting from parsergen syntax to
cl-yacc syntax, here are some helper functions
(defun defparser-production-to-yacc (grammar-symbols forms)
(cond ((not (and forms (or (not (listp forms)) (some 'identity forms))))
nil)
(t
(labels ((make-var (i)
(intern (format nil "$~D" i)))
(vars ()
(loop for i from 1 for x in grammar-symbols collect (make-var i)))
(used-vars ()
(remove-duplicates
(loop for sym in (alexandria:flatten forms)
when (and (symbolp sym) (eql #\$ (elt (symbol-name sym) 0))
(ignore-errors (parse-integer (symbol-name sym) :start 1)))
collect (make-var (parse-integer (symbol-name sym) :start 1)))
:test 'eql)))
(let ((unused-vars (set-difference (vars) (used-vars))))
(list `#'(lambda(,@(vars))
,@(when unused-vars (list `(declare (ignore ,@unused-vars))))
,forms)))))))
(defun defparser-to-yacc (rules)
(let (grouped-rules)
(loop for rule in rules do
(destructuring-bind ((non-terminal &rest grammar-symbols) &optional forms)
rule
(assert non-terminal)
(push (append grammar-symbols (defparser-production-to-yacc grammar-symbols forms))
(sys:cdr-assoc non-terminal grouped-rules))))
(loop for (name . alternatives) in (nreverse grouped-rules)
collect `(,name ,@(reverse alternatives)))))
|
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-22 17:16:27
|
Hi, cl-net-snmp users I've done my first prototype implementation of the SNMP Query Language [1], I'll show how to retrieve lines from a MIB table: CL-USER 7 > (snmp:snmp-select "ifTable" :from "binghe-debian.local") (#<ASN.1/IF-MIB::|IfEntry| 200A2A3F> #<ASN.1/IF-MIB::|IfEntry| 200B6DB7>) CL-USER 8 > (asn.1:plain-value (first *)) ((#<ASN.1:OBJECT-ID IF-MIB::ifIndex (1) [0]> 1) (#<ASN.1:OBJECT-ID IF-MIB::ifDescr (2) [0]> "lo") (#<ASN.1:OBJECT-ID IF-MIB::ifType (3) [0]> 24) (#<ASN.1:OBJECT-ID IF-MIB::ifMtu (4) [0]> 16436) (#<ASN.1:OBJECT-ID IF-MIB::ifSpeed (5) [0]> #<ASN.1:GAUGE 10000000>) (#<ASN.1:OBJECT-ID IF-MIB::ifPhysAddress (6) [0]> "") (#<ASN.1:OBJECT-ID IF-MIB::ifAdminStatus (7) [0]> 1) (#<ASN.1:OBJECT-ID IF-MIB::ifOperStatus (8) [0]> 1) (#<ASN.1:OBJECT-ID IF-MIB::ifLastChange (9) [0]> #<ASN.1:TIMETICKS (0) 0:00:00.00>) (#<ASN.1:OBJECT-ID IF-MIB::ifInOctets (10) [0]> #<ASN.1:COUNTER32 818783761>) (#<ASN.1:OBJECT-ID IF-MIB::ifInUcastPkts (11) [0]> #<ASN.1:COUNTER32 3808537>) (#<ASN.1:OBJECT-ID IF-MIB::ifInNUcastPkts (12) [0]> #<ASN. 1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifInDiscards (13) [0]> #<ASN.1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifInErrors (14) [0]> #<ASN.1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifInUnknownProtos (15) [0]> #<ASN. 1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutOctets (16) [0]> #<ASN.1:COUNTER32 818783761>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutUcastPkts (17) [0]> #<ASN. 1:COUNTER32 3808537>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutNUcastPkts (18) [0]> #<ASN. 1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutDiscards (19) [0]> #<ASN.1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutErrors (20) [0]> #<ASN.1:COUNTER32 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifOutQLen (21) [0]> #<ASN.1:GAUGE 0>) (#<ASN.1:OBJECT-ID IF-MIB::ifSpecific (22) [0]> #<ASN.1:OBJECT-ID SNMPv2-SMI::zeroDotZero (0) [0]>)) CL-USER 9 > (slot-value (first **) 'IF-MIB::|ifDescr|) "lo" The 'IF-MIB::|IfEntry| is a CLOS class, and SNMP-SELECT function will return two instances of it. By using SNMP-SELECT, we need only *4* times UDP message swapping to get all above messages: 1) First two, use GetNextRequestPDU is detect how many "lines" does this MIB table have (by walking on random one table slot) 2) Second two, use GetRequestPDU to retrieve each "line", each time get one line, we set multiple OIDs in one GetRequestPDU. The old method, SNMP-WALK, will need 44 times UDP message swapping on this table (one time, one value). I'll add search method (the :where clause) soon, and this is just one common feature in the force comming cl-net-snmp 6.0. Cheers! -- Chun Tian (binghe) NetEase.com, Inc. P. R. China [1] Wengyik Yeong, SNMP Query Language, NYSERNet Technical Report 90-03-31-1, 1990. |
|
From: John F. <jf...@ms...> - 2009-01-22 05:14:52
|
"Chun Tian (binghe)" <bin...@gm...> writes: > It's merged as r707. > > In cl-net-snmp trunk (6.0-dev), you'll find more packages are created, > and now OIDs like "sysDescr" are real: That's very cool. I guess we can move up to this version after the next demo release. [...] |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-22 05:03:23
|
Hi, John It's merged as r707. In cl-net-snmp trunk (6.0-dev), you'll find more packages are created, and now OIDs like "sysDescr" are real: ASN.1 17 > |SNMPv2-MIB|::|sysDescr| #<OBJECT-ID SNMPv2-MIB::sysDescr (1) [0]> And now I can support OIDs in different ASN.1 module with the same name: (even net-snmp cannot do this) ASN.1 19 > (gethash "linux" *oid-database*) (ASN.1/NET-SNMP-TC::|linux| ASN.1/UCD-SNMP-MIB::|linux|) T ASN.1 20 > (oid "linux") #<OBJECT-ID NET-SNMP-TC::linux (10) [0]> ASN.1 21 > ASN.1/NET-SNMP-TC::|linux| #<OBJECT-ID NET-SNMP-TC::linux (10) [0]> ASN.1 22 > ASN.1/UCD-SNMP-MIB::|linux| #<OBJECT-ID UCD-SNMP-MIB::linux (10) [0]> That is, (OID "...") function will return one of them, but *no special rule* on which one. If you want to precise specify it, use following new syntax: ASN.1 23 > (oid "UCD-SNMP-MIB::linux.1.2.3") #<OBJECT-ID UCD-SNMP-MIB::linux.1.2.3> It's very case-sensitive. I hope above notes helpful to you. It's just one of new features. Regards, Chun Tian (binghe) On 2009-1-22, at 12:18, John Fremlin wrote: > Hi Chun Tian, > > Thanks for maintaining these libraries. > > The new walk-terminate-p has been integrated into our snmp-nonblocking > and it looks good (very little testing). > > Now have only one outstanding diff to snmp > > Index: session.lisp > =================================================================== > --- session.lisp (revision 706) > +++ session.lisp (working copy) > @@ -134,13 +134,15 @@ > (defun open-session (host &key (port *default-snmp-port*) > (version *default-snmp-version*) > (community *default-snmp-community*) > + (create-socket t) > user auth priv) > ;; first, what version we are talking about if version not been set? > (let* ((real-version (or (gethash version *snmp-version-table*) > (if user +snmp-version-3+ *default-snmp- > version*))) > (args (list (gethash real-version *snmp-class-table*) > :host host :port port))) > - (nconc args (list :socket (snmp-connect host port))) > + (when create-socket > + (nconc args (list :socket (snmp-connect host port)))) > (if (/= real-version +snmp-version-3+) > ;; for SNMPv1 and v2c, only set the community > (nconc args (list :community (or community *default-snmp- > community*))) > > [...] > -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: John F. <jf...@ms...> - 2009-01-22 04:18:32
|
Hi Chun Tian,
Thanks for maintaining these libraries.
The new walk-terminate-p has been integrated into our snmp-nonblocking
and it looks good (very little testing).
Now have only one outstanding diff to snmp
Index: session.lisp
===================================================================
--- session.lisp (revision 706)
+++ session.lisp (working copy)
@@ -134,13 +134,15 @@
(defun open-session (host &key (port *default-snmp-port*)
(version *default-snmp-version*)
(community *default-snmp-community*)
+ (create-socket t)
user auth priv)
;; first, what version we are talking about if version not been set?
(let* ((real-version (or (gethash version *snmp-version-table*)
(if user +snmp-version-3+ *default-snmp-version*)))
(args (list (gethash real-version *snmp-class-table*)
:host host :port port)))
- (nconc args (list :socket (snmp-connect host port)))
+ (when create-socket
+ (nconc args (list :socket (snmp-connect host port))))
(if (/= real-version +snmp-version-3+)
;; for SNMPv1 and v2c, only set the community
(nconc args (list :community (or community *default-snmp-community*)))
[...]
|
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 09:42:15
|
On 2009-1-21, at 17:32, John Fremlin wrote: > "Chun Tian (binghe)" <bin...@gm...> writes: > [...] >>> Would it be possible to put the termination test into a separate >>> function so that I can reuse it in both of these walk functions? >> >> OK. I commited a new patch (snmp 5.22) [1], I defined a new function >> WALK-TERMINATE-P: >> >> (defun walk-terminate-p (new-vars current-vars base-vars) >> (or (some #'oid->= new-vars base-vars) >> (some #'ber-equal new-vars current-vars))) > > Looks good! > > [...] > >> And, your OID compare functions, I only commit it into ASN.1 package >> trunk [2], and rename them as OID-REGULAR-*: > > How about oid-lexical-*? OK, adopted. [1] [1] http://cl-net-snmp.svn.sourceforge.net/viewvc/cl-net-snmp/asn.1/trunk/runtime/object-id.lisp?r1=704&r2=703&pathrev=704 -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: John F. <jf...@ms...> - 2009-01-21 09:32:56
|
"Chun Tian (binghe)" <bin...@gm...> writes: [...] >> Would it be possible to put the termination test into a separate >> function so that I can reuse it in both of these walk functions? > > OK. I commited a new patch (snmp 5.22) [1], I defined a new function > WALK-TERMINATE-P: > > (defun walk-terminate-p (new-vars current-vars base-vars) > (or (some #'oid->= new-vars base-vars) > (some #'ber-equal new-vars current-vars))) Looks good! [...] > And, your OID compare functions, I only commit it into ASN.1 package > trunk [2], and rename them as OID-REGULAR-*: How about oid-lexical-*? [...] |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 09:27:23
|
On 2009-1-21, at 16:54, John Fremlin wrote: > Hi Chun Tian, > > "Chun Tian (binghe)" <bin...@gm...> writes: > >> Good, it seems that different agents returns different value on non- >> exist OIDs. >> >> I think my following trivial patch could handle all cases >> correctly, I >> just try to detect the duplicated OID, It won't need your OID-< >> series >> functions (but they will be merged for other use), and my END-OF- >> MIBVIEW test: > > So the end-of-mibview test is not needed? I think so, this case is included in the duplicate OID test. > > > That looks good. I think it makes sense. I guess we will be giving > it a > bit of testing in the next few days. > > In the current version of snmp-nonblocking we have two different > versions of walk (one that accumulates the results and one that > calls a > callback as each result comes in). > > Would it be possible to put the termination test into a separate > function so that I can reuse it in both of these walk functions? OK. I commited a new patch (snmp 5.22) [1], I defined a new function WALK-TERMINATE-P: (defun walk-terminate-p (new-vars current-vars base-vars) (or (some #'oid->= new-vars base-vars) (some #'ber-equal new-vars current-vars))) Which been used by new version of SNMP-WALK. I hope you can accept its name:) You can just load this separate patch, or update your repository to newest snmp-5 branch. And, your OID compare functions, I only commit it into ASN.1 package trunk [2], and rename them as OID-REGULAR-*: (defun oid-regular-< (oid-1 oid-2) (minusp (oid-cmp oid-1 oid-2))) (defun oid-regular-> (oid-1 oid-2) (plusp (oid-cmp oid-1 oid-2))) (defun oid-regular->= (oid-1 oid-2) (not (oid-regular-< oid-1 oid-2))) (defun oid-regular-<= (oid-1 oid-2) (not (oid-regular-> oid-1 oid-2))) I believe they will be useful in the future:) [1] https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/snmp/branches/5/patch/snmp-5/5-22.lisp [2] https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/asn.1/trunk/runtime/object-id.lisp > > > Thanks for your help! > You're welcome, and I should thank you very much! -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: John F. <jf...@ms...> - 2009-01-21 08:54:20
|
Hi Chun Tian, "Chun Tian (binghe)" <bin...@gm...> writes: > Good, it seems that different agents returns different value on non- > exist OIDs. > > I think my following trivial patch could handle all cases correctly, I > just try to detect the duplicated OID, It won't need your OID-< series > functions (but they will be merged for other use), and my END-OF- > MIBVIEW test: So the end-of-mibview test is not needed? That looks good. I think it makes sense. I guess we will be giving it a bit of testing in the next few days. In the current version of snmp-nonblocking we have two different versions of walk (one that accumulates the results and one that calls a callback as each result comes in). Would it be possible to put the termination test into a separate function so that I can reuse it in both of these walk functions? Thanks for your help! |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:49:20
|
Good, it seems that different agents returns different value on non-
exist OIDs.
I think my following trivial patch could handle all cases correctly, I
just try to detect the duplicated OID, It won't need your OID-< series
functions (but they will be merged for other use), and my END-OF-
MIBVIEW test:
Index: snmp-walk.lisp
===================================================================
--- snmp-walk.lisp (revision 693)
+++ snmp-walk.lisp (working copy)
@@ -19,8 +19,7 @@
(new-vars (mapcar #'first temp))
(new-values (mapcar #'second temp)))
(if (or (some #'oid->= new-vars base-vars)
- (member (smi :end-of-mibview) new-values
- :test #'ber-equal))
+ (some #'ber-equal new-vars current-vars))
(if first-p
(snmp-get session vars)
(mapcar #'nreverse acc))
What's your opinion this time?
On 2009-1-21, at 16:40, John Fremlin wrote:
> "Chun Tian (binghe)" <bin...@gm...> writes:
>
>> I think you may be right this time. Could you make a working patch
>> for
>> me, after you have resolved above two mails? I don't have such a SNMP
>> agent, if you can supply a tcpdump/wireshark capture file, that will
>> be helpful for me to understand the event you met.
>
> SNMP> (trace ber-decode)
> (BER-DECODE)
> SNMP> (snmp-get-next *host* ".1.3.6.1.4.1.77.1.4.1.0")
> 0[3]: (BER-DECODE #(48 41 2 1 1 4 6 112 117 98 108 105 99 162 28 2 2
> 41 240 2 1 5 2 1 1 48 16 48 14 6 10 43 6 1 4 1 77
> 1 4 1 0 5 0))
> 0* #<STANDARD-METHOD BER-DECODE (SEQUENCE)>
> 1[3]: (BER-DECODE #<BER-STREAM @ #x1002375e62>)
> 1* #<STANDARD-METHOD BER-DECODE (STREAM)>
> 1[3]: returned
> #(1 "public"
> #<RESPONSE-PDU
> (10736 (5 1)) #(#(#<OBJECT-ID
> SNMPv2-SMI::enterprises.77.1.4.1.0>
> NIL))>)
> 0[3]: returned
> #(1 "public"
> #<RESPONSE-PDU
> (10736 (5 1)) #(#(#<OBJECT-ID
> SNMPv2-SMI::enterprises.77.1.4.1.0>
> NIL))>)
> (#<OBJECT-ID SNMPv2-SMI::enterprises.77.1.4.1.0> NIL)
> SNMP>
>
> [...]
>
--
Chun Tian (binghe)
NetEase.com, Inc.
P. R. China
|
|
From: John F. <jf...@ms...> - 2009-01-21 08:46:47
|
Hi Chun Tian,
"Chun Tian (binghe)" <bin...@gm...> writes:
[...]
>>> Maybe I shouldn't use these confused function names, but that's what
>>> the original Lisp-SNMP project called.
How about renaming the old oid->= oid-< to oid-child-of-p and the new
lexical compare to oid-lexical->=?
>>> I don't think your patch on oid compare would work, because what I
>>> want to do in snmp-walk in definitely NOT to check which oid is
>>> "big".
>>>
>>> [Theorem 1] The OID as a number list which appears in a "GetNext PDU"
>>> chain will ALWAYS get bigger and bigger. That's just what the SNMP
>>> protocol defined on GetNextPDU.
>>
>> Yes this is what is supposed to happen. However in practice it does
>> not happen for the MS Windows 2k boxen. They keep returning the same
>> oid from getnext for SNMPv2-SMI::enterprises.77.1.4.1.0.
>>
>> The snmpwalk checks for this and so should we.
>>
>> && snmp_oid_compare(name, name_length,
>> vars->name,
>> vars->name_length) >=
>> 0) {
>> fprintf(stderr, "Error: OID not
>> increasing: ");
>>
>
> What's the correspond VALUE (beside the "same" OID) here? I think SNMP
> agent will reply the same OID on GetNextPDU only if this OID doesn't
> exist in the SNMP agent. I thought I've captured it well (explained in
> your second note)
That is certainly the theory, but in practice there is this check and it
stops us looping forever with a (apparently not too uncommon) broken
agent. . .
> And I'm sorry still don't know the difference between NO-SUCH-INSTANCE
> and NO-SUCH-OBJECT, I cannot find a SNMP agent which reply me NO-SUCH-
> INSTANCE, can you?
No, I've never seen those, I don't understand what the condition is
about.
[...]
|
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:41:37
|
Thanks for this patch, I'll merge it. On 2009-1-21, at 15:23, John Fremlin wrote: > Hello Chun Tian, > > SNMP> (ber-equal (smi :end-of-mibview) (gauge 2)) > T > > Fix: > > (defmethod ber-equal ((a general-type) (b general-type)) > (and (equalp (type-of a) (type-of b)) (= (value-of a) (value-of b)))) > > -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: John F. <jf...@ms...> - 2009-01-21 08:41:08
|
"Chun Tian (binghe)" <bin...@gm...> writes:
> I think you may be right this time. Could you make a working patch for
> me, after you have resolved above two mails? I don't have such a SNMP
> agent, if you can supply a tcpdump/wireshark capture file, that will
> be helpful for me to understand the event you met.
SNMP> (trace ber-decode)
(BER-DECODE)
SNMP> (snmp-get-next *host* ".1.3.6.1.4.1.77.1.4.1.0")
0[3]: (BER-DECODE #(48 41 2 1 1 4 6 112 117 98 108 105 99 162 28 2 2
41 240 2 1 5 2 1 1 48 16 48 14 6 10 43 6 1 4 1 77
1 4 1 0 5 0))
0* #<STANDARD-METHOD BER-DECODE (SEQUENCE)>
1[3]: (BER-DECODE #<BER-STREAM @ #x1002375e62>)
1* #<STANDARD-METHOD BER-DECODE (STREAM)>
1[3]: returned
#(1 "public"
#<RESPONSE-PDU
(10736 (5 1)) #(#(#<OBJECT-ID
SNMPv2-SMI::enterprises.77.1.4.1.0>
NIL))>)
0[3]: returned
#(1 "public"
#<RESPONSE-PDU
(10736 (5 1)) #(#(#<OBJECT-ID
SNMPv2-SMI::enterprises.77.1.4.1.0>
NIL))>)
(#<OBJECT-ID SNMPv2-SMI::enterprises.77.1.4.1.0> NIL)
SNMP>
[...]
|
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:35:35
|
On 2009-1-21, at 16:29, John Fremlin wrote:
> Hi Chun Tian,
>
> "Chun Tian (binghe)" <bin...@gm...> writes:
>> On 2009-1-21, at 15:00, John Fremlin wrote:
>>> I think that the check to see when to terminate the snmpwalk was
>>> wrong
>>> in the version of snmp we were using. The snmpwalk terminates quite
>>> arbitrarily.
>>>
>>> First, the way of comparing oids with oid-< was very, very, very
>>> wrong.
>>>
>>>> (oid->= (oid ".1") (oid ".1.0"))
>>> T
>>>> (oid->= (oid ".1.1") (oid ".1.0"))
>>> T
>>
>> Maybe I shouldn't use these confused function names, but that's what
>> the original Lisp-SNMP project called.
>>
>> I don't think your patch on oid compare would work, because what I
>> want to do in snmp-walk in definitely NOT to check which oid is
>> "big".
>>
>> [Theorem 1] The OID as a number list which appears in a "GetNext PDU"
>> chain will ALWAYS get bigger and bigger. That's just what the SNMP
>> protocol defined on GetNextPDU.
>
> Yes this is what is supposed to happen. However in practice it does
> not
> happen for the MS Windows 2k boxen. They keep returning the same oid
> from getnext for SNMPv2-SMI::enterprises.77.1.4.1.0.
>
> The snmpwalk checks for this and so should we.
>
> && snmp_oid_compare(name, name_length,
> vars->name,
> vars->name_length) >=
> 0) {
> fprintf(stderr, "Error: OID not
> increasing: ");
>
What's the correspond VALUE (beside the "same" OID) here? I think SNMP
agent will reply the same OID on GetNextPDU only if this OID doesn't
exist in the SNMP agent. I thought I've captured it well (explained in
your second note)
And I'm sorry still don't know the difference between NO-SUCH-INSTANCE
and NO-SUCH-OBJECT, I cannot find a SNMP agent which reply me NO-SUCH-
INSTANCE, can you?
>
> [...]
>
>> (defun oid-< (oid-1 oid-2)
>> "test if oid-1 is oid-2's child"
>> ...)
>>
>> Use my version, I can detect:
>>
>> 1) "sysDescr.0" is "system"'s child (oid number list longer, and
>> their
>> start parts is the same)
>> 2) "ifNumber.0" is NOT "system"'s child.
>>
>> So, What's your opinion?
>
> Sorry I was confused by the name, I assumed that < was a total order
> not
> a partial order.
>
> I guess we should use both functions and keep both termination
> checks. Which one will get renamed? ;-)
>
> [...]
--
Chun Tian (binghe)
NetEase.com, Inc.
P. R. China
|
|
From: John F. <jf...@ms...> - 2009-01-21 08:34:23
|
"Chun Tian (binghe)" <bin...@gm...> writes: > On 2009-1-21, at 15:00, John Fremlin wrote: >> >> Second the termination test >> >> (if (or (some #'oid->= new-vars base-vars) >> (member (smi :end-of-mibview) new-values >> :test #'ber-equal)) >> >> Is rather strange. >> >> One would always expect the new-vars to be > than the current-vars >= >> base-vars. > > Actually that's not strange, if you can understand my following > explanation:) What's strange is that you're using >= to mean "not a child of". I was using it to mean ">= in the normal lexical ordering". . . Otherwise it all makes sense ;-) [...] |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:30:40
|
Hi again
I think you may be right this time. Could you make a working patch for
me, after you have resolved above two mails? I don't have such a SNMP
agent, if you can supply a tcpdump/wireshark capture file, that will
be helpful for me to understand the event you met.
On 2009-1-21, at 15:00, John Fremlin wrote:
>
> Third, the termination test does not handle broken Windows 2k boxen
> that
> return no value for some OIDs. For example,
>
> .iso.org.dod.internet.private.enterprises.77.1.4.1.0 = NIL
> SNMPv2-MIB::sysDescr.0 = STRING: Hardware: x86 Family 15 Model 2
> Stepping 9 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0
> (Build 2195 Uniprocessor Free)
>
> $ snmpgetnext -c public -v 2c 192.51.54.4 .1.3.6.1.4.1.77.1.4.1.0
> Error in packet.
> Reason: (genError) A general failure occured
> Failed object: SNMPv2-SMI::enterprises.77.1.4.1.0
>
>
> This is a much better termination test that allows the walk to
> continue
> much longer.
>
> (defun snmp-walk-finished (new-vars new-values current-vars)
> (or
> (every 'not new-values)
> (some #'oid->= current-vars new-vars)
> ; two tests for broken agent; maybe we should emit an error here?
>
> (member (smi :end-of-mibview) new-values :test #'ber-equal)
> ))
>
> It is not a complete termination test compared to snmpwalk, which
> includes these two things:
>
> (vars->type != SNMP_NOSUCHOBJECT) &&
> (vars->type != SNMP_NOSUCHINSTANCE)) {
>
> Am I confused?
--
Chun Tian (binghe)
NetEase.com, Inc.
P. R. China
|
|
From: John F. <jf...@ms...> - 2009-01-21 08:30:09
|
Hi Chun Tian,
"Chun Tian (binghe)" <bin...@gm...> writes:
> On 2009-1-21, at 15:00, John Fremlin wrote:
>> I think that the check to see when to terminate the snmpwalk was wrong
>> in the version of snmp we were using. The snmpwalk terminates quite
>> arbitrarily.
>>
>> First, the way of comparing oids with oid-< was very, very, very
>> wrong.
>>
>>> (oid->= (oid ".1") (oid ".1.0"))
>> T
>>> (oid->= (oid ".1.1") (oid ".1.0"))
>> T
>
> Maybe I shouldn't use these confused function names, but that's what
> the original Lisp-SNMP project called.
>
> I don't think your patch on oid compare would work, because what I
> want to do in snmp-walk in definitely NOT to check which oid is "big".
>
> [Theorem 1] The OID as a number list which appears in a "GetNext PDU"
> chain will ALWAYS get bigger and bigger. That's just what the SNMP
> protocol defined on GetNextPDU.
Yes this is what is supposed to happen. However in practice it does not
happen for the MS Windows 2k boxen. They keep returning the same oid
from getnext for SNMPv2-SMI::enterprises.77.1.4.1.0.
The snmpwalk checks for this and so should we.
&& snmp_oid_compare(name, name_length,
vars->name,
vars->name_length) >= 0) {
fprintf(stderr, "Error: OID not increasing: ");
[...]
> (defun oid-< (oid-1 oid-2)
> "test if oid-1 is oid-2's child"
> ...)
>
> Use my version, I can detect:
>
> 1) "sysDescr.0" is "system"'s child (oid number list longer, and their
> start parts is the same)
> 2) "ifNumber.0" is NOT "system"'s child.
>
> So, What's your opinion?
Sorry I was confused by the name, I assumed that < was a total order not
a partial order.
I guess we should use both functions and keep both termination
checks. Which one will get renamed? ;-)
[...]
|
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:26:31
|
On 2009-1-21, at 15:00, John Fremlin wrote: > > Second the termination test > > (if (or (some #'oid->= new-vars base-vars) > (member (smi :end-of-mibview) new-values > :test #'ber-equal)) > > Is rather strange. > > One would always expect the new-vars to be > than the current-vars >= > base-vars. Actually that's not strange, if you can understand my following explanation:) If the MIB table you are walking is the *LAST* MIB nodes in the agent, you will see the effect of this condition. For example, I have a SNMP agent which only enable the "system" node (1.3.6.1.2.1.1) on specific community or user, all other queries outside the "system" will just reply "No Such Object". To walk such a MIB, when I met the last node, say "sysORUpTime.9", I will met: CL-USER 20 > (snmp:snmp-get-next "binghe-debian.local" "sysORUpTime.9") (#<ASN.1:OBJECT-ID SNMPv2-MIB::sysORUpTime.9> #<SNMP::SMI END-OF- MIBVIEW (2)>) If I use net-snmp's CLI tools, I'll get this: binghe@binghe-mac:~$ snmpwalk -v 2c -c public binghe-debian.local system SNMPv2-MIB::sysDescr.0 = STRING: Linux binghe-debian.local 2.6.26-1- amd64 #1 SMP Thu Oct 9 14:16:53 UTC 2008 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (48988365) 5 days, 16:04:43.65 SNMPv2-MIB::sysContact.0 = STRING: Chun Tian (binghe) <bin...@gm... > SNMPv2-MIB::sysName.0 = STRING: binghe-debian.local SNMPv2-MIB::sysLocation.0 = STRING: VMware Fusion ... SNMPv2-MIB::sysORUpTime.1 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.2 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.3 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.4 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.5 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.6 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.7 = Timeticks: (33) 0:00:00.33 SNMPv2-MIB::sysORUpTime.8 = Timeticks: (34) 0:00:00.34 SNMPv2-MIB::sysORUpTime.8 = No more variables left in this MIB View (It is past the end of the MIB tree) See, the last GetNextPDU will return the "Same" OID in its response body. If I didn't detect the END-OF-MIBVIEW value, the SNMP-WALK function will loop infinitely. (the OID->= test won't help here, because the next-var is always children of the base-var) Am I right? |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-21 08:14:55
|
Hi, John
On 2009-1-21, at 15:00, John Fremlin wrote:
> Hello Chun Tian,
>
> I think that the check to see when to terminate the snmpwalk was wrong
> in the version of snmp we were using. The snmpwalk terminates quite
> arbitrarily.
>
> First, the way of comparing oids with oid-< was very, very, very
> wrong.
>
>> (oid->= (oid ".1") (oid ".1.0"))
> T
>> (oid->= (oid ".1.1") (oid ".1.0"))
> T
Maybe I shouldn't use these confused function names, but that's what
the original Lisp-SNMP project called.
I don't think your patch on oid compare would work, because what I
want to do in snmp-walk in definitely NOT to check which oid is "big".
[Theorem 1] The OID as a number list which appears in a "GetNext PDU"
chain will ALWAYS get bigger and bigger. That's just what the SNMP
protocol defined on GetNextPDU.
For example, when I walk the "system" node (1.3.6.1.2.1.1), snmp-walk
function will call snmp-get-next manytimes and get following OID list:
system (1.3.6.1.2.1.1)
sysDescr.0 (1.3.6.1.2.1.1.1.0)
sysObjectID.0 (1.3.6.1.2.1.1.2.0)
...
sysORUpTime.1 (1.3.6.1.2.1.1.9.1.4.1)
sysORUpTime.2 (1.3.6.1.2.1.1.9.1.4.2)
...
sysORUpTime.9 (1.3.6.1.2.1.1.9.1.4.9)
Next OID on my Linux box is:
ifNumber.0 (1.3.6.1.2.1.2.1.0)
See, the OID number will always get bigger, if I use your OID->= to
test the terminal, I won't happy:
ASN.1 35 > (oid->= (oid "ifNumber.0") (oid "system"))
T
ASN.1 36 > (oid->= (oid "sysDescr.0") (oid "system"))
T
Both result is T, but I should continue walk when I met "sysDescr.0",
and terminate on "ifNumber.0".
Use my version, see:
ASN.1 40 > (oid->= (oid "ifNumber.0") (oid "system"))
T
ASN.1 41 > (oid->= (oid "sysDescr.0") (oid "system"))
NIL
That will work:)
Actually, what I really done here is clearly mentioned in function OID-
<'s documentation:
(defun oid-< (oid-1 oid-2)
"test if oid-1 is oid-2's child"
...)
Use my version, I can detect:
1) "sysDescr.0" is "system"'s child (oid number list longer, and their
start parts is the same)
2) "ifNumber.0" is NOT "system"'s child.
So, What's your opinion?
>
>
>
> Here is a fixed version for asn.1/object-id.lisp
>
> ;; return -1 if a < b
> ;; return 0 if a == b
> ;; return 1 if a > b
> (defun number-list-cmp (a b)
> (declare (optimize speed))
> (loop for i = a then (cdr i)
> for j = b then (cdr j)
> for x = (car i)
> for y = (car j)
> do
> (unless x (return (if y -1 0)))
> (unless y (return 1))
> (let ((s (signum (- x y))))
> (unless (zerop s)
> (return s)))))
>
>
> (defun oid-cmp (oid-1 oid-2)
> (number-list-cmp (oid-number-list oid-1)
> (oid-number-list oid-2)))
>
> (defun oid-< (oid-1 oid-2)
> (= -1 (oid-cmp oid-1 oid-2)))
>
> (defun oid->= (oid-1 oid-2)
> (not (oid-< oid-1 oid-2)))
>
>
> Second the termination test
>
> (if (or (some #'oid->= new-vars base-vars)
> (member (smi :end-of-mibview) new-values
> :test #'ber-equal))
>
> Is rather strange.
>
> One would always expect the new-vars to be > than the current-vars >=
> base-vars.
>
>
> Third, the termination test does not handle broken Windows 2k boxen
> that
> return no value for some OIDs. For example,
>
> .iso.org.dod.internet.private.enterprises.77.1.4.1.0 = NIL
> SNMPv2-MIB::sysDescr.0 = STRING: Hardware: x86 Family 15 Model 2
> Stepping 9 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0
> (Build 2195 Uniprocessor Free)
>
> $ snmpgetnext -c public -v 2c 192.51.54.4 .1.3.6.1.4.1.77.1.4.1.0
> Error in packet.
> Reason: (genError) A general failure occured
> Failed object: SNMPv2-SMI::enterprises.77.1.4.1.0
>
>
> This is a much better termination test that allows the walk to
> continue
> much longer.
>
> (defun snmp-walk-finished (new-vars new-values current-vars)
> (or
> (every 'not new-values)
> (some #'oid->= current-vars new-vars)
> ; two tests for broken agent; maybe we should emit an error here?
>
> (member (smi :end-of-mibview) new-values :test #'ber-equal)
> ))
>
> It is not a complete termination test compared to snmpwalk, which
> includes these two things:
>
> (vars->type != SNMP_NOSUCHOBJECT) &&
> (vars->type != SNMP_NOSUCHINSTANCE)) {
>
> Am I confused?
--
Chun Tian (binghe)
NetEase.com, Inc.
P. R. China
|
|
From: John F. <jf...@ms...> - 2009-01-21 07:23:44
|
Hello Chun Tian, SNMP> (ber-equal (smi :end-of-mibview) (gauge 2)) T Fix: (defmethod ber-equal ((a general-type) (b general-type)) (and (equalp (type-of a) (type-of b)) (= (value-of a) (value-of b)))) |
|
From: John F. <jf...@ms...> - 2009-01-21 07:00:15
|
Hello Chun Tian,
I think that the check to see when to terminate the snmpwalk was wrong
in the version of snmp we were using. The snmpwalk terminates quite
arbitrarily.
First, the way of comparing oids with oid-< was very, very, very wrong.
> (oid->= (oid ".1") (oid ".1.0"))
T
> (oid->= (oid ".1.1") (oid ".1.0"))
T
Here is a fixed version for asn.1/object-id.lisp
;; return -1 if a < b
;; return 0 if a == b
;; return 1 if a > b
(defun number-list-cmp (a b)
(declare (optimize speed))
(loop for i = a then (cdr i)
for j = b then (cdr j)
for x = (car i)
for y = (car j)
do
(unless x (return (if y -1 0)))
(unless y (return 1))
(let ((s (signum (- x y))))
(unless (zerop s)
(return s)))))
(defun oid-cmp (oid-1 oid-2)
(number-list-cmp (oid-number-list oid-1)
(oid-number-list oid-2)))
(defun oid-< (oid-1 oid-2)
(= -1 (oid-cmp oid-1 oid-2)))
(defun oid->= (oid-1 oid-2)
(not (oid-< oid-1 oid-2)))
Second the termination test
(if (or (some #'oid->= new-vars base-vars)
(member (smi :end-of-mibview) new-values
:test #'ber-equal))
Is rather strange.
One would always expect the new-vars to be > than the current-vars >=
base-vars.
Third, the termination test does not handle broken Windows 2k boxen that
return no value for some OIDs. For example,
.iso.org.dod.internet.private.enterprises.77.1.4.1.0 = NIL
SNMPv2-MIB::sysDescr.0 = STRING: Hardware: x86 Family 15 Model 2 Stepping 9 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0 (Build 2195 Uniprocessor Free)
$ snmpgetnext -c public -v 2c 192.51.54.4 .1.3.6.1.4.1.77.1.4.1.0
Error in packet.
Reason: (genError) A general failure occured
Failed object: SNMPv2-SMI::enterprises.77.1.4.1.0
This is a much better termination test that allows the walk to continue
much longer.
(defun snmp-walk-finished (new-vars new-values current-vars)
(or
(every 'not new-values)
(some #'oid->= current-vars new-vars)
; two tests for broken agent; maybe we should emit an error here?
(member (smi :end-of-mibview) new-values :test #'ber-equal)
))
It is not a complete termination test compared to snmpwalk, which
includes these two things:
(vars->type != SNMP_NOSUCHOBJECT) &&
(vars->type != SNMP_NOSUCHINSTANCE)) {
Am I confused?
|
|
From: John F. <jf...@ms...> - 2009-01-16 00:54:51
|
"Chun Tian (binghe)" <bin...@gm...> writes: > What if I put your two packages into a "contrib" directory which at > the root of cl-net-snmp SVN? Just like what I've just done: > > https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/contrib/msi/cffi-udp > https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/contrib/msi/snmp-nonblocking > > This is what I learnt from CL-HTTP project, it has also a "contrib" > directory, which have many extensions in it. People can test and use > them as they wish. > > Jianshi Huang has the SVN commit access to cl-net-snmp. I think some > README or LICENSE files should be added into your two packages, and > maybe a simple test code will be really useful to our SNMP users. > > And, please give me more time considering how to merge them into cl- > net-snmp trunk, OK? Sure, that seems like a fine place for it. The licence is Lisp LGPL. I guess I will try to tidy up the packages shortly. No hurry with merging but it would be nice if other people used it so we don't learn about all the bugs from our customers ;-) [...] |
|
From: Chun T. (binghe) <bin...@gm...> - 2009-01-15 19:40:05
|
Hi, John What if I put your two packages into a "contrib" directory which at the root of cl-net-snmp SVN? Just like what I've just done: https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/contrib/msi/cffi-udp https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/contrib/msi/snmp-nonblocking This is what I learnt from CL-HTTP project, it has also a "contrib" directory, which have many extensions in it. People can test and use them as they wish. Jianshi Huang has the SVN commit access to cl-net-snmp. I think some README or LICENSE files should be added into your two packages, and maybe a simple test code will be really useful to our SNMP users. And, please give me more time considering how to merge them into cl- net-snmp trunk, OK? --binghe On 2009-1-14, at 16:13, John Fremlin wrote: > Hi Chun Tian, > > Here is the code we are using for doing the SNMP stuff. > > http://www.msi.co.jp/~fremlin/projects/cffi-udp-20090114.tar.gz > http://www.msi.co.jp/~fremlin/projects/snmp- > nonblocking-20090114.tar.gz > > Any suggestions would be welcome. > > Mr Kuroda has agreed to release it under the Lisp LGPL, but if you > want > to incorporate it into the snmp package, that might be possible. > > If not, maybe we will release it as a separate project as it would be > nice to have it tested a little. > -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: Chun T. (binghe) <bin...@gm...> - 2008-11-22 11:47:46
|
Begin forwarded message: > From: "Chun Tian (binghe)" <bin...@gm...> > Date: 2008年11月20日 下午02时11分16秒 > To: lis...@li... > Subject: [ANN] LispWorks-UDP 4.0 > > Hi, LispWorks Users > > I'm pleased to release the version 4.0 of LispWorks-UDP! I call it > "a big step":) > > Major changes in this release: > > * Move all source code from COMM to "COMM+" package, which stop the > hacking of COMM. > All external symbols of COMM is also exported to new COMM+ > package, the compatibility of > LW's TCP facility didn't break, so just change your code to COMM+ > will works. > > * UNIX Domain Socket support is added but only as a client. Server > support is not finished yet. > Both stream and datagram socket are supported, for stream socket, > LW's COMM:SOCKET-STREAM > can be used the same as TCP socket, for datagram, you can use SEND- > MESSAGE and > RECEIVE-MESSAGE the same as UDP socket in LispWorks-UDP. > > * WAIT-FOR-INPUT function from USOCKET project is ported into > LispWorks-UDP. This function > is quite useful for waiting the sockets which available of READ. > With it, the > SOCKET-RECEIVE-TIMEOUT may not needed to set. > Note: currently only non-win32 platform is supported. TCP > compatibility is not added. > > * Encapsulation datagram socket (both UDP and unix) into CLOS classes: > INET-DATAGRAM, and UNIX-DATAGRAM, both of them are subclass of > SOCKET-DATAGRAM, > All interface function operates on instances of above classes > instead of raw socket fd. > This changes can be easier to add property or status slot for > datagram sockets > and make sure they're closed when being GCed. > > Incompatible API changes: > > * [API Change] SEND-MESSAGE and RECEIVE-MESSAGE's optional arguments > become keyword arguments > > * [API Change] RECEIVE-MESSAGE's 3rd return value (remote-address) > is a 32bit integer now, > If you want to string-like IPv4 address, call COMM:IP-ADDRESS- > STRING yourself. > > * [API Change] SET-SOCKET-RECEIVE-TIMEOUT and GET-SOCKET-RECEIVE- > TIMEOUT change name to > SOCKET-RECEIVE-TIMEOUT and (SETF SOCKET-RECEIVE- > TIMEOUT) > > For sample usage, see TEST.LISP in source code. > For full API documentation, see README in source code. > > (The LispWorks-UDP 3.x is still maintained but 2.x and 1.x will not > be maintained ever.) > > The new LispWorks-UDP project page is here: (contains download links) > > http://common-lisp.net/project/cl-net-snmp/lispworks.html > > Regards, > > -- > Chun Tian (binghe) > NetEase.com, Inc. > P. R. China > > > -- Chun Tian (binghe) NetEase.com, Inc. P. R. China |
|
From: Chun T. (b. <bin...@gm...> - 2008-11-16 13:02:30
|
Common Lisp SNMP (cl-net-snmp) 5.19
New version in this release:
* snmp 5.19
* snmp-server 3.11
* asn.1 4.14
* usocket-udp 2.4
[Download] (ASDF-INSTALL is supported)
http://sourceforge.net/project/showfiles.php?group_id=209101
[SVN Repository]
https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp
[ChangeLog]
* SNMP 5.17 ~ 5.19:
5.17: SNMP-GET on single OBJECT-ID instance works now, missing method
added.
5.18: New SMI design, SNMP special variables such as NoSuchObject and
EndOfMibView changed from keyword symbol to instances of SMI
class.
5.19: [SNMPv3] GENERATE-KU use the non-stream version to support more
CL include SCL which doesn't support Gray Streams.
* SNMP-SERVER 3.6 ~ 3.11:
3.6: bugfix: Cancel use of read-macros on some MIB variables such as
"lispMachineInstance" and "lispMachineVersion", which should be
calculated at runtime but compile-time.
3.7: (server-side fix after SNMP 5.18)
3.8: Fix for SCL, SNMP thread will exit automatically when (QUIT)
called, or SCL process will hang forever. This need USOCKET-UDP
newer than 2.4
3.9: [MIB] new SCL-MIB added, it's been defined at:
iso.org.dod.internet.private. enterprises.lisp.common-lisp.scl
(.1.3.6.1.4.1.31609.1.10)
3.10: REGISTER-VARIABLE enhancements and export this symbol to user.
3.11: (PROCESS-OBJECT-ID (OBJECT-ID (EQL :GET))) Fix, formerly
variables such as "laLoad.1" cannot be processed correctly to
reply a (SMI :NO-SUCH-OBJECT)
* ASN.1 4.13 ~ 4.14:
4.13: Fix BER decode on SEQUENCE contains unknown ASN.1 data (RAW),
export ASN.1-TYPE and GENERAL-TYPE which used by SNMP 5.18
4.14: Add a fallback BER-EQUAL to fix SNMP-WALK bug after SNMP 5.18,
export VALUE-OF which used to access slot of GENERAL-TYPE.
USOCKET-UDP 2.4:
2.4: Fix for SCL, SOCKET-SERVER thread will exit automatically after
(QUIT) be called in SCL. We start to look at
THREAD:*QUITTING-LISP* in server loop.
--
Chun Tian (binghe)
NetEase.com, Inc.
P. R. China
|