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
20de7660
Commit
20de7660
authored
Aug 15, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emit the "ipv4+ipv6 and mask" error first.
parent
83ab25a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
vcc_acl.c
lib/libvcc/vcc_acl.c
+27
-15
No files found.
lib/libvcc/vcc_acl.c
View file @
20de7660
...
...
@@ -138,17 +138,17 @@ vcc_acl_chk(struct vcc *tl, const struct acl_e *ae, const int l,
AN
(
sa
);
VTCP_name
(
sa
,
h
,
sizeof
h
,
NULL
,
0
);
bprintf
(
t
,
"%s/%d"
,
h
,
ae
->
mask
);
VSB_printf
(
tl
->
sb
,
"Address/Netmask mismatch, "
);
if
(
tl
->
acl_pedantic
!=
0
)
VSB_printf
(
tl
->
sb
,
"
Address/Netmask mismatch,
need be %s
\n
"
,
t
);
VSB_printf
(
tl
->
sb
,
"need be %s
\n
"
,
t
);
else
VSB_printf
(
tl
->
sb
,
"
Address/Netmask mismatch,
changed to %s
\n
"
,
t
);
VSB_printf
(
tl
->
sb
,
"changed to %s
\n
"
,
t
);
vcc_ErrWhere
(
tl
,
ae
->
t_addr
);
if
(
tl
->
acl_pedantic
==
0
)
vcc_Warn
(
tl
);
return
(
strdup
(
t
));
}
static
void
vcc_acl_add_entry
(
struct
vcc
*
tl
,
const
struct
acl_e
*
ae
,
int
l
,
unsigned
char
*
u
,
int
fam
)
...
...
@@ -256,6 +256,30 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
}
i4
=
i6
=
0
;
for
(
res
=
res0
;
res
!=
NULL
;
res
=
res
->
ai_next
)
{
switch
(
res
->
ai_family
)
{
case
PF_INET
:
i4
++
;
break
;
case
PF_INET6
:
i6
++
;
break
;
default:
VSB_printf
(
tl
->
sb
,
"Ignoring unknown protocol family (%d) for %.*s
\n
"
,
res
->
ai_family
,
PF
(
ae
->
t_addr
));
continue
;
}
}
if
(
ae
->
t_mask
!=
NULL
&&
i4
>
0
&&
i6
>
0
)
{
VSB_printf
(
tl
->
sb
,
"Mask (/%u) specified, but string resolves to"
" both IPv4 and IPv6 addresses.
\n
"
,
ae
->
mask
);
vcc_ErrWhere
(
tl
,
ae
->
t_mask
);
return
;
}
for
(
res
=
res0
;
res
!=
NULL
;
res
=
res
->
ai_next
)
{
switch
(
res
->
ai_family
)
{
case
PF_INET
:
...
...
@@ -265,7 +289,6 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
u
=
(
void
*
)
&
sin4
->
sin_addr
;
if
(
ae
->
t_mask
==
NULL
)
ae
->
mask
=
32
;
i4
++
;
vcc_acl_add_entry
(
tl
,
ae
,
4
,
u
,
res
->
ai_family
);
break
;
case
PF_INET6
:
...
...
@@ -275,13 +298,9 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
u
=
(
void
*
)
&
sin6
->
sin6_addr
;
if
(
ae
->
t_mask
==
NULL
)
ae
->
mask
=
128
;
i6
++
;
vcc_acl_add_entry
(
tl
,
ae
,
16
,
u
,
res
->
ai_family
);
break
;
default:
VSB_printf
(
tl
->
sb
,
"Ignoring unknown protocol family (%d) for %.*s
\n
"
,
res
->
ai_family
,
PF
(
ae
->
t_addr
));
continue
;
}
if
(
tl
->
err
)
...
...
@@ -290,13 +309,6 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
}
freeaddrinfo
(
res0
);
if
(
ae
->
t_mask
!=
NULL
&&
i4
>
0
&&
i6
>
0
)
{
VSB_printf
(
tl
->
sb
,
"Mask (/%u) specified, but string resolves to"
" both IPv4 and IPv6 addresses.
\n
"
,
ae
->
mask
);
vcc_ErrWhere
(
tl
,
ae
->
t_mask
);
return
;
}
}
/*--------------------------------------------------------------------
...
...
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