summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2002-08-11 16:15:55 +0000
committerBart De Schuymer <bdschuym@pandora.be>2002-08-11 16:15:55 +0000
commit859d4e2e01385ccfd8388a19f9c27e9f28e5a719 (patch)
tree5d4fb28d6123d02625f70d53a63e5bac803e3db5
parent8136f1edaafeffbc03d0e8b2788ed194b1717f8f (diff)
*** empty log message ***
-rw-r--r--userspace/ebtables2/Makefile9
-rw-r--r--userspace/ebtables2/ebtables.c27
-rw-r--r--userspace/ebtables2/include/ebtables_u.h9
3 files changed, 24 insertions, 21 deletions
diff --git a/userspace/ebtables2/Makefile b/userspace/ebtables2/Makefile
index 1742496..ceb7329 100644
--- a/userspace/ebtables2/Makefile
+++ b/userspace/ebtables2/Makefile
@@ -2,7 +2,8 @@
KERNEL_DIR?=/usr/src/linux
PROGNAME:=ebtables
-PROGVERSION:="2.0-rc2 (August 2002)"
+PROGVERSION:="2.0-rc2"
+PROGDATE:="August 2002"
MANDIR?=/usr/local/man
CFLAGS:=-Wall -Wunused
@@ -22,8 +23,6 @@ headers:
mkdir -p /usr/include/linux/netfilter_bridge
cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge/* \
/usr/include/linux/netfilter_bridge/
- cp -f $(KERNEL_DIR)/include/linux/br_db.h \
- /usr/include/linux/br_db.h
cp -f $(KERNEL_DIR)/include/linux/netfilter_bridge.h \
/usr/include/linux/netfilter_bridge.h
cp -f $(KERNEL_DIR)/include/linux/if_ether.h \
@@ -35,11 +34,11 @@ symlink:
ln -fs $(KERNEL_DIR)/include/linux /usr/include/linux
communication.o: communication.c include/ebtables_u.h
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" -c -o $@ $<
ebtables.o: ebtables.c include/ebtables_u.h
$(CC) $(CFLAGS) -DPROGVERSION=\"$(PROGVERSION)\" \
- -DPROGNAME=\"$(PROGNAME)\" -c -o $@ $<
+ -DPROGNAME=\"$(PROGNAME)\" -DPROGDATE=\"$(PROGDATE)\" -c -o $@ $<
ebtables: ebtables.o communication.o $(EXT_OBJS)
$(CC) $(CFLAGS) -o $@ $^
diff --git a/userspace/ebtables2/ebtables.c b/userspace/ebtables2/ebtables.c
index e6f798b..fc0c8c2 100644
--- a/userspace/ebtables2/ebtables.c
+++ b/userspace/ebtables2/ebtables.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <linux/netfilter_bridge/ebtables.h>
@@ -36,6 +37,19 @@
#include <fcntl.h>
#include <sys/wait.h>
+// Don't use this function, use print_bug()
+void __print_bug(char *file, int line, char *format, ...)
+{
+ va_list l;
+
+ va_start(l, format);
+ printf(PROGNAME" v"PROGVERSION":%s:%d:--BUG--: \n", file, line);
+ vprintf(format, l);
+ printf("\n");
+ va_end(l);
+ exit (-1);
+}
+
// here are the number-name correspondences kept for the Ethernet
// frame type field
#define PROTOCOLFILE "/etc/ethertypes"
@@ -44,8 +58,6 @@
#define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe"
#endif
-static char *prog_name = PROGNAME;
-static char *prog_version = PROGVERSION;
char *hooknames[NF_BR_NUMHOOKS] =
{
[NF_BR_PRE_ROUTING]"PREROUTING",
@@ -189,7 +201,7 @@ static void initialize_entry(struct ebt_u_entry *e)
// on CONTINUE
e->t = (struct ebt_entry_target *)find_target(EBT_STANDARD_TARGET);
if (!e->t)
- print_bug("Couldn't load standard target\n");
+ print_bug("Couldn't load standard target");
}
// this doesn't free e, becoz the calling function might need e->next
@@ -776,8 +788,7 @@ static void print_help()
struct ebt_u_match_list *m_l;
struct ebt_u_watcher_list *w_l;
- printf(
-"%s v%s\n"
+ printf(PROGNAME" v"PROGVERSION" ("PROGDATE")\n"
"Usage:\n"
"ebtables -[ADI] chain rule-specification [options]\n"
"ebtables -P chain target\n"
@@ -810,9 +821,7 @@ static void print_help()
"--logical-out [!] name : logical bridge output interface name\n"
"--modprobe -M program : try to insert modules using this program\n"
"--version -V : print package version\n"
-"\n" ,
- prog_name,
- prog_version);
+"\n");
m_l = new_entry->m_list;
while (m_l) {
@@ -1669,7 +1678,7 @@ int main(int argc, char *argv[])
replace.command = 'V';
if (replace.flags & OPT_COMMAND)
print_error("Multiple commands not allowed");
- printf("%s, %s\n", prog_name, prog_version);
+ printf(PROGNAME" v"PROGVERSION" ("PROGDATE")\n");
exit(0);
case 'M': // modprobe
diff --git a/userspace/ebtables2/include/ebtables_u.h b/userspace/ebtables2/include/ebtables_u.h
index fa34e18..3fe6668 100644
--- a/userspace/ebtables2/include/ebtables_u.h
+++ b/userspace/ebtables2/include/ebtables_u.h
@@ -24,7 +24,6 @@
#ifndef EBTABLES_U_H
#define EBTABLES_U_H
#include <linux/netfilter_bridge/ebtables.h>
-#include <linux/br_db.h>
struct ebt_u_entries
{
@@ -198,21 +197,17 @@ struct ebt_u_watcher *find_watcher(const char *name);
struct ebt_u_table *find_table(char *name);
void deliver_counters(struct ebt_u_replace *repl);
void deliver_table(struct ebt_u_replace *repl);
-void get_dbinfo(struct brdb_dbinfo *nr);
-void get_db(int len, struct brdb_dbentry *db);
-void deliver_allowdb(__u16 *decision);
int name_to_number(char *name, __u16 *proto);
int number_to_name(unsigned short proto, char *name);
void check_option(unsigned int *flags, unsigned int mask);
int check_inverse(const char option[]);
+void __print_bug(char *file, int line, char *format, ...);
#define print_bug(format, args...) \
- {printf("BUG: "format".\n", ##args); exit(-1);}
+ __print_bug(__FILE__, __LINE__, format, ##args)
#define print_error(format, args...) {printf(format".\n", ##args); exit(-1);}
#define print_memory() {printf("Ebtables: " __FILE__ " " __FUNCTION__ \
" %d :Out of memory.\n", __LINE__); exit(-1);}
-
-
// used for keeping the rule counters right during rule adds or deletes
#define CNT_NORM 0
#define CNT_DEL 1