Commit d89674d1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Collapse vcc_acl_add_entry() and vcc_acl_insert_entry()

parent 1e45d97c
......@@ -4,6 +4,7 @@
-sem(vcc_new_source, custodial(1))
-sem(acl_tree_VRBT_INSERT, custodial(2))
-emacro(835, EXPR_VAR) // Info 835: A zero has been given as right argument to operator '<<'
-esym(755, VCL_40) // Not used (right now)
......
......@@ -181,30 +181,11 @@ vcc_acl_chk(struct vcc *tl, const struct acl_e *ae, const int l,
return (strdup(t));
}
static void
vcc_acl_insert_entry(struct vcc *tl, struct acl_e **aenp)
{
struct acl_e *ae2;
CHECK_OBJ_NOTNULL(*aenp, VCC_ACL_E_MAGIC);
ae2 = VRBT_INSERT(acl_tree, &tl->acl->acl_tree, *aenp);
if (ae2 != NULL) {
if (ae2->not != (*aenp)->not) {
VSB_cat(tl->sb, "Conflicting ACL entries:\n");
vcc_ErrWhere(tl, ae2->t_addr);
VSB_cat(tl->sb, "vs:\n");
vcc_ErrWhere(tl, (*aenp)->t_addr);
}
return;
}
*aenp = NULL;
}
static void
vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
unsigned char *u, int fam)
{
struct acl_e *aen;
struct acl_e *aen, *ae2;
if (fam == PF_INET && ae->mask > 32) {
VSB_printf(tl->sb,
......@@ -239,9 +220,14 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
assert(l + 1UL <= sizeof aen->data);
memcpy(aen->data + 1L, u, l);
vcc_acl_insert_entry(tl, &aen);
if (aen != NULL)
ae2 = VRBT_INSERT(acl_tree, &tl->acl->acl_tree, aen);
if (ae2 != NULL && ae2->not != aen->not) {
VSB_cat(tl->sb, "Conflicting ACL entries:\n");
vcc_ErrWhere(tl, ae2->t_addr);
VSB_cat(tl->sb, "vs:\n");
vcc_ErrWhere(tl, aen->t_addr);
vcl_acl_free(&aen);
}
}
static void
......@@ -599,7 +585,7 @@ vcc_ParseAcl(struct vcc *tl)
ERRCHK(tl);
AN(sym);
while (tl->t->tok == '-' || tl->t->tok == '+') {
while (tl->t->tok == '-' || tl->t->tok == '+') {
sign = tl->t;
vcc_NextToken(tl);
if (tl->t->b != sign->e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment