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

Reduce on unsorted ips generate warrning #18

Closed
PetrP opened this issue Sep 16, 2017 · 3 comments
Closed

Reduce on unsorted ips generate warrning #18

PetrP opened this issue Sep 16, 2017 · 3 comments
Labels
bug

Comments

@PetrP
Copy link

@PetrP PetrP commented Sep 16, 2017

When I use reduce with unsorted ip list, I get strange errors. (Data for example.list are bellow.)

iprange --reduce-factor 20 example.list
iprange: WARNING: invalid range reversed start=x.x.x.80 end=0.0.x.x
iprange: WARNING: invalid range reversed start=x.x.x.96 end=0.0.x.x
iprange: WARNING: invalid range reversed start=255.255.255.255 end=0.0.0.0
iprange: WARNING: invalid range reversed start=x.x.x.160 end=0.0.127.x

x seems random.

But when I provide same data into stdin, it works without error:

cat example.list | iprange --reduce-factor 20

It also works if I optimize data first:

iprange -J example.list > example2.list
iprange --reduce-factor 20 example2.list

I'm using version 1.0.3+ds-1 from debian stretch, but i'm on debian jessie, so it's possible it is somehow related.

cat > example.list <<EOF
216.144.250.150
69.162.124.226
69.162.124.227
69.162.124.228
69.162.124.229
69.162.124.230
69.162.124.231
69.162.124.232
69.162.124.233
69.162.124.234
69.162.124.235
69.162.124.236
69.162.124.237
63.143.42.242
63.143.42.243
63.143.42.244
63.143.42.245
63.143.42.246
63.143.42.247
63.143.42.248
63.143.42.249
63.143.42.250
63.143.42.251
63.143.42.252
63.143.42.253
46.137.190.132
122.248.234.23
188.226.183.141
178.62.52.237
54.79.28.129
54.94.142.218
104.131.107.63
54.67.10.127
54.64.67.106
159.203.30.41
46.101.250.135
18.221.56.27
EOF
ktsaou added a commit to ktsaou/iprange that referenced this issue Sep 16, 2017
@ktsaou
Copy link
Member

@ktsaou ktsaou commented Sep 16, 2017

thank you for reporting this!

A stupid bug. A line should be moved 2 positions below.

Fixed it. If you don't want to install from source, just optimize the ipset before reducing it, with a pipe, like you did.

@ktsaou ktsaou added the bug label Sep 16, 2017
@ktsaou ktsaou closed this in #19 Sep 16, 2017
@ktsaou
Copy link
Member

@ktsaou ktsaou commented Sep 16, 2017

merged it.

@PetrP
Copy link
Author

@PetrP PetrP commented Sep 16, 2017

Thanks

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

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.