summaryrefslogtreecommitdiffstats
path: root/freebsd/contrib/pf/pfctl/pfctl_optimize.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/contrib/pf/pfctl/pfctl_optimize.c')
-rw-r--r--freebsd/contrib/pf/pfctl/pfctl_optimize.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/freebsd/contrib/pf/pfctl/pfctl_optimize.c b/freebsd/contrib/pf/pfctl/pfctl_optimize.c
index d17379cd..28ac4911 100644
--- a/freebsd/contrib/pf/pfctl/pfctl_optimize.c
+++ b/freebsd/contrib/pf/pfctl/pfctl_optimize.c
@@ -206,6 +206,10 @@ struct pf_rule_field {
PF_RULE_FIELD(min_ttl, NEVER),
PF_RULE_FIELD(set_tos, NEVER),
};
+#ifdef __rtems__
+static int pf_opt_create_table_num;
+static int add_opt_table_num = 0;
+#endif /* __rtems__ */
@@ -1228,7 +1232,9 @@ add_opt_table(struct pfctl *pf, struct pf_opt_tbl **tbl, sa_family_t af,
#ifdef OPT_DEBUG
char buf[128];
#endif /* OPT_DEBUG */
+#ifndef __rtems__
static int tablenum = 0;
+#endif /* __rtems__ */
struct node_host node_host;
if (*tbl == NULL) {
@@ -1241,7 +1247,11 @@ add_opt_table(struct pfctl *pf, struct pf_opt_tbl **tbl, sa_family_t af,
/* This is just a temporary table name */
snprintf((*tbl)->pt_name, sizeof((*tbl)->pt_name), "%s%d",
+#ifndef __rtems__
PF_OPT_TABLE_PREFIX, tablenum++);
+#else /* __rtems__ */
+ PF_OPT_TABLE_PREFIX, add_opt_table_num++);
+#endif /* __rtems__ */
DEBUG("creating table <%s>", (*tbl)->pt_name);
}
@@ -1277,7 +1287,6 @@ add_opt_table(struct pfctl *pf, struct pf_opt_tbl **tbl, sa_family_t af,
return (0);
}
-
/*
* Do the dirty work of choosing an unused table name and creating it.
* (be careful with the table name, it might already be used in another anchor)
@@ -1285,7 +1294,9 @@ add_opt_table(struct pfctl *pf, struct pf_opt_tbl **tbl, sa_family_t af,
int
pf_opt_create_table(struct pfctl *pf, struct pf_opt_tbl *tbl)
{
+#ifndef __rtems__
static int tablenum;
+#endif /* __rtems__ */
struct pfr_table *t;
if (table_buffer.pfrb_type == 0) {
@@ -1308,9 +1319,17 @@ pf_opt_create_table(struct pfctl *pf, struct pf_opt_tbl *tbl)
/* Now we have to pick a table name that isn't used */
again:
DEBUG("translating temporary table <%s> to <%s%x_%d>", tbl->pt_name,
+#ifndef __rtems__
PF_OPT_TABLE_PREFIX, table_identifier, tablenum);
+#else /* __rtems__ */
+ PF_OPT_TABLE_PREFIX, table_identifier, pf_opt_create_table_num);
+#endif /* __rtems__ */
snprintf(tbl->pt_name, sizeof(tbl->pt_name), "%s%x_%d",
+#ifndef __rtems__
PF_OPT_TABLE_PREFIX, table_identifier, tablenum);
+#else /* __rtems__ */
+ PF_OPT_TABLE_PREFIX, table_identifier, pf_opt_create_table_num);
+#endif /* __rtems__ */
PFRB_FOREACH(t, &table_buffer) {
if (strcasecmp(t->pfrt_name, tbl->pt_name) == 0) {
/* Collision. Try again */
@@ -1320,7 +1339,11 @@ again:
goto again;
}
}
+#ifndef __rtems__
tablenum++;
+#else /* __rtems__ */
+ pf_opt_create_table_num++;
+#endif /* __rtems__ */
if (pfctl_define_table(tbl->pt_name, PFR_TFLAG_CONST, 1,