Getting ipblock / iplist error: can’t convert (some number)? It’s a parsing error in iplist!

If you’re getting a parsing error that is preventing ipblock / iplist from starting such as “error: can’t convert 192“, the first thing to do is to check with ip blocking list is causing the issue. In your /etc/ipblock.conf, comment out your lists one at a time until you find the problem list.

#BLOCK_LIST=”badpeers.gz bogon.gz level1.gz”
BLOCK_LIST=”badpeers.gz level1.gz

Since yesterday, I’ve noticed that bogon.gz was causing the problem. Now, let’s look at the only place that produces the “can’t convert ” error message:

src/list.cpp:

uint32_t list::str2ip(const std::string& str)
{
uint16_t a, b, c, d;

if (sscanf(str.c_str(), “%hu.%hu.%hu.%hu”, &a, &b, &c, &d) != 4 ||
a > 255 || b > 255 || c > 255 || d > 255)
throw std::runtime_error(“can’t convert ” + str);

return a < < 24 | b << 16 | c << 8 | d; }[/cpp] Notice that the sscanf() will read in a *full* ip address and convert it to hex. If any part of the ip address is invalid (like a letter) or missing (see the bogon snippet below), iplist will spit out the error message and die. The last two lines of bogon.gz (/var/cache/iplist/bogon.gz) shows us an incomplete ip address: Bogon:192.231.155.0-192.231.155.255 Bogon:192.231.188.0-192

Whether or not to forgo the bogon.gz is up to you but personally I would like an option in iplist to print a warning and skip over that bad ip entry.

Share Button

For those of you looking for photos for the Susan G. Komen 3 Day 60 Miles Walk (http://www.the3day.org) here you go:

http://www.flickr.com/groups/3day_chicago_2010/

I am uploading 246 photos initially with more to follow.  Please add your photos or find your friends in the photos 🙂

Share Button

This is every father (especially my dad and father-in-law) when no one else is around

Share Button

You think U.S. Congress works for you? You may want to reserve judgement on that

The Daily Show With Jon Stewart Mon – Thurs 11p / 10c
I Give Up – 9/11 Responders Bill
www.thedailyshow.com
Daily Show Full Episodes Political Humor Tea Party
Share Button