1*eb1b7900Schristos /* $NetBSD: interror.c,v 1.3 2013/05/08 18:20:14 christos Exp $ */ 2bc4097aaSchristos 3bc4097aaSchristos /* 4c9d5dc6cSdarrenr * Copyright (C) 2012 by Darren Reed. 5bc4097aaSchristos * 6bc4097aaSchristos * See the IPFILTER.LICENCE file for details on licencing. 7bc4097aaSchristos * 813885a66Sdarrenr * Id: interror.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ 9bc4097aaSchristos */ 10bc4097aaSchristos 11bc4097aaSchristos #include "ipf.h" 12bc4097aaSchristos #include <fcntl.h> 13bc4097aaSchristos #include <sys/ioctl.h> 14bc4097aaSchristos 15bc4097aaSchristos typedef struct { 16bc4097aaSchristos int iee_number; 17bc4097aaSchristos char *iee_text; 18bc4097aaSchristos } ipf_error_entry_t; 19bc4097aaSchristos 20bc4097aaSchristos static ipf_error_entry_t *find_error __P((int)); 21bc4097aaSchristos 22c9d5dc6cSdarrenr #define IPF_NUM_ERRORS 475 23bc4097aaSchristos 24bc4097aaSchristos /* 25bc4097aaSchristos * NO REUSE OF NUMBERS! 26bc4097aaSchristos * 27bc4097aaSchristos * IF YOU WANT TO ADD AN ERROR TO THIS TABLE, _ADD_ A NEW NUMBER. 28bc4097aaSchristos * DO _NOT_ USE AN EMPTY NUMBER OR FILL IN A GAP. 29bc4097aaSchristos */ 30bc4097aaSchristos static ipf_error_entry_t ipf_errors[IPF_NUM_ERRORS] = { 31bc4097aaSchristos { 1, "auth table locked/full" }, 32bc4097aaSchristos { 2, "" }, 33bc4097aaSchristos { 3, "copyinptr received bad address" }, 34bc4097aaSchristos { 4, "copyoutptr received bad address" }, 35bc4097aaSchristos { 5, "" }, 36bc4097aaSchristos { 6, "cannot load a rule with FR_T_BUILTIN flag set" }, 37bc4097aaSchristos { 7, "internal rule without FR_T_BUILDINT flag set" }, 38bc4097aaSchristos { 8, "no data provided with filter rule" }, 39bc4097aaSchristos { 9, "invalid ioctl for rule" }, 40bc4097aaSchristos { 10, "rule protocol is not 4 or 6" }, 41bc4097aaSchristos { 11, "cannot find rule function" }, 42bc4097aaSchristos { 12, "cannot find rule group" }, 43bc4097aaSchristos { 13, "group in/out does not match rule in/out" }, 44bc4097aaSchristos { 14, "rule without in/out does not belong to a group" }, 45bc4097aaSchristos { 15, "cannot determine where to append rule" }, 46bc4097aaSchristos { 16, "malloc for rule data failed" }, 47bc4097aaSchristos { 17, "copyin for rule data failed" }, 48bc4097aaSchristos { 18, "" }, 49bc4097aaSchristos { 19, "zero data size for BPF rule" }, 50bc4097aaSchristos { 20, "BPF validation failed" }, 51bc4097aaSchristos { 21, "incorrect data size for IPF rule" }, 52bc4097aaSchristos { 22, "'keep state' rule included 'with oow'" }, 53bc4097aaSchristos { 23, "bad interface index with dynamic source address" }, 54bc4097aaSchristos { 24, "bad interface index with dynamic dest. address" }, 55bc4097aaSchristos { 25, "match array verif failed for filter rule" }, 56bc4097aaSchristos { 26, "bad filter rule type" }, 57bc4097aaSchristos { 27, "rule not found for zero'stats" }, 58bc4097aaSchristos { 28, "copyout failed for zero'ing stats" }, 59bc4097aaSchristos { 29, "rule not found for removing" }, 60bc4097aaSchristos { 30, "cannot remove internal rule" }, 61bc4097aaSchristos { 31, "rule in use" }, 62bc4097aaSchristos { 32, "rule already exists" }, 63bc4097aaSchristos { 33, "no memory for another rule" }, 64bc4097aaSchristos { 34, "could not find function" }, 65bc4097aaSchristos { 35, "copyout failed for resolving function name -> addr" }, 66bc4097aaSchristos { 36, "copyout failed for resolving function addr -> name" }, 67bc4097aaSchristos { 37, "function name/addr resolving search failed" }, 68bc4097aaSchristos { 38, "group map cannot find it's hash table" }, 69bc4097aaSchristos { 39, "group map hash-table in/out do not match rule" }, 70bc4097aaSchristos { 40, "bcopyout failed for SIOCIPFINTERROR" }, 71bc4097aaSchristos { 41, "" }, 72bc4097aaSchristos { 42, "ipfilter not enabled for NAT ioctl" }, 73bc4097aaSchristos { 43, "ipfilter not enabled for state ioctl" }, 74bc4097aaSchristos { 44, "ipfilter not enabled for auth ioctl" }, 75bc4097aaSchristos { 45, "ipfilter not enbaled for sync ioctl" }, 76bc4097aaSchristos { 46, "ipfilter not enabled for scan ioctl" }, 77bc4097aaSchristos { 47, "ipfilter not enabled for lookup ioctl" }, 78bc4097aaSchristos { 48, "unrecognised device minor number for ioctl" }, 79bc4097aaSchristos { 49, "unrecognised object type for copying in ipfobj" }, 80bc4097aaSchristos { 50, "mismatching object type for copying in ipfobj" }, 81bc4097aaSchristos { 51, "object size too small for copying in ipfobj" }, 82bc4097aaSchristos { 52, "object size mismatch for copying in ipfobj" }, 83bc4097aaSchristos { 53, "compat object size too small for copying in ipfobj" }, 84bc4097aaSchristos { 54, "compat object size mismatch for copying in ipfobj" }, 85bc4097aaSchristos { 55, "error doing copyin of data for in ipfobj" }, 86bc4097aaSchristos { 56, "unrecognised object type for size copy in ipfobj" }, 87bc4097aaSchristos { 57, "object size too small for size copy in ipfobj" }, 88bc4097aaSchristos { 58, "mismatching object type for size copy in ipfobj" }, 89bc4097aaSchristos { 59, "object size mismatch for size copy in ipfobj" }, 90bc4097aaSchristos { 60, "compat object size mismatch for size copy in ipfobj" }, 91bc4097aaSchristos { 61, "error doing size copyin of data for in ipfobj" }, 92bc4097aaSchristos { 62, "bad object type for size copy out ipfobj" }, 93bc4097aaSchristos { 63, "mismatching object type for size copy out ipfobj" }, 94bc4097aaSchristos { 64, "object size mismatch for size copy out ipfobj" }, 95bc4097aaSchristos { 65, "compat object size wrong for size copy out ipfobj" }, 96bc4097aaSchristos { 66, "error doing size copyout of data for out ipfobj" }, 97bc4097aaSchristos { 67, "unrecognised object type for copying out ipfobj" }, 98bc4097aaSchristos { 68, "mismatching object type for copying out ipfobj" }, 99bc4097aaSchristos { 69, "object size too small for copying out ipfobj" }, 100bc4097aaSchristos { 70, "object size mismatch for copying out ipfobj" }, 101bc4097aaSchristos { 71, "compat object size too small for copying out ipfobj" }, 102bc4097aaSchristos { 72, "compat object size mismatch for copying out ipfobj" }, 103bc4097aaSchristos { 73, "error doing copyout of data for out ipfobj" }, 104bc4097aaSchristos { 74, "attempt to add existing tunable name" }, 105bc4097aaSchristos { 75, "cannot find tunable name to delete" }, 106bc4097aaSchristos { 76, "internal data too big for next tunable" }, 107bc4097aaSchristos { 77, "could not find tunable" }, 108bc4097aaSchristos { 78, "tunable can only be changed when ipfilter disabled" }, 109bc4097aaSchristos { 79, "new tunable value outside accepted range" }, 110bc4097aaSchristos { 80, "ipftune called for unrecognised ioctl" }, 111bc4097aaSchristos { 81, "" }, 112bc4097aaSchristos { 82, "could not find token to delete" }, 113bc4097aaSchristos { 83, "" }, 114bc4097aaSchristos { 84, "attempt to get next rule when no more exist" }, 115bc4097aaSchristos { 85, "value for iri_inout outside accepted range" }, 116bc4097aaSchristos { 86, "value for iri_active outside accepted range" }, 117bc4097aaSchristos { 87, "value for iri_nrules is 0" }, 118bc4097aaSchristos { 88, "NULL pointer specified for where to copy rule to" }, 119bc4097aaSchristos { 89, "copyout of rule failed" }, 120c9d5dc6cSdarrenr { 90, "" }, 121bc4097aaSchristos { 91, "could not get token for rule iteration" }, 122bc4097aaSchristos { 92, "unrecognised generic iterator" }, 123bc4097aaSchristos { 93, "could not find token for generic iterator" }, 124bc4097aaSchristos { 94, "need write permissions to disable/enable ipfilter" }, 125bc4097aaSchristos { 95, "error copying in enable/disable value" }, 126bc4097aaSchristos { 96, "need write permissions to set ipf tunable" }, 127bc4097aaSchristos { 97, "need write permissions to set ipf flags" }, 128bc4097aaSchristos { 98, "error doing copyin of ipf flags" }, 129bc4097aaSchristos { 99, "error doing copyout of ipf flags" }, 130bc4097aaSchristos { 100, "need write permissions to add another rule" }, 131bc4097aaSchristos { 101, "need write permissions to insert another rule" }, 132bc4097aaSchristos { 102, "need write permissions to swap active rule set" }, 133bc4097aaSchristos { 103, "error copying out current active rule set" }, 134bc4097aaSchristos { 104, "need write permissions to zero ipf stats" }, 135bc4097aaSchristos { 105, "need write permissions to flush ipf v4 rules" }, 136bc4097aaSchristos { 106, "error copying out v4 flush results" }, 137bc4097aaSchristos { 107, "error copying in v4 flush command" }, 138bc4097aaSchristos { 108, "need write permissions to flush ipf v6 rules" }, 139bc4097aaSchristos { 109, "error copying out v6 flush results" }, 140bc4097aaSchristos { 110, "error copying in v6 flush command" }, 141bc4097aaSchristos { 111, "error copying in new lock state for ipfilter" }, 142bc4097aaSchristos { 112, "need write permissions to flush ipf logs" }, 143bc4097aaSchristos { 113, "error copying out results of log flush" }, 144bc4097aaSchristos { 114, "need write permissions to resync ipf" }, 145bc4097aaSchristos { 115, "unrecognised ipf ioctl" }, 146bc4097aaSchristos { 116, "error copying in match array" }, 147bc4097aaSchristos { 117, "match array type is not IPFOBJ_IPFEXPR" }, 148bc4097aaSchristos { 118, "bad size for match array" }, 149bc4097aaSchristos { 119, "cannot allocate memory for match aray" }, 150bc4097aaSchristos { 120, "error copying in match array" }, 151bc4097aaSchristos { 121, "error verifying contents of match array" }, 152bc4097aaSchristos { 122, "need write permissions to set ipf lock status" }, 153bc4097aaSchristos { 123, "error copying in data for function resolution" }, 154bc4097aaSchristos { 124, "error copying in ipfobj structure" }, 155bc4097aaSchristos { 125, "error copying in ipfobj structure" }, 156bc4097aaSchristos { 126, "error copying in ipfobj structure" }, 157bc4097aaSchristos { 127, "error copying in ipfobj structure" }, 158bc4097aaSchristos { 128, "no memory for filter rule comment" }, 159bc4097aaSchristos { 129, "error copying in filter rule comment" }, 160bc4097aaSchristos { 130, "error copying out filter rule comment" }, 161bc4097aaSchristos { 131, "no memory for new rule alloc buffer" }, 162bc4097aaSchristos { 132, "cannot find source lookup pool" }, 163bc4097aaSchristos { 133, "unknown source address type" }, 164bc4097aaSchristos { 134, "cannot find destination lookup pool" }, 165bc4097aaSchristos { 135, "unknown destination address type" }, 166bc4097aaSchristos { 136, "icmp head group name index incorrect" }, 167bc4097aaSchristos { 137, "group head name index incorrect" }, 168bc4097aaSchristos { 138, "group name index incorrect" }, 169bc4097aaSchristos { 139, "to interface name index incorrect" }, 170bc4097aaSchristos { 140, "dup-to interface name index incorrect" }, 171bc4097aaSchristos { 141, "reply-to interface name index incorrect" }, 172bc4097aaSchristos { 142, "could not initialise call now function" }, 173bc4097aaSchristos { 143, "could not initialise call function" }, 174bc4097aaSchristos { 144, "could not find destination list" }, 175bc4097aaSchristos { 145, "auth rules cannot have dup/to/fastroute" }, 176bc4097aaSchristos { 146, "incorrect size for object to copy out" }, 177bc4097aaSchristos { 147, "object type out of bounds for kernel copyout" }, 178bc4097aaSchristos { 148, "object size too small for kernel copyout" }, 179bc4097aaSchristos { 149, "object size validation failed for kernel copyout" }, 180bc4097aaSchristos { 150, "error copying data out for kernel copyout" }, 181bc4097aaSchristos { 151, "version mismatch for kernel copyout" }, 182bc4097aaSchristos /* -------------------------------------------------------------------------- */ 183bc4097aaSchristos { 10001, "could not find token for auth iterator" }, 184bc4097aaSchristos { 10002, "write permissions require to add/remove auth rule" }, 185bc4097aaSchristos { 10003, "need write permissions to set auth lock" }, 186bc4097aaSchristos { 10004, "error copying out results of auth flush" }, 187bc4097aaSchristos { 10005, "unknown auth ioctl" }, 188bc4097aaSchristos { 10006, "can only append or remove preauth rules" }, 189bc4097aaSchristos { 10007, "NULL pointers passed in for preauth remove" }, 190bc4097aaSchristos { 10008, "preauth rule not found to remove" }, 191bc4097aaSchristos { 10009, "could not malloc memory for preauth entry" }, 192bc4097aaSchristos { 10010, "unrecognised preauth rule ioctl command" }, 193bc4097aaSchristos { 10011, "iterator data supplied with NULL pointer" }, 194bc4097aaSchristos { 10012, "unknown auth iterator type" }, 195bc4097aaSchristos { 10013, "iterator error copying out auth data" }, 196bc4097aaSchristos { 10014, "sleep waiting for auth packet interrupted" }, 197bc4097aaSchristos { 10015, "bad index supplied in auth reply" }, 198bc4097aaSchristos { 10016, "error injecting outbound packet back into kernel" }, 199bc4097aaSchristos { 10017, "error injecting inbound packet back into kernel" }, 200bc4097aaSchristos { 10018, "could not attempt to inject packet back into kernel" }, 201bc4097aaSchristos { 10019, "packet id does not match" }, 202bc4097aaSchristos /* -------------------------------------------------------------------------- */ 203bc4097aaSchristos { 20001, "invalid frag token data pointer supplied" }, 204bc4097aaSchristos { 20002, "error copying out frag token data" }, 205bc4097aaSchristos { 20003, "can only copy one fragment state entry at a time" }, 206bc4097aaSchristos /* -------------------------------------------------------------------------- */ 207bc4097aaSchristos { 30001, "incorrect object size to get hash table stats" }, 208bc4097aaSchristos { 30002, "could not malloc memory for new hash table" }, 209bc4097aaSchristos { 30003, "error coping in hash table structure" }, 210bc4097aaSchristos { 30004, "hash table already exists" }, 211bc4097aaSchristos { 30005, "mismach between new hash table and operation unit" }, 212bc4097aaSchristos { 30006, "could not malloc memory for hash table base" }, 213bc4097aaSchristos { 30007, "could not find hash table" }, 214bc4097aaSchristos { 30008, "mismatch between hash table and operation unit" }, 215bc4097aaSchristos { 30009, "could not find hash table for iterators next node" }, 216bc4097aaSchristos { 30010, "unknown iterator tpe" }, 217bc4097aaSchristos { 30011, "iterator error copying out hash table" }, 218bc4097aaSchristos { 30012, "iterator error copying out hash table entry" }, 219bc4097aaSchristos { 30013, "error copying out hash table statistics" }, 220bc4097aaSchristos { 30014, "table node delete structure wrong size" }, 221bc4097aaSchristos { 30015, "error copying in node to delete" }, 222bc4097aaSchristos { 30016, "table to delete node from does not exist" }, 223bc4097aaSchristos { 30017, "could not find table to remove node from" }, 224bc4097aaSchristos { 30018, "table node add structure wrong size" }, 225bc4097aaSchristos { 30019, "error copying in node to add" }, 226bc4097aaSchristos { 30020, "could not find table to add node to" }, 227bc4097aaSchristos { 30021, "node already exists in the table" }, 228bc4097aaSchristos { 30022, "could not find node to delete in table" }, 229bc4097aaSchristos { 30023, "uid mismatch on node to delete" }, 230c9d5dc6cSdarrenr { 30024, "object size incorrect for hash table" }, 231c9d5dc6cSdarrenr { 30025, "hash table size must be at least 1"}, 232c9d5dc6cSdarrenr { 30026, "cannot allocate memory for hash table context" }, 233bc4097aaSchristos /* -------------------------------------------------------------------------- */ 234bc4097aaSchristos { 40001, "invalid minor device numebr for log read" }, 235bc4097aaSchristos { 40002, "read size too small" }, 236bc4097aaSchristos { 40003, "interrupted waiting for log data to read" }, 237bc4097aaSchristos { 40004, "interrupted waiting for log data to read" }, 238bc4097aaSchristos { 40005, "read size too large" }, 239bc4097aaSchristos { 40006, "uiomove for read operation failed" }, 240bc4097aaSchristos /* -------------------------------------------------------------------------- */ 241bc4097aaSchristos { 50001, "unknown lookup ioctl" }, 242bc4097aaSchristos { 50002, "error copying in object data for add node" }, 243bc4097aaSchristos { 50003, "invalid unit for lookup add node" }, 244bc4097aaSchristos { 50004, "incorrect size for adding a pool node" }, 245bc4097aaSchristos { 50005, "error copying in pool node structure" }, 246bc4097aaSchristos { 50006, "mismatch in pool node address/mask families" }, 247bc4097aaSchristos { 50007, "could not find pool name" }, 248bc4097aaSchristos { 50008, "node already exists in pool" }, 249bc4097aaSchristos { 50009, "incorrect size for adding a hash node" }, 250bc4097aaSchristos { 50010, "error copying in hash node structure" }, 251bc4097aaSchristos { 50011, "could not find hash table name" }, 252bc4097aaSchristos { 50012, "unrecognised object type for lookup add node" }, 253bc4097aaSchristos { 50013, "invalid unit for lookup delete node" }, 254bc4097aaSchristos { 50014, "incorrect size for deleting a pool node" }, 255bc4097aaSchristos { 50015, "error copying in pool node structure" }, 256bc4097aaSchristos { 50016, "could not find pool name" }, 257bc4097aaSchristos { 50017, "could not find pool node" }, 258bc4097aaSchristos { 50018, "incorrect size for removing a hash node" }, 259bc4097aaSchristos { 50019, "error copying in hash node structure" }, 260bc4097aaSchristos { 50020, "could not find hash table name" }, 261bc4097aaSchristos { 50021, "unrecognised object type for lookup delete node" }, 262bc4097aaSchristos { 50022, "error copying in add table data" }, 263bc4097aaSchristos { 50023, "invalid unit for lookup add table" }, 264bc4097aaSchristos { 50024, "pool name already exists" }, 265bc4097aaSchristos { 50025, "hash table name already exists" }, 266bc4097aaSchristos { 50026, "unrecognised object type for lookup add table" }, 267bc4097aaSchristos { 50027, "error copying table data back out" }, 268bc4097aaSchristos { 50028, "error copying in remove table data" }, 269bc4097aaSchristos { 50029, "invalid unit for lookup remove table" }, 270bc4097aaSchristos { 50030, "unrecognised object type for lookup remove table" }, 271bc4097aaSchristos { 50031, "error copying in lookup stats structure" }, 272bc4097aaSchristos { 50032, "invalid unit for lookup stats" }, 273bc4097aaSchristos { 50033, "unrecognised object type for lookup stats" }, 274bc4097aaSchristos { 50034, "error copying in flush lookup data" }, 275bc4097aaSchristos { 50035, "invalid unit for lookup flush" }, 276bc4097aaSchristos { 50036, "incorrect table type for lookup flush" }, 277bc4097aaSchristos { 50037, "error copying out lookup flush results" }, 278bc4097aaSchristos { 50038, "invalid unit for lookup iterator" }, 279bc4097aaSchristos { 50039, "invalid unit for lookup iterator" }, 280bc4097aaSchristos { 50040, "could not find token for lookup iterator" }, 281bc4097aaSchristos { 50041, "unrecognised object type for lookup interator" }, 282bc4097aaSchristos { 50042, "error copying in lookup delete node operation" }, 283bc4097aaSchristos /* -------------------------------------------------------------------------- */ 284bc4097aaSchristos { 60001, "insufficient privilege for NAT write operation" }, 285bc4097aaSchristos { 60002, "need write permissions to flush NAT logs" }, 286bc4097aaSchristos { 60003, "need write permissions to turn NAT logging on/off" }, 287bc4097aaSchristos { 60004, "error copying out current NAT log setting" }, 288bc4097aaSchristos { 60005, "error copying out bytes waiting to be read in NAT \ 289bc4097aaSchristos log" }, 290bc4097aaSchristos { 60006, "need write permissions to add NAT rule" }, 291bc4097aaSchristos { 60007, "NAT rule already exists" }, 292bc4097aaSchristos { 60008, "could not allocate memory for NAT rule" }, 293bc4097aaSchristos { 60009, "need write permissions to remove NAT rule" }, 294bc4097aaSchristos { 60010, "NAT rule could not be found" }, 295bc4097aaSchristos { 60011, "could not find NAT entry for redirect lookup" }, 296bc4097aaSchristos { 60012, "need write permissions to flush NAT table" }, 297bc4097aaSchristos { 60013, "error copying in NAT flush command" }, 298bc4097aaSchristos { 60014, "need write permissions to do matching NAT flush" }, 299bc4097aaSchristos { 60015, "need write permissions to set NAT lock" }, 300bc4097aaSchristos { 60016, "need write permissions to add entry to NAT table" }, 301bc4097aaSchristos { 60017, "NAT not locked for size retrieval" }, 302bc4097aaSchristos { 60018, "NAT not locked for fetching NAT table entry" }, 303bc4097aaSchristos { 60019, "error copying in NAT token data for deletion" }, 304bc4097aaSchristos { 60020, "unknown NAT ioctl" }, 305c9d5dc6cSdarrenr { 60021, "" }, 306bc4097aaSchristos { 60022, "resolving proxy name in NAT rule failed" }, 307bc4097aaSchristos { 60023, "only reply age specified in NAT rule" }, 308bc4097aaSchristos { 60024, "error doing copyin to determine NAT entry size" }, 309bc4097aaSchristos { 60025, "error copying out NAT size of 0" }, 310bc4097aaSchristos { 60026, "NAT entry not found" }, 311bc4097aaSchristos { 60027, "error doing copyout of NAT entry size" }, 312bc4097aaSchristos { 60028, "invalid data size for getting NAT entry" }, 313bc4097aaSchristos { 60029, "could not malloc temporary space for NAT entry" }, 314bc4097aaSchristos { 60030, "no NAT table entries present" }, 315bc4097aaSchristos { 60031, "NAT entry to get next from not found" }, 316bc4097aaSchristos { 60032, "not enough space for proxy structure" }, 317bc4097aaSchristos { 60033, "not enough space for private proxy data" }, 318bc4097aaSchristos { 60034, "NAT entry size is too large" }, 319bc4097aaSchristos { 60035, "could not malloc memory for NAT entry sratch space" }, 320bc4097aaSchristos { 60036, "" }, 321bc4097aaSchristos { 60037, "could not malloc memory for NAT entry" }, 322bc4097aaSchristos { 60038, "could not malloc memory for NAT entry rule" }, 323bc4097aaSchristos { 60039, "could not resolve NAT entry rule's proxy" }, 324bc4097aaSchristos { 60040, "cannot add outbound duplicate NAT entry" }, 325bc4097aaSchristos { 60041, "cannot add inbound duplicate NAT entry" }, 326bc4097aaSchristos { 60042, "cannot add NAT entry that is neither IN nor OUT" }, 327bc4097aaSchristos { 60043, "could not malloc memory for NAT proxy data" }, 328bc4097aaSchristos { 60044, "proxy data size too big" }, 329bc4097aaSchristos { 60045, "could not malloc proxy private data for NAT entry" }, 330bc4097aaSchristos { 60046, "could not malloc memory for new NAT filter rule" }, 331bc4097aaSchristos { 60047, "could not find existing filter rule for NAT entry" }, 332bc4097aaSchristos { 60048, "insertion into NAT table failed" }, 333bc4097aaSchristos { 60049, "iterator error copying out hostmap data" }, 334bc4097aaSchristos { 60050, "iterator error copying out NAT rule data" }, 335bc4097aaSchristos { 60051, "iterator error copying out NAT entry data" }, 336bc4097aaSchristos { 60052, "iterator data supplied with NULL pointer" }, 337bc4097aaSchristos { 60053, "unknown NAT iterator type" }, 338bc4097aaSchristos { 60054, "unknwon next address type" }, 339bc4097aaSchristos { 60055, "iterator suppled with unknown type for get-next" }, 340bc4097aaSchristos { 60056, "unknown lookup group for next address" }, 341bc4097aaSchristos { 60057, "error copying out NAT log flush results" }, 342bc4097aaSchristos { 60058, "bucket table type is incorrect" }, 343bc4097aaSchristos { 60059, "error copying out NAT bucket table" }, 344bc4097aaSchristos { 60060, "function not found for lookup" }, 345bc4097aaSchristos { 60061, "address family not supported with SIOCSTPUT" }, 346bc4097aaSchristos { 60062, "unknown timeout name" }, 347bc4097aaSchristos { 60063, "cannot allocate new inbound NAT entry table" }, 348bc4097aaSchristos { 60064, "cannot allocate new outbound NAT entry table" }, 349bc4097aaSchristos { 60065, "cannot allocate new inbound NAT bucketlen table" }, 350bc4097aaSchristos { 60066, "cannot allocate new outbound NAT bucketlen table" }, 351bc4097aaSchristos { 60067, "cannot allocate new NAT rules table" }, 352bc4097aaSchristos { 60068, "cannot allocate new NAT hostmap table" }, 353bc4097aaSchristos { 60069, "new source lookup type is not dstlist" }, 354bc4097aaSchristos { 60070, "cannot allocate NAT rule scratch space" }, 355bc4097aaSchristos { 60071, "new destination lookup type is not dstlist" }, 356bc4097aaSchristos { 60072, "function not found for lookup (ipv6)" }, 357bc4097aaSchristos { 60073, "unknown lookup group for next address (ipv6)" }, 358bc4097aaSchristos { 60074, "unknown next address type (ipv6)" }, 359bc4097aaSchristos { 60075, "one object at a time must be copied" }, 360bc4097aaSchristos /* -------------------------------------------------------------------------- */ 361bc4097aaSchristos { 70001, "incorrect object size to get pool stats" }, 362bc4097aaSchristos { 70002, "could not malloc memory for new pool node" }, 363bc4097aaSchristos { 70003, "invalid addresss length for new pool node" }, 364bc4097aaSchristos { 70004, "invalid mask length for new pool node" }, 365bc4097aaSchristos { 70005, "error adding node to pool" }, 366bc4097aaSchristos { 70006, "pool already exists" }, 367bc4097aaSchristos { 70007, "could not malloc memory for new pool" }, 368bc4097aaSchristos { 70008, "could not allocate radix tree for new pool" }, 369bc4097aaSchristos { 70009, "could not find pool" }, 370bc4097aaSchristos { 70010, "unknown pool name for iteration" }, 371bc4097aaSchristos { 70011, "unknown pool iterator" }, 372bc4097aaSchristos { 70012, "error copying out pool head" }, 373bc4097aaSchristos { 70013, "error copying out pool node" }, 374bc4097aaSchristos { 70014, "add node size incorrect" }, 375bc4097aaSchristos { 70015, "error copying in pool node" }, 376c9d5dc6cSdarrenr { 70016, "" }, 377bc4097aaSchristos { 70017, "cannot find pool for node" }, 378bc4097aaSchristos { 70018, "node entry already present in pool" }, 379bc4097aaSchristos { 70019, "delete node size incorrect" }, 380bc4097aaSchristos { 70020, "error copying in node to delete" }, 381bc4097aaSchristos { 70021, "cannot find pool to delete node from" }, 382bc4097aaSchristos { 70022, "cannot find node to delete in pool" }, 383bc4097aaSchristos { 70023, "pool name already exists" }, 384bc4097aaSchristos { 70024, "uid mismatch for node removal" }, 385bc4097aaSchristos { 70025, "stats device unit is invalid" }, 386bc4097aaSchristos { 70026, "error copying out statistics" }, 387c9d5dc6cSdarrenr { 70027, "could not remove node from radix tree" }, 388c9d5dc6cSdarrenr { 70028, "incorrect address length in pool node add" }, 389c9d5dc6cSdarrenr { 70029, "incorrect mask length in pool node add" }, 390c9d5dc6cSdarrenr { 70030, "incorrect address length in pool node remove" }, 391c9d5dc6cSdarrenr { 70031, "incorrect mask length in pool node remove" }, 392c9d5dc6cSdarrenr { 70032, "cannot allocate memory for pool context" }, 393c9d5dc6cSdarrenr { 70033, "cannot allocate memory for radix tree context" }, 394c9d5dc6cSdarrenr { 70034, "adding IPv6 node with incorrect address length" }, 395c9d5dc6cSdarrenr { 70035, "IPv4 address not masked" }, 396c9d5dc6cSdarrenr { 70036, "IPv6 address not masked" }, 397c9d5dc6cSdarrenr { 70037, "removing IPv6 node with incorrect address length" }, 398bc4097aaSchristos /* -------------------------------------------------------------------------- */ 399bc4097aaSchristos { 80001, "could not find proxy" }, 400bc4097aaSchristos { 80002, "proxy does not support control operations" }, 401bc4097aaSchristos { 80003, "could not allocate data to hold proxy operation" }, 402bc4097aaSchristos { 80004, "unknown proxy ioctl" }, 403bc4097aaSchristos { 80005, "could not copyin proxy control structure" }, 404bc4097aaSchristos { 80006, "DNS proxy could not find rule to delete" }, 405bc4097aaSchristos { 80007, "DNS proxy found existing matching rule" }, 406bc4097aaSchristos { 80008, "DNS proxy could not allocate memory for new rule" }, 407bc4097aaSchristos { 80009, "DNS proxy unknown command request" }, 408bc4097aaSchristos /* -------------------------------------------------------------------------- */ 409bc4097aaSchristos { 90001, "could not malloc space for new scan structure" }, 410bc4097aaSchristos { 90002, "scan tag already exists" }, 411bc4097aaSchristos { 90003, "scan structure in use" }, 412bc4097aaSchristos { 90004, "could not find matching scan tag for filter rule" }, 413bc4097aaSchristos { 90005, "could not copyout scan statistics" }, 414bc4097aaSchristos /* -------------------------------------------------------------------------- */ 415bc4097aaSchristos { 100001, "cannot find matching state entry to remove" }, 416bc4097aaSchristos { 100002, "error copying in v4 state flush command" }, 417bc4097aaSchristos { 100003, "error copying out v4 state flush results" }, 418bc4097aaSchristos { 100004, "error copying in v6 state flush command" }, 419bc4097aaSchristos { 100005, "error copying out v6 state flush results" }, 420bc4097aaSchristos { 100006, "" }, 421bc4097aaSchristos { 100007, "" }, 422bc4097aaSchristos { 100008, "need write permissions to flush state log" }, 423bc4097aaSchristos { 100009, "erorr copyout results of flushing state log" }, 424bc4097aaSchristos { 100010, "need write permissions to turn state logging on/off" }, 425bc4097aaSchristos { 100011, "error copying in new state logging state" }, 426bc4097aaSchristos { 100012, "error copying out current state logging state" }, 427bc4097aaSchristos { 100013, "error copying out bytes waiting to be read in state \ 428bc4097aaSchristos log" }, 429bc4097aaSchristos { 100014, "need write permissions to set state lock" }, 430bc4097aaSchristos { 100015, "need write permissions to add entry to state table" }, 431bc4097aaSchristos { 100016, "state not locked for size retrieval" }, 432bc4097aaSchristos { 100017, "error copying out hash table bucket lengths" }, 433bc4097aaSchristos { 100018, "could not find token for state iterator" }, 434bc4097aaSchristos { 100019, "error copying in state token data for deletion" }, 435bc4097aaSchristos { 100020, "unknown state ioctl" }, 436bc4097aaSchristos { 100021, "no state table entries present" }, 437bc4097aaSchristos { 100022, "state entry to get next from not found" }, 438bc4097aaSchristos { 100023, "could not malloc memory for state entry" }, 439bc4097aaSchristos { 100024, "could not malloc memory for state entry rule" }, 440bc4097aaSchristos { 100025, "could not copy back state entry to user space" }, 441bc4097aaSchristos { 100026, "iterator data supplied with NULL pointer" }, 442bc4097aaSchristos { 100027, "iterator supplied with 0 item count" }, 443bc4097aaSchristos { 100028, "iterator type is incorrect" }, 444bc4097aaSchristos { 100029, "invalid state token data pointer supplied" }, 445bc4097aaSchristos { 100030, "error copying out next state entry" }, 446bc4097aaSchristos { 100031, "unrecognised table request" }, 447bc4097aaSchristos { 100032, "error copying out bucket length data" }, 448bc4097aaSchristos { 100033, "could not find existing filter rule for state entry" }, 449bc4097aaSchristos { 100034, "could not find timeout name" }, 450bc4097aaSchristos { 100035, "could not allocate new state table" }, 451bc4097aaSchristos { 100036, "could not allocate new state bucket length table" }, 452bc4097aaSchristos /* -------------------------------------------------------------------------- */ 453bc4097aaSchristos { 110001, "sync write header magic number is incorrect" }, 454bc4097aaSchristos { 110002, "sync write header protocol is incorrect" }, 455bc4097aaSchristos { 110003, "sync write header command is incorrect" }, 456bc4097aaSchristos { 110004, "sync write header table number is incorrect" }, 457bc4097aaSchristos { 110005, "data structure too small for sync write operation" }, 458bc4097aaSchristos { 110006, "zero length data with sync write header" }, 459bc4097aaSchristos { 110007, "insufficient data for sync write" }, 460bc4097aaSchristos { 110008, "bad sync read size" }, 461bc4097aaSchristos { 110009, "interrupted sync read (solaris)" }, 462bc4097aaSchristos { 110010, "interrupted sync read (hpux)" }, 463bc4097aaSchristos { 110011, "interrupted sync read (osf)" }, 464bc4097aaSchristos { 110012, "interrupted sync read" }, 465bc4097aaSchristos { 110013, "could not malloc memory for sync'd state" }, 466bc4097aaSchristos { 110014, "could not malloc memory for sync-state list item" }, 467bc4097aaSchristos { 110015, "sync update could not find state" }, 468bc4097aaSchristos { 110016, "unrecognised sync state command" }, 469bc4097aaSchristos { 110017, "could not malloc memory for new sync'd NAT entry" }, 470bc4097aaSchristos { 110018, "could not malloc memory for sync-NAT list item" }, 471bc4097aaSchristos { 110019, "sync update could not find NAT entry" }, 472bc4097aaSchristos { 110020, "unrecognised sync NAT command" }, 473bc4097aaSchristos { 110021, "ioctls are not handled with sync" }, 474bc4097aaSchristos /* -------------------------------------------------------------------------- */ 475bc4097aaSchristos { 120001, "null data pointer for iterator" }, 476bc4097aaSchristos { 120002, "unit outside of acceptable range" }, 477bc4097aaSchristos { 120003, "unknown iterator subtype" }, 478bc4097aaSchristos { 120004, "cannot find dest. list for iteration" }, 479bc4097aaSchristos { 120005, "error copying out destination iteration list" }, 480bc4097aaSchristos { 120006, "error copying out destination iteration node" }, 481bc4097aaSchristos { 120007, "wrong size for frdest_t structure" }, 482bc4097aaSchristos { 120008, "cannot allocate memory for new destination node" }, 483bc4097aaSchristos { 120009, "error copying in destination node to add" }, 484bc4097aaSchristos { 120010, "could not find destination list to add node to" }, 485bc4097aaSchristos { 120011, "error copying in destination node to remove" }, 486bc4097aaSchristos { 120012, "could not find dest. list to remove node from" }, 487bc4097aaSchristos { 120013, "destination list already exists" }, 488bc4097aaSchristos { 120014, "could not allocate new destination table" }, 489bc4097aaSchristos { 120015, "could not find destination list to remove" }, 490bc4097aaSchristos { 120016, "destination list cannot be removed - it is busy" }, 491bc4097aaSchristos { 120017, "error copying in names for destination" }, 492bc4097aaSchristos { 120018, "destination name is too long/short" }, 493bc4097aaSchristos { 120019, "unrecognised address family in destination" }, 494bc4097aaSchristos { 120020, "" }, 495bc4097aaSchristos { 120021, "error copying in new destination table" }, 496bc4097aaSchristos { 120022, "cannot allocate memory for node table" }, 497bc4097aaSchristos { 120023, "stats object size is incorrect for dest. lists" }, 498bc4097aaSchristos { 120024, "stats device unit is invalid for dest. lists" }, 499bc4097aaSchristos { 120025, "error copying out dest. list statistics" }, 500bc4097aaSchristos { 120026, "cannot allocate memory for destination node" }, 501bc4097aaSchristos { 120027, "error copying in destination node" }, 502c9d5dc6cSdarrenr { 120028, "cannot allocate memory for destination context " }, 503bc4097aaSchristos /* -------------------------------------------------------------------------- */ 504bc4097aaSchristos { 130001, "ioctl denied by system security level" }, 505bc4097aaSchristos { 130002, "ioctl operation on invalid minor device" }, 506*eb1b7900Schristos { 130003, "ioctl on device denied, ipfilter is disabled" }, 507bc4097aaSchristos { 130004, "ioctl command not allowed when disabled" }, 508bc4097aaSchristos { 130005, "ioctl denied due to insufficient authorisation" }, 509bc4097aaSchristos { 130006, "cannot read while ipfilter is disabled" }, 510bc4097aaSchristos { 130007, "read on minor device not supported" }, 511bc4097aaSchristos { 130008, "cannot write while ipfilter is disabled" }, 512bc4097aaSchristos { 130009, "write on minor device not supported" }, 513bc4097aaSchristos { 130010, "poll on minor device is not supported" }, 514bc4097aaSchristos { 130011, "error removing IPv4 filter hooks" }, 515bc4097aaSchristos { 130012, "error removing IPv6 filter hooks" }, 516bc4097aaSchristos { 130013, "attaching IPv4 hook failed" }, 517bc4097aaSchristos { 130014, "attaching IPv6 hook failed" }, 518bc4097aaSchristos { 130015, "ipf_init_all failed" }, 519bc4097aaSchristos { 130016, "finding pfil head failed" }, 520bc4097aaSchristos { 130017, "ipfilter is already initialised and running" }, 521bc4097aaSchristos }; 522bc4097aaSchristos 523bc4097aaSchristos 524bc4097aaSchristos static ipf_error_entry_t * 525bc4097aaSchristos find_error(errnum) 526bc4097aaSchristos int errnum; 527bc4097aaSchristos { 528bc4097aaSchristos ipf_error_entry_t *ie; 529bc4097aaSchristos 530bc4097aaSchristos int l = -1, r = IPF_NUM_ERRORS + 1, step; 531bc4097aaSchristos step = (r - l) / 2;; 532bc4097aaSchristos 533bc4097aaSchristos while (step != 0) { 534bc4097aaSchristos ie = ipf_errors + l + step; 535bc4097aaSchristos if (ie->iee_number == errnum) 536bc4097aaSchristos return ie; 537bc4097aaSchristos step = l + step; 538bc4097aaSchristos if (ie->iee_number > errnum) 539bc4097aaSchristos r = step; 540bc4097aaSchristos else 541bc4097aaSchristos l = step; 542bc4097aaSchristos step = (r - l) / 2;; 543bc4097aaSchristos } 544bc4097aaSchristos 545bc4097aaSchristos return NULL; 546bc4097aaSchristos } 547bc4097aaSchristos 548bc4097aaSchristos char * 549bc4097aaSchristos ipf_geterror(fd, func) 550bc4097aaSchristos int fd; 551bc4097aaSchristos ioctlfunc_t *func; 552bc4097aaSchristos { 553bc4097aaSchristos static char text[80]; 554bc4097aaSchristos ipf_error_entry_t *ie; 555bc4097aaSchristos int errnum; 556bc4097aaSchristos 557bc4097aaSchristos if ((*func)(fd, SIOCIPFINTERROR, &errnum) == 0) { 558bc4097aaSchristos 559bc4097aaSchristos ie = find_error(errnum); 560bc4097aaSchristos if (ie != NULL) 561bc4097aaSchristos return ie->iee_text; 562bc4097aaSchristos sprintf(text, "unknown error %d", errnum); 563bc4097aaSchristos } else { 564bc4097aaSchristos sprintf(text, "retrieving error number failed (%d)", errno); 565bc4097aaSchristos } 566bc4097aaSchristos return text; 567bc4097aaSchristos } 568bc4097aaSchristos 569bc4097aaSchristos 570bc4097aaSchristos char * 571bc4097aaSchristos ipf_strerror(errnum) 572bc4097aaSchristos int errnum; 573bc4097aaSchristos { 574bc4097aaSchristos static char text[80]; 575bc4097aaSchristos ipf_error_entry_t *ie; 576bc4097aaSchristos 577bc4097aaSchristos 578bc4097aaSchristos ie = find_error(errnum); 579bc4097aaSchristos if (ie != NULL) 580bc4097aaSchristos return ie->iee_text; 581bc4097aaSchristos 582bc4097aaSchristos sprintf(text, "unknown error %d", errnum); 583bc4097aaSchristos return text; 584bc4097aaSchristos } 585