Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review following code (maybe bug patch) #8

Open
telesquare opened this issue Apr 23, 2021 · 3 comments
Open

Review following code (maybe bug patch) #8

telesquare opened this issue Apr 23, 2021 · 3 comments

Comments

@telesquare
Copy link

telesquare commented Apr 23, 2021

In snmptrap.lua

local trap_generic_reg = function (oid)
    assert(type(oid) == 'string')
    trap_generic_oid = {}
    for i in string.gmatch(oid, "%d+") do
        table.insert(trap_generic_oid, tonumber(i))
    end
    -- Register snmpTrapOID as a default SNMP trap varbind.
    trap.object_register(".1.3.6.1.6.3.1.1.4.1.0", trapGroup[snmpTrapOID], function() return true end)
end

Original src is as below
for i in string.gmatch(oid, "%d") do
With this code, some OID can not be parsed correctly, for example "1.3.6.1.4.1.29408.11.6.11.1.1.4.0"

Fixed src is as below
for i in string.gmatch(oid, "%d+") do

There is same defect in trap_specific_reg()

@begeekmyfriend
Copy link
Owner

Your PR would be welcome!

@telesquare
Copy link
Author

Your PR would be welcome!

what does PR represent?

@begeekmyfriend
Copy link
Owner

You might create a pull request for this project. Fork it and go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants