Skip to contentSkip to conversation

ipset command ipporthash anormal behavior

DISCUSSION Clist 2 participants 2 messages Apr 4, 2006 – Apr 6, 2006

lore
Share & tools
lore

Clist

author
#0 lore raw

Hi
I have ipsets 2.2.8

All commands using iphash run fine but, all comands from other sets return error, (ipporthas, nethash etc..)
Example:

The set clients does not exist, so it is ok to create one,

Shell Command:

ipset -N clients ipporthash --from 192.168.153.206 --to 192.168.153.207 --hashsize 1024 --probes 4 --resize 50 || echo "failure .."

it prints :

"failure .."

But the set got created!!.

This is confusing and make my script run bad, if the commnad ran sucessfully,

Why it returns error code !=0 to the OS??

Signature · 3 lines
---------------------------------------------
Clister UAH
---------------------------------------------
#1 lore raw

Hi,

Quoted 5 lines · Clist

ipset -N clients ipporthash --from 192.168.153.206 --to 192.168.153.207 --hashsize 1024 --probes 4 --resize 50 || echo "failure .."

it prints :

Quoted 7 lines

"failure .."

But the set got created!!.

This is confusing and make my script run bad, if the commnad ran sucessfully,

Why it returns error code !=0 to the OS??

That's a small bug: the set specific parse function returns 1 when it could parse the command line successfully and this return value is not erased later, but used as the final return value of the ipset command.

There'll be a new release somewhere in this month: until then you can use the attached patch.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
ipset.c +2 -1
diff -urN ipset-2.2.8/ipset.c ipset-2.2.9/ipset.c
@@ -2099,7 +2099,8 @@
 					exit_error(PARAMETER_PROBLEM,
 						   "Unknown arg `%s'",
 						   argv[optind - 1]);
-
+				
+				res = 0;
 			}
 
 			DP("next arg");