ptek/netsnmp

problem with IpAddress

Closed this issue · 3 comments

Hi,

in commit 1f35b18
you have the following change in src/Network/Protocol/NetSNMP.hsc

line 506

  • let str = B.intercalate "." (map (fromString . show) octets)
  • let str = B.intercalate "." (map (B.pack . (:[])) octets)

These 2 aren't equivalent. For 0.0.0.0 for example, the first one will result in "0.0.0.0" and the second one will result in "\NUL.\NUL.\NUL.\NUL"

ptek commented

Hi,
I did not think of it this way.
I guess running snmpGet for polling from 0.0.0.0 does not really make sense, but if a dns name resolves to it, it would be wrong, you are right.
Should I look into it, or would you like to submit a pull request?
Pavlo.

I've patched it locally at work but it's not in a public repository.
Basically, replace the B.pack from the original by the pack from Data.ByteString.Char8 and everything is ok again.

Thanks.

ptek commented

This should fix it. Thanks for your help.
I will publish the library right away