Commit 9caffe92 authored by Arturo Borrero Gonzalez's avatar Arturo Borrero Gonzalez
Browse files

New upstream version 1.8.6

parent eb1d7c5f
...@@ -282,6 +282,7 @@ SET_MAKE = @SET_MAKE@ ...@@ -282,6 +282,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
XT_LOCK_NAME = @XT_LOCK_NAME@
abs_builddir = @abs_builddir@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@ abs_top_builddir = @abs_top_builddir@
......
...@@ -203,9 +203,12 @@ struct xtables_match *xtables_matches; ...@@ -203,9 +203,12 @@ struct xtables_match *xtables_matches;
struct xtables_target *xtables_targets; struct xtables_target *xtables_targets;
/* Fully register a match/target which was previously partially registered. */ /* 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_match(struct xtables_match *me,
static bool xtables_fully_register_pending_target(struct xtables_target *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 */ /* registry for loaded shared objects to close later */
struct dlreg { struct dlreg {
struct dlreg *next; struct dlreg *next;
...@@ -237,6 +240,7 @@ static void dlreg_free(void) ...@@ -237,6 +240,7 @@ static void dlreg_free(void)
dlreg = next; dlreg = next;
} }
} }
#endif
void xtables_init(void) void xtables_init(void)
{ {
...@@ -267,7 +271,9 @@ void xtables_init(void) ...@@ -267,7 +271,9 @@ void xtables_init(void)
void xtables_fini(void) void xtables_fini(void)
{ {
#ifndef NO_SHARED_LIBS
dlreg_free(); dlreg_free();
#endif
} }
void xtables_set_nfproto(uint8_t nfproto) void xtables_set_nfproto(uint8_t nfproto)
...@@ -658,6 +664,7 @@ struct xtables_match * ...@@ -658,6 +664,7 @@ struct xtables_match *
xtables_find_match(const char *name, enum xtables_tryload tryload, xtables_find_match(const char *name, enum xtables_tryload tryload,
struct xtables_rule_match **matches) struct xtables_rule_match **matches)
{ {
struct xtables_match *prev = NULL;
struct xtables_match **dptr; struct xtables_match **dptr;
struct xtables_match *ptr; struct xtables_match *ptr;
const char *icmp6 = "icmp6"; const char *icmp6 = "icmp6";
...@@ -679,8 +686,12 @@ xtables_find_match(const char *name, enum xtables_tryload tryload, ...@@ -679,8 +686,12 @@ xtables_find_match(const char *name, enum xtables_tryload tryload,
if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) { if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) {
ptr = *dptr; ptr = *dptr;
*dptr = (*dptr)->next; *dptr = (*dptr)->next;
if (xtables_fully_register_pending_match(ptr)) if (xtables_fully_register_pending_match(ptr, prev)) {
prev = ptr;
continue; continue;
} else if (prev) {
continue;
}
*dptr = ptr; *dptr = ptr;
} }
dptr = &((*dptr)->next); dptr = &((*dptr)->next);
...@@ -774,6 +785,7 @@ xtables_find_match_revision(const char *name, enum xtables_tryload tryload, ...@@ -774,6 +785,7 @@ xtables_find_match_revision(const char *name, enum xtables_tryload tryload,
struct xtables_target * struct xtables_target *
xtables_find_target(const char *name, enum xtables_tryload tryload) xtables_find_target(const char *name, enum xtables_tryload tryload)
{ {
struct xtables_target *prev = NULL;
struct xtables_target **dptr; struct xtables_target **dptr;
struct xtables_target *ptr; struct xtables_target *ptr;
...@@ -790,8 +802,12 @@ xtables_find_target(const char *name, enum xtables_tryload tryload) ...@@ -790,8 +802,12 @@ xtables_find_target(const char *name, enum xtables_tryload tryload)
if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) { if (extension_cmp(name, (*dptr)->name, (*dptr)->family)) {
ptr = *dptr; ptr = *dptr;
*dptr = (*dptr)->next; *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; continue;
}
*dptr = ptr; *dptr = ptr;
} }
dptr = &((*dptr)->next); dptr = &((*dptr)->next);
...@@ -944,8 +960,14 @@ static void xtables_check_options(const char *name, const struct option *opt) ...@@ -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) void xtables_register_match(struct xtables_match *me)
{ {
struct xtables_match **pos;
bool seen_myself = false;
if (me->next) { if (me->next) {
fprintf(stderr, "%s: match \"%s\" already registered\n", fprintf(stderr, "%s: match \"%s\" already registered\n",
xt_params->program_name, me->name); xt_params->program_name, me->name);
...@@ -997,10 +1019,34 @@ void xtables_register_match(struct xtables_match *me) ...@@ -997,10 +1019,34 @@ void xtables_register_match(struct xtables_match *me)
if (me->extra_opts != NULL) if (me->extra_opts != NULL)
xtables_check_options(me->name, me->extra_opts); xtables_check_options(me->name, me->extra_opts);
/* order into linked list of matches pending full registration */
/* place on linked list of matches pending full registration */ for (pos = &xtables_pending_matches; *pos; pos = &(*pos)->next) {
me->next = xtables_pending_matches; /* group by name and family */
xtables_pending_matches = me; 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;
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:\tmatch %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, ...@@ -1064,64 +1110,27 @@ static int xtables_target_prefer(const struct xtables_target *a,
b->revision, b->family); 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; const char *rn;
int compare;
/* See if new match can be used. */ /* See if new match can be used. */
rn = (me->real_name != NULL) ? me->real_name : me->name; rn = (me->real_name != NULL) ? me->real_name : me->name;
if (!compatible_match_revision(rn, me->revision)) if (!compatible_match_revision(rn, me->revision))
return false; return false;
old = xtables_find_match(me->name, XTF_DURING_LOAD, NULL); if (!prev) {
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) {
/* Append to list. */ /* Append to list. */
for (i = &xtables_matches; *i; i = &(*i)->next); for (i = &xtables_matches; *i; i = &(*i)->next);
} else if (compare < 0) { } else {
/* Prepend it */
for (i = &xtables_matches; *i != pos; i = &(*i)->next);
} else if (compare > 0) {
/* Append it */ /* Append it */
i = &pos->next; i = &prev->next;
pos = pos->next; prev = prev->next;
} }
me->next = pos; me->next = prev;
*i = me; *i = me;
me->m = NULL; me->m = NULL;
...@@ -1132,13 +1141,17 @@ static bool xtables_fully_register_pending_match(struct xtables_match *me) ...@@ -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) void xtables_register_matches(struct xtables_match *match, unsigned int n)
{ {
do { int i;
xtables_register_match(&match[--n]);
} while (n > 0); for (i = 0; i < n; i++)
xtables_register_match(&match[i]);
} }
void xtables_register_target(struct xtables_target *me) void xtables_register_target(struct xtables_target *me)
{ {
struct xtables_target **pos;
bool seen_myself = false;
if (me->next) { if (me->next) {
fprintf(stderr, "%s: target \"%s\" already registered\n", fprintf(stderr, "%s: target \"%s\" already registered\n",
xt_params->program_name, me->name); xt_params->program_name, me->name);
...@@ -1194,16 +1207,40 @@ void xtables_register_target(struct xtables_target *me) ...@@ -1194,16 +1207,40 @@ void xtables_register_target(struct xtables_target *me)
if (me->family != afinfo->family && me->family != AF_UNSPEC) if (me->family != afinfo->family && me->family != AF_UNSPEC)
return; return;
/* place on linked list of targets pending full registration */ /* order into linked list of targets pending full registration */
me->next = xtables_pending_targets; for (pos = &xtables_pending_targets; *pos; pos = &(*pos)->next) {
xtables_pending_targets = me; /* 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:\ttarget %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; const char *rn;
int compare;
if (strcmp(me->name, "standard") != 0) { if (strcmp(me->name, "standard") != 0) {
/* See if new target can be used. */ /* See if new target can be used. */
...@@ -1212,54 +1249,17 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me) ...@@ -1212,54 +1249,17 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me)
return false; return false;
} }
old = xtables_find_target(me->name, XTF_DURING_LOAD); if (!prev) {
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) {
/* Prepend to list. */ /* Prepend to list. */
i = &xtables_targets; i = &xtables_targets;
pos = xtables_targets; prev = xtables_targets;
} else if (compare < 0) { } else {
/* Prepend it */
for (i = &xtables_targets; *i != pos; i = &(*i)->next);
} else if (compare > 0) {
/* Append it */ /* Append it */
i = &pos->next; i = &prev->next;
pos = pos->next; prev = prev->next;
} }
me->next = pos; me->next = prev;
*i = me; *i = me;
me->t = NULL; me->t = NULL;
...@@ -1270,9 +1270,10 @@ static bool xtables_fully_register_pending_target(struct xtables_target *me) ...@@ -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) void xtables_register_targets(struct xtables_target *target, unsigned int n)
{ {
do { int i;
xtables_register_target(&target[--n]);
} while (n > 0); for (i = 0; i < n; i++)
xtables_register_target(&target[i]);
} }
/* receives a list of xtables_rule_match, release them */ /* receives a list of xtables_rule_match, release them */
......
...@@ -14,6 +14,11 @@ sbin_PROGRAMS += nfnl_osf ...@@ -14,6 +14,11 @@ sbin_PROGRAMS += nfnl_osf
pkgdata_DATA += pf.os pkgdata_DATA += pf.os
nfnl_osf_LDADD = ${libnfnetlink_LIBS} 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 endif
if ENABLE_BPFC if ENABLE_BPFC
......
...@@ -293,6 +293,7 @@ SET_MAKE = @SET_MAKE@ ...@@ -293,6 +293,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
XT_LOCK_NAME = @XT_LOCK_NAME@
abs_builddir = @abs_builddir@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@ abs_top_builddir = @abs_top_builddir@
...@@ -710,6 +711,7 @@ distclean-generic: ...@@ -710,6 +711,7 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
@HAVE_LIBNFNETLINK_FALSE@uninstall-hook:
clean: clean-am clean: clean-am
clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \ clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \
...@@ -785,10 +787,11 @@ ps-am: ...@@ -785,10 +787,11 @@ ps-am:
uninstall-am: uninstall-man uninstall-pkgdataDATA \ uninstall-am: uninstall-man uninstall-pkgdataDATA \
uninstall-sbinPROGRAMS uninstall-sbinPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
uninstall-man: uninstall-man8 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 \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libtool clean-sbinPROGRAMS cscopelist-am \ clean-generic clean-libtool clean-sbinPROGRAMS cscopelist-am \
...@@ -803,12 +806,18 @@ uninstall-man: uninstall-man8 ...@@ -803,12 +806,18 @@ uninstall-man: uninstall-man8
installcheck-am installdirs maintainer-clean \ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \ maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-man \ tags tags-am uninstall uninstall-am uninstall-hook \
uninstall-man8 uninstall-pkgdataDATA uninstall-sbinPROGRAMS uninstall-man uninstall-man8 uninstall-pkgdataDATA \
uninstall-sbinPROGRAMS
.PRECIOUS: Makefile .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. # 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. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:
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