Ad Widget

Collapse

bug in ip_in_list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cockroach
    Junior Member
    • Jul 2007
    • 7

    #1

    bug in ip_in_list

    (previously posted as
    http://www.zabbix.com/forum/showthread.php?t=6993)

    The way zabbix 1.4.2 implements ip_in_list is buggy. As you strcmp the ip and the range, the comparison will fail in the following example:

    range: 10.0.0.1-10.0.0.255
    ip: 10.0.0.30

    First, you strcmp(10.0.0.30,10.0.0.1) and get, as expected, >0. Then, however, you strcmp(10.0.0.30,10.0.0.255) which, as 3 > 2, will also return >0.

    I have created a patch to fix this by actually comparing the int values. While I'm sure there's a more c-ish way to do this, it seems to work.

    Regards
    Stefan
    Attached Files
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for reporting this!
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • Sasha
      Zabbix developer
      • Sep 2007
      • 60

      #3
      Thank you for the patch! This is fixed.

      You may try the latest code from www.zabbix.com/developers.php
      ZABBIX Developer
      Riga, Latvia

      Comment

      Working...