Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
c6d9b978
Commit
c6d9b978
authored
Mar 24, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move emitting of tokens for VSL record into a subroutine
parent
b037fa8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
17 deletions
+30
-17
vcc_acl.c
lib/libvcc/vcc_acl.c
+30
-17
No files found.
lib/libvcc/vcc_acl.c
View file @
c6d9b978
...
...
@@ -417,6 +417,35 @@ vcc_acl_entry(struct vcc *tl)
ERRCHK
(
tl
);
}
/*********************************************************************
* Emit the tokens making up an entry as C-strings
*/
static
void
vcc_acl_emit_tokens
(
const
struct
vcc
*
tl
,
const
struct
acl_e
*
ae
)
{
struct
token
*
t
;
const
char
*
sep
=
""
;
t
=
ae
->
t_addr
;
do
{
if
(
t
->
tok
==
CSTR
)
{
Fh
(
tl
,
0
,
"%s
\"\\\"\"
"
,
sep
);
EncToken
(
tl
->
fh
,
t
);
Fh
(
tl
,
0
,
"
\"\\\"\"
"
);
}
else
{
Fh
(
tl
,
0
,
"%s
\"
%.*s
\"
"
,
sep
,
PF
(
t
));
}
if
(
t
==
ae
->
t_mask
)
break
;
t
=
VTAILQ_NEXT
(
t
,
list
);
AN
(
t
);
sep
=
" "
;
}
while
(
ae
->
t_mask
!=
NULL
);
if
(
ae
->
fixed
)
Fh
(
tl
,
0
,
"
\"
fixed: %s
\"
"
,
ae
->
fixed
);
}
/*********************************************************************
* Emit a function to match the ACL we have collected
*/
...
...
@@ -427,7 +456,6 @@ vcc_acl_emit(struct vcc *tl, const char *name, const char *rname)
struct
acl_e
*
ae
;
int
depth
,
l
,
m
,
i
;
unsigned
at
[
ACL_MAXADDR
];
struct
token
*
t
;
struct
inifin
*
ifp
=
NULL
;
struct
vsb
*
func
;
...
...
@@ -500,22 +528,7 @@ vcc_acl_emit(struct vcc *tl, const char *name, const char *rname)
Fh
(
tl
,
0
,
"
\t
%*sVPI_acl_log(ctx,
\"
%sMATCH %s
\"
"
,
-
i
,
""
,
ae
->
not
?
"NEG_"
:
""
,
name
);
t
=
ae
->
t_addr
;
do
{
if
(
t
->
tok
==
CSTR
)
{
Fh
(
tl
,
0
,
"
\"\\\"\"
"
);
EncToken
(
tl
->
fh
,
t
);
Fh
(
tl
,
0
,
"
\"\\\"\"
"
);
}
else
Fh
(
tl
,
0
,
"
\"
%.*s
\"
"
,
PF
(
t
));
if
(
t
==
ae
->
t_mask
)
break
;
t
=
VTAILQ_NEXT
(
t
,
list
);
AN
(
t
);
}
while
(
ae
->
t_mask
!=
NULL
);
if
(
ae
->
fixed
)
Fh
(
tl
,
0
,
"
\"
fixed: %s
\"
"
,
ae
->
fixed
);
vcc_acl_emit_tokens
(
tl
,
ae
);
Fh
(
tl
,
0
,
");
\n
"
);
Fh
(
tl
,
0
,
"
\t
%*sreturn (%d);
\n
"
,
-
i
,
""
,
ae
->
not
?
0
:
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment