Revert r355908 to commit it with a proper message.
This commit is contained in:
parent
880266635d
commit
00b45f58e8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355909
@ -623,7 +623,7 @@ add_table_entry(struct ip_fw_chain *ch, struct tid_info *ti,
|
|||||||
*
|
*
|
||||||
* May release/reacquire UH_WLOCK.
|
* May release/reacquire UH_WLOCK.
|
||||||
*/
|
*/
|
||||||
error = ipfw_link_table_values(ch, &ts, flags);
|
error = ipfw_link_table_values(ch, &ts);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (ts.modified != 0)
|
if (ts.modified != 0)
|
||||||
@ -654,14 +654,6 @@ add_table_entry(struct ip_fw_chain *ch, struct tid_info *ti,
|
|||||||
num = 0;
|
num = 0;
|
||||||
/* check limit before adding */
|
/* check limit before adding */
|
||||||
if ((error = check_table_limit(tc, ptei)) == 0) {
|
if ((error = check_table_limit(tc, ptei)) == 0) {
|
||||||
/*
|
|
||||||
* It should be safe to insert a record w/o
|
|
||||||
* a properly-linked value if atomicity is
|
|
||||||
* not required.
|
|
||||||
*
|
|
||||||
* If the added item does not have a valid value
|
|
||||||
* index, it would get rejected by ta->add().
|
|
||||||
* */
|
|
||||||
error = ta->add(tc->astate, KIDX_TO_TI(ch, kidx),
|
error = ta->add(tc->astate, KIDX_TO_TI(ch, kidx),
|
||||||
ptei, v, &num);
|
ptei, v, &num);
|
||||||
/* Set status flag to inform userland */
|
/* Set status flag to inform userland */
|
||||||
|
@ -168,8 +168,7 @@ struct table_config;
|
|||||||
struct tableop_state;
|
struct tableop_state;
|
||||||
void ipfw_table_value_init(struct ip_fw_chain *ch, int first);
|
void ipfw_table_value_init(struct ip_fw_chain *ch, int first);
|
||||||
void ipfw_table_value_destroy(struct ip_fw_chain *ch, int last);
|
void ipfw_table_value_destroy(struct ip_fw_chain *ch, int last);
|
||||||
int ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts,
|
int ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts);
|
||||||
uint8_t flags);
|
|
||||||
void ipfw_garbage_table_values(struct ip_fw_chain *ch, struct table_config *tc,
|
void ipfw_garbage_table_values(struct ip_fw_chain *ch, struct table_config *tc,
|
||||||
struct tentry_info *tei, uint32_t count, int rollback);
|
struct tentry_info *tei, uint32_t count, int rollback);
|
||||||
void ipfw_import_table_value_v1(ipfw_table_value *iv);
|
void ipfw_import_table_value_v1(ipfw_table_value *iv);
|
||||||
|
@ -363,7 +363,7 @@ rollback_table_values(struct tableop_state *ts)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
alloc_table_vidx(struct ip_fw_chain *ch, struct tableop_state *ts,
|
alloc_table_vidx(struct ip_fw_chain *ch, struct tableop_state *ts,
|
||||||
struct namedobj_instance *vi, uint16_t *pvidx, uint8_t flags)
|
struct namedobj_instance *vi, uint16_t *pvidx)
|
||||||
{
|
{
|
||||||
int error, vlimit;
|
int error, vlimit;
|
||||||
uint16_t vidx;
|
uint16_t vidx;
|
||||||
@ -384,13 +384,16 @@ alloc_table_vidx(struct ip_fw_chain *ch, struct tableop_state *ts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vlimit = ts->ta->vlimit;
|
vlimit = ts->ta->vlimit;
|
||||||
if (vlimit != 0 && vidx >= vlimit && !(flags & IPFW_CTF_ATOMIC)) {
|
if (vlimit != 0 && vidx >= vlimit) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Algorithm is not able to store given index.
|
* Algorithm is not able to store given index.
|
||||||
* We have to rollback state, start using
|
* We have to rollback state, start using
|
||||||
* per-table value array or return error
|
* per-table value array or return error
|
||||||
* if we're already using it.
|
* if we're already using it.
|
||||||
|
*
|
||||||
|
* TODO: do not rollback state if
|
||||||
|
* atomicity is not required.
|
||||||
*/
|
*/
|
||||||
if (ts->vshared != 0) {
|
if (ts->vshared != 0) {
|
||||||
/* shared -> per-table */
|
/* shared -> per-table */
|
||||||
@ -423,10 +426,9 @@ ipfw_garbage_table_values(struct ip_fw_chain *ch, struct table_config *tc,
|
|||||||
* either (1) we are successful / partially successful,
|
* either (1) we are successful / partially successful,
|
||||||
* in that case we need
|
* in that case we need
|
||||||
* * to ignore ADDED entries values
|
* * to ignore ADDED entries values
|
||||||
* * rollback every other values if atomicity is not
|
* * rollback every other values (either UPDATED since
|
||||||
* * required (either UPDATED since old value has been
|
* old value has been stored there, or some failure like
|
||||||
* stored there, or some failure like EXISTS or LIMIT
|
* EXISTS or LIMIT or simply "ignored" case.
|
||||||
* or simply "ignored" case.
|
|
||||||
*
|
*
|
||||||
* (2): atomic rollback of partially successful operation
|
* (2): atomic rollback of partially successful operation
|
||||||
* in that case we simply need to unref all entries.
|
* in that case we simply need to unref all entries.
|
||||||
@ -471,8 +473,7 @@ ipfw_garbage_table_values(struct ip_fw_chain *ch, struct table_config *tc,
|
|||||||
* Success: return 0.
|
* Success: return 0.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts,
|
ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts)
|
||||||
uint8_t flags)
|
|
||||||
{
|
{
|
||||||
int error, i, found;
|
int error, i, found;
|
||||||
struct namedobj_instance *vi;
|
struct namedobj_instance *vi;
|
||||||
@ -576,7 +577,7 @@ ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* May perform UH unlock/lock */
|
/* May perform UH unlock/lock */
|
||||||
error = alloc_table_vidx(ch, ts, vi, &vidx, flags);
|
error = alloc_table_vidx(ch, ts, vi, &vidx);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
ts->opstate.func(ts->tc, &ts->opstate);
|
ts->opstate.func(ts->tc, &ts->opstate);
|
||||||
return (error);
|
return (error);
|
||||||
|
Loading…
Reference in New Issue
Block a user