#error "ipt_ACCOUNT needs at least a PAGE_SIZE of 4096"
#endif
+static unsigned int max_tables_limit = 128;
+module_param(max_tables_limit, uint, 0);
+
/**
* Internal table structure, generated by check_entry()
* @name: name of the table
name, NIPQUAD(ip), NIPQUAD(netmask));
/* Look for existing table */
- for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
+ for (i = 0; i < max_tables_limit; i++) {
if (strncmp(ipt_acc_tables[i].name, name,
ACCOUNT_TABLE_NAME_LEN) == 0) {
pr_debug("ACCOUNT: Found existing slot: %d - "
}
/* Insert new table */
- for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
+ for (i = 0; i < max_tables_limit; i++) {
/* Found free slot */
if (ipt_acc_tables[i].name[0] == 0) {
unsigned int netsize = 0;
/* No free slot found */
printk("ACCOUNT: No free table slot found (max: %d). "
- "Please increase ACCOUNT_MAX_TABLES.\n", ACCOUNT_MAX_TABLES);
+ "Please increase the \"max_tables_limit\" module parameter.\n", max_tables_limit);
return -1;
}
info->table_nr = -1; /* Set back to original state */
/* Look for table */
- for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
+ for (i = 0; i < max_tables_limit; i++) {
if (strncmp(ian->ipt_acc_tables[i].name, info->table_name,
ACCOUNT_TABLE_NAME_LEN) == 0) {
pr_debug("ACCOUNT: Found table at slot: %d\n", i);
int table_nr = -1;
uint8_t depth;
- for (table_nr = 0; table_nr < ACCOUNT_MAX_TABLES; table_nr++)
+ for (table_nr = 0; table_nr < max_tables_limit; table_nr++)
if (strncmp(ipt_acc_tables[table_nr].name, tablename,
ACCOUNT_TABLE_NAME_LEN) == 0)
break;
- if (table_nr == ACCOUNT_MAX_TABLES) {
+ if (table_nr == max_tables_limit) {
printk("ACCOUNT: ipt_acc_handle_prepare_read(): "
"Table %s not found\n", tablename);
return -1;
int table_nr;
void *new_data_page;
- for (table_nr = 0; table_nr < ACCOUNT_MAX_TABLES; table_nr++)
+ for (table_nr = 0; table_nr < max_tables_limit; table_nr++)
if (strncmp(ipt_acc_tables[table_nr].name, tablename,
ACCOUNT_TABLE_NAME_LEN) == 0)
break;
- if (table_nr == ACCOUNT_MAX_TABLES) {
+ if (table_nr == max_tables_limit) {
printk("ACCOUNT: ipt_acc_handle_prepare_read_flush(): "
"Table %s not found\n", tablename);
return -1;
spin_lock_bh(&ian->ipt_acc_lock);
/* Determine size of table names */
- for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
+ for (i = 0; i < max_tables_limit; i++) {
if (ian->ipt_acc_tables[i].name[0] != 0)
size += strlen(ian->ipt_acc_tables[i].name) + 1;
}
}
/* Copy table names to userspace */
tnames = ian->ipt_acc_tmpbuf;
- for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
+ for (i = 0; i < max_tables_limit; i++) {
if (ian->ipt_acc_tables[i].name[0] != 0) {
name_len = strlen(ian->ipt_acc_tables[i].name) + 1;
memcpy(tnames, ian->ipt_acc_tables[i].name, name_len);
memset(ian, 0, sizeof(*ian));
sema_init(&ian->ipt_acc_userspace_mutex, 1);
- ian->ipt_acc_tables = kcalloc(ACCOUNT_MAX_TABLES,
+ ian->ipt_acc_tables = kcalloc(max_tables_limit,
sizeof(struct ipt_acc_table), GFP_KERNEL);
if (ian->ipt_acc_tables == NULL) {
printk("ACCOUNT: Out of memory allocating account_tables structure");