Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Pkg Iptables
Commits
9caffe92
Commit
9caffe92
authored
Nov 09, 2020
by
Arturo Borrero Gonzalez
Browse files
New upstream version 1.8.6
parent
eb1d7c5f
Changes
44
Show whitespace changes
Inline
Side-by-side
libxtables/Makefile.in
View file @
9caffe92
...
...
@@ -282,6 +282,7 @@ SET_MAKE = @SET_MAKE@
SHELL
=
@SHELL@
STRIP
=
@STRIP@
VERSION
=
@VERSION@
XT_LOCK_NAME
=
@XT_LOCK_NAME@
abs_builddir
=
@abs_builddir@
abs_srcdir
=
@abs_srcdir@
abs_top_builddir
=
@abs_top_builddir@
...
...
libxtables/xtables.c
View file @
9caffe92
...
...
@@ -203,9 +203,12 @@ struct xtables_match *xtables_matches;
struct
xtables_target
*
xtables_targets
;
/* Fully register a match/target which was previously partially registered. */
static
bool
xtables_fully_register_pending_match
(
struct
xtables_match
*
me
);
static
bool
xtables_fully_register_pending_target
(
struct
xtables_target
*
me
);
static
bool
xtables_fully_register_pending_match
(
struct
xtables_match
*
me
,
struct
xtables_match
*
prev
);
static
bool
xtables_fully_register_pending_target
(
struct
xtables_target
*
me
,
struct
xtables_target
*
prev
);
#ifndef NO_SHARED_LIBS
/* registry for loaded shared objects to close later */
struct
dlreg
{
struct
dlreg
*
next
;
...
...
@@ -237,6 +240,7 @@ static void dlreg_free(void)
dlreg
=
next
;
}
}
#endif
void
xtables_init
(
void
)
{
...
...
@@ -267,7 +271,9 @@ void xtables_init(void)
void
xtables_fini
(
void
)
{
#ifndef NO_SHARED_LIBS
dlreg_free
();
#endif
}
void
xtables_set_nfproto
(
uint8_t
nfproto
)
...
...
@@ -658,6 +664,7 @@ struct xtables_match *
xtables_find_match
(
const
char
*
name
,
enum
xtables_tryload
tryload
,
struct
xtables_rule_match
**
matches
)
{
struct
xtables_match
*
prev
=
NULL
;
struct
xtables_match
**
dptr
;
struct
xtables_match
*
ptr
;
const
char
*
icmp6
=
"icmp6"
;
...
...
@@ -679,8 +686,12 @@ xtables_find_match(const char *name, enum xtables_tryload tryload,
if
(
extension_cmp
(
name
,
(
*
dptr
)
->
name
,
(
*
dptr
)
->
family
))
{
ptr
=
*
dptr
;
*
dptr
=
(
*
dptr
)
->
next
;
if
(
xtables_fully_register_pending_match
(
ptr
))
if
(
xtables_fully_register_pending_match
(
ptr
,
prev
))
{
prev
=
ptr
;
continue
;
}
else
if
(
prev
)
{
continue
;
}
*
dptr
=
ptr
;
}
dptr
=
&
((
*
dptr
)
->
next
);
...
...
@@ -774,6 +785,7 @@ xtables_find_match_revision(const char *name, enum xtables_tryload tryload,
struct
xtables_target
*
xtables_find_target
(
const
char
*
name
,
enum
xtables_tryload
tryload
)
{
struct
xtables_target
*
prev
=
NULL
;
struct
xtables_target
**
dptr
;
struct
xtables_target
*
ptr
;
...
...
@@ -790,8 +802,12 @@ xtables_find_target(const char *name, enum xtables_tryload tryload)
if
(
extension_cmp
(
name
,
(
*
dptr
)
->
name
,
(
*
dptr
)
->
family
))
{
ptr
=
*
dptr
;
*
dptr
=
(
*
dptr
)
->
next
;
if
(
xtables_fully_register_pending_target
(
ptr
))
if
(
xtables_fully_register_pending_target
(
ptr
,
prev
))
{
prev
=
ptr
;
continue
;
}
else
if
(
prev
)
{
continue
;
}
*
dptr
=
ptr
;
}
dptr
=
&
((
*
dptr
)
->
next
);
...
...
@@ -944,8 +960,14 @@ static void xtables_check_options(const char *name, const struct option *opt)
}
}
static
int
xtables_match_prefer
(
const
struct
xtables_match
*
a
,
const
struct
xtables_match
*
b
);
void
xtables_register_match
(
struct
xtables_match
*
me
)
{
struct
xtables_match
**
pos
;
bool
seen_myself
=
false
;
if
(
me
->
next
)
{
fprintf
(
stderr
,
"%s: match
\"
%s
\"
already registered
\n
"
,
xt_params
->
program_name
,
me
->
name
);
...
...
@@ -997,10 +1019,34 @@ void xtables_register_match(struct xtables_match *me)
if
(
me
->
extra_opts
!=
NULL
)
xtables_check_options
(
me
->
name
,
me
->
extra_opts
);
/* order into linked list of matches pending full registration */
for
(
pos
=
&
xtables_pending_matches
;
*
pos
;
pos
=
&
(
*
pos
)
->
next
)
{
/* group by name and family */
if
(
strcmp
(
me
->
name
,
(
*
pos
)
->
name
)
||
me
->
family
!=
(
*
pos
)
->
family
)
{
if
(
seen_myself
)
break
;
/* end of own group, append to it */
continue
;
}
/* found own group */
seen_myself
=
true
;
if
(
xtables_match_prefer
(
me
,
*
pos
)
>=
0
)
break
;
/* put preferred items first in group */
}
/* if own group was not found, prepend item */
if
(
!*
pos
&&
!
seen_myself
)
pos
=
&
xtables_pending_matches
;
/* place on linked list of matches pending full registration */
me
->
next
=
xtables_pending_matches
;
xtables_pending_matches
=
me
;
me
->
next
=
*
pos
;
*
pos
=
me
;
#ifdef DEBUG
printf
(
"%s: inserted match %s (family %d, revision %d):
\n
"
,
__func__
,
me
->
name
,
me
->
family
,
me
->
revision
);
for
(
pos
=
&
xtables_pending_matches
;
*
pos
;
pos
=
&
(
*
pos
)
->
next
)
{
printf
(
"%s:
\t
match %s (family %d, revision %d)
\n
"
,
__func__
,
(
*
pos
)
->
name
,
(
*
pos
)
->
family
,
(
*
pos
)
->
revision
);
}
#endif
}
/**
...
...
@@ -1064,64 +1110,27 @@ static int xtables_target_prefer(const struct xtables_target *a,
b
->
revision
,
b
->
family
);
}
static
bool
xtables_fully_register_pending_match
(
struct
xtables_match
*
me
)
static
bool
xtables_fully_register_pending_match
(
struct
xtables_match
*
me
,
struct
xtables_match
*
prev
)
{
struct
xtables_match
**
i
,
*
old
,
*
pos
=
NULL
;
struct
xtables_match
**
i
;
const
char
*
rn
;
int
compare
;
/* See if new match can be used. */
rn
=
(
me
->
real_name
!=
NULL
)
?
me
->
real_name
:
me
->
name
;
if
(
!
compatible_match_revision
(
rn
,
me
->
revision
))
return
false
;
old
=
xtables_find_match
(
me
->
name
,
XTF_DURING_LOAD
,
NULL
);
while
(
old
)
{
compare
=
xtables_match_prefer
(
old
,
me
);
if
(
compare
==
0
)
{
fprintf
(
stderr
,
"%s: match `%s' already registered.
\n
"
,
xt_params
->
program_name
,
me
->
name
);
exit
(
1
);
}
/* Now we have two (or more) options, check compatibility. */
rn
=
(
old
->
real_name
!=
NULL
)
?
old
->
real_name
:
old
->
name
;
if
(
compare
>
0
)
{
/* Kernel tells old isn't compatible anymore??? */
if
(
!
compatible_match_revision
(
rn
,
old
->
revision
))
{
/* Delete old one. */
for
(
i
=
&
xtables_matches
;
*
i
!=
old
;)
i
=
&
(
*
i
)
->
next
;
*
i
=
old
->
next
;
}
pos
=
old
;
old
=
old
->
next
;
if
(
!
old
)
break
;
if
(
!
extension_cmp
(
me
->
name
,
old
->
name
,
old
->
family
))
break
;
continue
;
}
/* Found right old */
pos
=
old
;
break
;
}
if
(
!
pos
)
{
if
(
!
prev
)
{
/* Append to list. */
for
(
i
=
&
xtables_matches
;
*
i
;
i
=
&
(
*
i
)
->
next
);
}
else
if
(
compare
<
0
)
{
/* Prepend it */
for
(
i
=
&
xtables_matches
;
*
i
!=
pos
;
i
=
&
(
*
i
)
->
next
);
}
else
if
(
compare
>
0
)
{
}
else
{
/* Append it */
i
=
&
p
os
->
next
;
p
os
=
p
os
->
next
;
i
=
&
p
rev
->
next
;
p
rev
=
p
rev
->
next
;
}
me
->
next
=
p
os
;
me
->
next
=
p
rev
;
*
i
=
me
;
me
->
m
=
NULL
;
...
...
@@ -1132,13 +1141,17 @@ static bool xtables_fully_register_pending_match(struct xtables_match *me)
void
xtables_register_matches
(
struct
xtables_match
*
match
,
unsigned
int
n
)
{
do
{
xtables_register_match
(
&
match
[
--
n
]);
}
while
(
n
>
0
);
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
xtables_register_match
(
&
match
[
i
]);
}
void
xtables_register_target
(
struct
xtables_target
*
me
)
{
struct
xtables_target
**
pos
;
bool
seen_myself
=
false
;
if
(
me
->
next
)
{
fprintf
(
stderr
,
"%s: target
\"
%s
\"
already registered
\n
"
,
xt_params
->
program_name
,
me
->
name
);
...
...
@@ -1194,16 +1207,40 @@ void xtables_register_target(struct xtables_target *me)
if
(
me
->
family
!=
afinfo
->
family
&&
me
->
family
!=
AF_UNSPEC
)
return
;
/* place on linked list of targets pending full registration */
me
->
next
=
xtables_pending_targets
;
xtables_pending_targets
=
me
;
/* order into linked list of targets pending full registration */
for
(
pos
=
&
xtables_pending_targets
;
*
pos
;
pos
=
&
(
*
pos
)
->
next
)
{
/* group by name */
if
(
!
extension_cmp
(
me
->
name
,
(
*
pos
)
->
name
,
(
*
pos
)
->
family
))
{
if
(
seen_myself
)
break
;
/* end of own group, append to it */
continue
;
}
/* found own group */
seen_myself
=
true
;
if
(
xtables_target_prefer
(
me
,
*
pos
)
>=
0
)
break
;
/* put preferred items first in group */
}
/* if own group was not found, prepend item */
if
(
!*
pos
&&
!
seen_myself
)
pos
=
&
xtables_pending_targets
;
me
->
next
=
*
pos
;
*
pos
=
me
;
#ifdef DEBUG
printf
(
"%s: inserted target %s (family %d, revision %d):
\n
"
,
__func__
,
me
->
name
,
me
->
family
,
me
->
revision
);
for
(
pos
=
&
xtables_pending_targets
;
*
pos
;
pos
=
&
(
*
pos
)
->
next
)
{
printf
(
"%s:
\t
target %s (family %d, revision %d)
\n
"
,
__func__
,
(
*
pos
)
->
name
,
(
*
pos
)
->
family
,
(
*
pos
)
->
revision
);
}
#endif
}
static
bool
xtables_fully_register_pending_target
(
struct
xtables_target
*
me
)
static
bool
xtables_fully_register_pending_target
(
struct
xtables_target
*
me
,
struct
xtables_target
*
prev
)
{
struct
xtables_target
**
i
,
*
old
,
*
pos
=
NULL
;
struct
xtables_target
**
i
;
const
char
*
rn
;
int
compare
;
if
(
strcmp
(
me
->
name
,
"standard"
)
!=
0
)
{
/* See if new target can be used. */
...
...
@@ -1212,54 +1249,17 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me)
return
false
;
}
old
=
xtables_find_target
(
me
->
name
,
XTF_DURING_LOAD
);
while
(
old
)
{
compare
=
xtables_target_prefer
(
old
,
me
);
if
(
compare
==
0
)
{
fprintf
(
stderr
,
"%s: target `%s' already registered.
\n
"
,
xt_params
->
program_name
,
me
->
name
);
exit
(
1
);
}
/* Now we have two (or more) options, check compatibility. */
rn
=
(
old
->
real_name
!=
NULL
)
?
old
->
real_name
:
old
->
name
;
if
(
compare
>
0
)
{
/* Kernel tells old isn't compatible anymore??? */
if
(
!
compatible_target_revision
(
rn
,
old
->
revision
))
{
/* Delete old one. */
for
(
i
=
&
xtables_targets
;
*
i
!=
old
;)
i
=
&
(
*
i
)
->
next
;
*
i
=
old
->
next
;
}
pos
=
old
;
old
=
old
->
next
;
if
(
!
old
)
break
;
if
(
!
extension_cmp
(
me
->
name
,
old
->
name
,
old
->
family
))
break
;
continue
;
}
/* Found right old */
pos
=
old
;
break
;
}
if
(
!
pos
)
{
if
(
!
prev
)
{
/* Prepend to list. */
i
=
&
xtables_targets
;
pos
=
xtables_targets
;
}
else
if
(
compare
<
0
)
{
/* Prepend it */
for
(
i
=
&
xtables_targets
;
*
i
!=
pos
;
i
=
&
(
*
i
)
->
next
);
}
else
if
(
compare
>
0
)
{
prev
=
xtables_targets
;
}
else
{
/* Append it */
i
=
&
p
os
->
next
;
p
os
=
p
os
->
next
;
i
=
&
p
rev
->
next
;
p
rev
=
p
rev
->
next
;
}
me
->
next
=
p
os
;
me
->
next
=
p
rev
;
*
i
=
me
;
me
->
t
=
NULL
;
...
...
@@ -1270,9 +1270,10 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me)
void
xtables_register_targets
(
struct
xtables_target
*
target
,
unsigned
int
n
)
{
do
{
xtables_register_target
(
&
target
[
--
n
]);
}
while
(
n
>
0
);
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
xtables_register_target
(
&
target
[
i
]);
}
/* receives a list of xtables_rule_match, release them */
...
...
utils/Makefile.am
View file @
9caffe92
...
...
@@ -14,6 +14,11 @@ sbin_PROGRAMS += nfnl_osf
pkgdata_DATA
+=
pf.os
nfnl_osf_LDADD
=
${libnfnetlink_LIBS}
uninstall-hook
:
dir
=
${DESTDIR}${pkgdatadir}
;
{
\
test
!
-d
"
$$
dir"
&&
test
!
-f
"
$$
dir"
&&
test
!
-r
"
$$
dir"
;
\
}
||
rmdir
-p
--ignore-fail-on-non-empty
"
$$
dir"
endif
if
ENABLE_BPFC
...
...
utils/Makefile.in
View file @
9caffe92
...
...
@@ -293,6 +293,7 @@ SET_MAKE = @SET_MAKE@
SHELL
=
@SHELL@
STRIP
=
@STRIP@
VERSION
=
@VERSION@
XT_LOCK_NAME
=
@XT_LOCK_NAME@
abs_builddir
=
@abs_builddir@
abs_srcdir
=
@abs_srcdir@
abs_top_builddir
=
@abs_top_builddir@
...
...
@@ -710,6 +711,7 @@ distclean-generic:
maintainer-clean-generic
:
@
echo
"This command is intended for maintainers to use"
@
echo
"it deletes files that may require special tools to rebuild."
@HAVE_LIBNFNETLINK_FALSE@uninstall-hook
:
clean
:
clean-am
clean-am
:
clean-generic clean-libtool clean-sbinPROGRAMS
\
...
...
@@ -785,10 +787,11 @@ ps-am:
uninstall-am
:
uninstall-man uninstall-pkgdataDATA
\
uninstall-sbinPROGRAMS
@
$(NORMAL_INSTALL)
$(MAKE)
$(AM_MAKEFLAGS)
uninstall-hook
uninstall-man
:
uninstall-man8
.MAKE
:
install-am install-strip
.MAKE
:
install-am install-strip
uninstall-am
.PHONY
:
CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean
\
clean-generic clean-libtool clean-sbinPROGRAMS cscopelist-am
\
...
...
@@ -803,12 +806,18 @@ uninstall-man: uninstall-man8
installcheck-am installdirs maintainer-clean
\
maintainer-clean-generic mostlyclean mostlyclean-compile
\
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am
\
tags tags-am uninstall uninstall-am uninstall-man
\
uninstall-man8 uninstall-pkgdataDATA uninstall-sbinPROGRAMS
tags tags-am uninstall uninstall-am uninstall-hook
\
uninstall-man uninstall-man8 uninstall-pkgdataDATA
\
uninstall-sbinPROGRAMS
.PRECIOUS
:
Makefile
@HAVE_LIBNFNETLINK_TRUE@uninstall-hook
:
@HAVE_LIBNFNETLINK_TRUE@
dir
=
${DESTDIR}${pkgdatadir}
;
{
\
@HAVE_LIBNFNETLINK_TRUE@
test
!
-d
"
$$
dir"
&&
test
!
-f
"
$$
dir"
&&
test
!
-r
"
$$
dir"
;
\
@HAVE_LIBNFNETLINK_TRUE@
}
||
rmdir
-p
--ignore-fail-on-non-empty
"
$$
dir"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT
:
Prev
1
2
3
Next
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