summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2004-01-21 20:39:54 +0000
committerBart De Schuymer <bdschuym@pandora.be>2004-01-21 20:39:54 +0000
commit64182a3092399c5cfd1ad6b2ad87f9f074354292 (patch)
tree5cdb1b84fff5cbe65110cbfe3c3e5127e9501bc3 /extensions
parent80c82bbb27681dc261b8615b8abd3e94c95c72b4 (diff)
add shared libraries
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Makefile16
-rw-r--r--extensions/ebt_802_3.c19
-rw-r--r--extensions/ebt_among.c35
-rw-r--r--extensions/ebt_arp.c32
-rw-r--r--extensions/ebt_arpreply.c21
-rw-r--r--extensions/ebt_ip.c27
-rw-r--r--extensions/ebt_limit.c11
-rw-r--r--extensions/ebt_log.c7
-rw-r--r--extensions/ebt_mark.c12
-rw-r--r--extensions/ebt_mark_m.c8
-rw-r--r--extensions/ebt_nat.c28
-rw-r--r--extensions/ebt_pkttype.c7
-rw-r--r--extensions/ebt_redirect.c11
-rw-r--r--extensions/ebt_standard.c5
-rw-r--r--extensions/ebt_stp.c38
-rw-r--r--extensions/ebt_vlan.c23
-rw-r--r--extensions/ebtable_broute.c3
-rw-r--r--extensions/ebtable_filter.c3
-rw-r--r--extensions/ebtable_nat.c3
19 files changed, 157 insertions, 152 deletions
diff --git a/extensions/Makefile b/extensions/Makefile
index ec54f7d..21558f4 100644
--- a/extensions/Makefile
+++ b/extensions/Makefile
@@ -5,6 +5,22 @@ EXT_FUNC+=802_3 nat arp arpreply ip standard log redirect vlan mark_m mark \
EXT_TABLES+=filter nat broute
EXT_OBJS+=$(foreach T,$(EXT_FUNC), extensions/ebt_$(T).o)
EXT_OBJS+=$(foreach T,$(EXT_TABLES), extensions/ebtable_$(T).o)
+EXT_LIBS+=$(foreach T,$(EXT_FUNC), extensions/libebt_$(T).so)
+EXT_LIBS+=$(foreach T,$(EXT_TABLES), extensions/libebtable_$(T).so)
+EXT_LIBSI+=$(foreach T,$(EXT_FUNC), -lebt_$(T))
+EXT_LIBSI+=$(foreach T,$(EXT_TABLES), -lebtable_$(T))
+
+extensions/ebt_%.so: extensions/ebt_%.o
+ $(LD) -shared -o $@ -lc $<
+
+extensions/libebt_%.so: extensions/ebt_%.so
+ mv $< $@
+
+extensions/ebtable_%.so: extensions/ebtable_%.o
+ $(LD) -shared -o $@ -lc $<
+
+extensions/libebtable_%.so: extensions/ebtable_%.so
+ mv $< $@
extensions/ebt_%.o: extensions/ebt_%.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
diff --git a/extensions/ebt_802_3.c b/extensions/ebt_802_3.c
index f76b20a..e0b65ee 100644
--- a/extensions/ebt_802_3.c
+++ b/extensions/ebt_802_3.c
@@ -48,11 +48,11 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
info->invflags |= EBT_802_3_SAP;
if (optind > argc)
- print_error("Missing 802.3-sap argument");
+ ebt_print_error("Missing 802.3-sap argument");
i = strtoul(argv[optind - 1], &end, 16);
if (i > 255 || *end != '\0')
- print_error("Problem with specified "
- "sap hex value, %x",i);
+ ebt_print_error("Problem with specified "
+ "sap hex value, %x",i);
info->sap = i; /* one byte, so no byte order worries */
info->bitmask |= EBT_802_3_SAP;
break;
@@ -61,11 +61,11 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
if (ebt_check_inverse(optarg))
info->invflags |= EBT_802_3_TYPE;
if (optind > argc)
- print_error("Missing 802.3-type argument");
+ ebt_print_error("Missing 802.3-type argument");
i = strtoul(argv[optind - 1], &end, 16);
if (i > 65535 || *end != '\0') {
- print_error("Problem with the specified "
- "type hex value, %x",i);
+ ebt_print_error("Problem with the specified "
+ "type hex value, %x",i);
}
info->type = htons(i);
info->bitmask |= EBT_802_3_TYPE;
@@ -81,8 +81,8 @@ static void final_check(const struct ebt_u_entry *entry,
unsigned int hookmask, unsigned int time)
{
if (!(entry->bitmask & EBT_802_3))
- print_error("For 802.3 DSAP/SSAP filtering the protocol "
- "must be LENGTH");
+ ebt_print_error("For 802.3 DSAP/SSAP filtering the protocol "
+ "must be LENGTH");
}
static void print(const struct ebt_u_entry *entry,
@@ -138,8 +138,7 @@ static struct ebt_u_match _802_3_match =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&_802_3_match);
}
diff --git a/extensions/ebt_among.c b/extensions/ebt_among.c
index 9427038..1756e44 100644
--- a/extensions/ebt_among.c
+++ b/extensions/ebt_among.c
@@ -169,7 +169,7 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
char token[4];
if (!(workcopy = new_wormhash(1024))) {
- print_memory();
+ ebt_print_memory();
}
while (1) {
/* remember current position, we'll need it on error */
@@ -181,22 +181,22 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
for (i = 0; i < 5; i++) {
if (read_until(&pc, ":", token, 2) < 0
|| token[0] == 0) {
- print_error("MAC parse error: %.20s",
- anchor);
+ ebt_print_error("MAC parse error: %.20s",
+ anchor);
}
mac[i] = strtol(token, &endptr, 16);
if (*endptr) {
- print_error("MAC parse error: %.20s",
- anchor);
+ ebt_print_error("MAC parse error: %.20s",
+ anchor);
}
pc++;
}
if (read_until(&pc, "=,", token, 2) == -2 || token[0] == 0) {
- print_error("MAC parse error: %.20s", anchor);
+ ebt_print_error("MAC parse error: %.20s", anchor);
}
mac[i] = strtol(token, &endptr, 16);
if (*endptr) {
- print_error("MAC parse error: %.20s", anchor);
+ ebt_print_error("MAC parse error: %.20s", anchor);
}
if (*pc == '=') {
/* an IP follows the MAC; collect similarly to MAC */
@@ -205,13 +205,13 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
for (i = 0; i < 3; i++) {
if (read_until(&pc, ".", token, 3) < 0
|| token[0] == 0) {
- print_error
+ ebt_print_error
("IP parse error: %.20s",
anchor);
}
ip[i] = strtol(token, &endptr, 10);
if (*endptr) {
- print_error
+ ebt_print_error
("IP parse error: %.20s",
anchor);
}
@@ -219,16 +219,16 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
}
if (read_until(&pc, ",", token, 3) == -2
|| token[0] == 0) {
- print_error("IP parse error: %.20s",
+ ebt_print_error("IP parse error: %.20s",
anchor);
}
ip[3] = strtol(token, &endptr, 10);
if (*endptr) {
- print_error("IP parse error: %.20s",
+ ebt_print_error("IP parse error: %.20s",
anchor);
}
if (*(uint32_t*)ip == 0) {
- print_error("Illegal IP 0.0.0.0");
+ ebt_print_error("Illegal IP 0.0.0.0");
}
} else {
/* no IP, we set it to 0.0.0.0 */
@@ -243,7 +243,7 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
/* re-allocate memory if needed */
if (*pc && nmacs >= workcopy->poolsize) {
if (!(h = new_wormhash(nmacs * 2))) {
- print_memory();
+ ebt_print_memory();
}
copy_wormhash(h, workcopy);
free(workcopy);
@@ -259,7 +259,7 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
/* increment this to the next char */
/* but first assert :-> */
if (*pc != ',') {
- print_error("Something went wrong; no comma...\n");
+ ebt_print_error("Something went wrong; no comma...\n");
}
pc++;
@@ -270,7 +270,7 @@ static struct ebt_mac_wormhash *create_wormhash(const char *arg)
}
}
if (!(result = new_wormhash(nmacs))) {
- print_memory();
+ ebt_print_memory();
}
copy_wormhash(result, workcopy);
free(workcopy);
@@ -302,7 +302,7 @@ static int parse(int c, char **argv, int argc,
info->bitmask |= EBT_AMONG_SRC_NEG;
}
if (optind > argc)
- print_error("No MAC list specified\n");
+ ebt_print_error("No MAC list specified\n");
wh = create_wormhash(argv[optind - 1]);
old_size = sizeof(struct ebt_entry_match) +
(**match).match_size;
@@ -436,8 +436,7 @@ static struct ebt_u_match among_match = {
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&among_match);
}
diff --git a/extensions/ebt_arp.c b/extensions/ebt_arp.c
index a60d6a7..6323fc4 100644
--- a/extensions/ebt_arp.c
+++ b/extensions/ebt_arp.c
@@ -97,15 +97,15 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
arpinfo->invflags |= EBT_ARP_OPCODE;
if (optind > argc)
- print_error("Missing ARP opcode argument");
+ ebt_print_error("Missing ARP opcode argument");
i = strtol(argv[optind - 1], &end, 10);
if (i < 0 || i >= (0x1 << 16) || *end !='\0') {
for (i = 0; i < NUMOPCODES; i++)
if (!strcasecmp(opcodes[i], optarg))
break;
if (i == NUMOPCODES)
- print_error("Problem with specified "
- "ARP opcode");
+ ebt_print_error("Problem with specified "
+ "ARP opcode");
i++;
}
arpinfo->opcode = htons(i);
@@ -118,14 +118,14 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
arpinfo->invflags |= EBT_ARP_HTYPE;
if (optind > argc)
- print_error("Missing ARP hardware type argument");
+ ebt_print_error("Missing ARP hardware type argument");
i = strtol(argv[optind - 1], &end, 10);
if (i < 0 || i >= (0x1 << 16) || *end !='\0') {
if (!strcasecmp("Ethernet", argv[optind - 1]))
i = 1;
else
- print_error("Problem with specified ARP "
- "hardware type");
+ ebt_print_error("Problem with specified ARP "
+ "hardware type");
}
arpinfo->htype = htons(i);
arpinfo->bitmask |= EBT_ARP_HTYPE;
@@ -140,15 +140,15 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
arpinfo->invflags |= EBT_ARP_PTYPE;
if (optind > argc)
- print_error("Missing ARP protocol type argument");
+ ebt_print_error("Missing ARP protocol type argument");
i = strtol(argv[optind - 1], &end, 16);
if (i < 0 || i >= (0x1 << 16) || *end !='\0') {
struct ethertypeent *ent;
ent = getethertypebyname(argv[optind - 1]);
if (!ent)
- print_error("Problem with specified ARP "
- "protocol type");
+ ebt_print_error("Problem with specified ARP "
+ "protocol type");
proto = ent->e_ethertype;
} else
@@ -178,7 +178,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
arpinfo->invflags |= EBT_ARP_DST_IP;
}
if (optind > argc)
- print_error("Missing ARP IP address argument");
+ ebt_print_error("Missing ARP IP address argument");
ebt_parse_ip_address(argv[optind - 1], addr, mask);
break;
@@ -202,9 +202,10 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
arpinfo->invflags |= EBT_ARP_DST_MAC;
}
if (optind > argc)
- print_error("Missing ARP MAC address argument");
+ ebt_print_error("Missing ARP MAC address argument");
if (ebt_get_mac_and_mask(argv[optind - 1], maddr, mmask))
- print_error("Problem with ARP MAC address argument");
+ ebt_print_error("Problem with ARP MAC address "
+ "argument");
break;
default:
@@ -219,8 +220,8 @@ static void final_check(const struct ebt_u_entry *entry,
{
if ((entry->ethproto != ETH_P_ARP && entry->ethproto != ETH_P_RARP) ||
entry->invflags & EBT_IPROTO)
- print_error("For (R)ARP filtering the protocol must be "
- "specified as ARP or RARP");
+ ebt_print_error("For (R)ARP filtering the protocol must be "
+ "specified as ARP or RARP");
}
static void print(const struct ebt_u_entry *entry,
@@ -353,8 +354,7 @@ static struct ebt_u_match arp_match =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&arp_match);
}
diff --git a/extensions/ebt_arpreply.c b/extensions/ebt_arpreply.c
index d524253..9c50519 100644
--- a/extensions/ebt_arpreply.c
+++ b/extensions/ebt_arpreply.c
@@ -50,15 +50,15 @@ static int parse(int c, char **argv, int argc,
case REPLY_MAC:
ebt_check_option(flags, OPT_REPLY_MAC);
if (!(addr = ether_aton(optarg)))
- print_error("Problem with specified "
- "--arpreply-mac mac");
+ ebt_print_error("Problem with specified "
+ "--arpreply-mac mac");
memcpy(replyinfo->mac, addr, ETH_ALEN);
mac_supplied = 1;
break;
case REPLY_TARGET:
ebt_check_option(flags, OPT_REPLY_TARGET);
if (FILL_TARGET(optarg, replyinfo->target))
- print_error("Illegal --arpreply-target target");
+ ebt_print_error("Illegal --arpreply-target target");
break;
default:
@@ -75,16 +75,16 @@ static void final_check(const struct ebt_u_entry *entry,
(struct ebt_arpreply_info *)target->data;
if (entry->ethproto != ETH_P_ARP || entry->invflags & EBT_IPROTO)
- print_error("For ARP replying the protocol must be "
- "specified as ARP");
+ ebt_print_error("For ARP replying the protocol must be "
+ "specified as ARP");
if (time == 0 && mac_supplied == 0)
- print_error("No arpreply mac supplied");
+ ebt_print_error("No arpreply mac supplied");
if (BASE_CHAIN && replyinfo->target == EBT_RETURN)
- print_error("--arpreply-target RETURN not allowed on "
- "base chain");
+ ebt_print_error("--arpreply-target RETURN not allowed on "
+ "base chain");
CLEAR_BASE_CHAIN_BIT;
if (strcmp(name, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING))
- print_error("arpreply only allowed in PREROUTING");
+ ebt_print_error("arpreply only allowed in PREROUTING");
}
static void print(const struct ebt_u_entry *entry,
@@ -125,8 +125,7 @@ static struct ebt_u_target arpreply_target =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&arpreply_target);
}
diff --git a/extensions/ebt_ip.c b/extensions/ebt_ip.c
index f93b8b9..6d9233e 100644
--- a/extensions/ebt_ip.c
+++ b/extensions/ebt_ip.c
@@ -74,8 +74,8 @@ static uint16_t parse_port(const char *protocol, const char *name)
else if (port >= 0 || port <= 0xFFFF) {
return port;
}
- print_error("Problem with specified %s port '%s'",
- protocol?protocol:"", name);
+ ebt_print_error("Problem with specified %s port '%s'",
+ protocol?protocol:"", name);
return 0; /* never reached */
}
@@ -95,7 +95,7 @@ parse_port_range(const char *protocol, const char *portstring, uint16_t *ports)
ports[1] = cp[0] ? parse_port(protocol, cp) : 0xFFFF;
if (ports[0] > ports[1])
- print_error("Invalid portrange (min > max)");
+ ebt_print_error("Invalid portrange (min > max)");
}
free(buffer);
}
@@ -159,7 +159,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
}
if (optind > argc)
- print_error("Missing IP address argument");
+ ebt_print_error("Missing IP address argument");
if (c == IP_SOURCE)
ebt_parse_ip_address(argv[optind - 1], &ipinfo->saddr,
&ipinfo->smsk);
@@ -182,7 +182,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
ipinfo->invflags |= EBT_IP_DPORT;
}
if (optind > argc)
- print_error("Missing port argument");
+ ebt_print_error("Missing port argument");
if (c == IP_SPORT)
parse_port_range(NULL, argv[optind - 1], ipinfo->sport);
else
@@ -195,10 +195,10 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
ipinfo->invflags |= EBT_IP_TOS;
if (optind > argc)
- print_error("Missing IP tos argument");
+ ebt_print_error("Missing IP tos argument");
i = strtol(argv[optind - 1], &end, 16);
if (i < 0 || i > 255 || *end != '\0')
- print_error("Problem with specified IP tos");
+ ebt_print_error("Problem with specified IP tos");
ipinfo->tos = i;
ipinfo->bitmask |= EBT_IP_TOS;
break;
@@ -208,14 +208,14 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
if (ebt_check_inverse(optarg))
ipinfo->invflags |= EBT_IP_PROTO;
if (optind > argc)
- print_error("Missing IP protocol argument");
+ ebt_print_error("Missing IP protocol argument");
(unsigned char) i = strtoul(argv[optind - 1], &end, 10);
if (*end != '\0') {
struct protoent *pe;
pe = getprotobyname(argv[optind - 1]);
if (pe == NULL)
- print_error
+ ebt_print_error
("Unknown specified IP protocol - %s",
argv[optind - 1]);
ipinfo->protocol = pe->p_proto;
@@ -237,7 +237,7 @@ static void final_check(const struct ebt_u_entry *entry,
struct ebt_ip_info *ipinfo = (struct ebt_ip_info *)match->data;
if (entry->ethproto != ETH_P_IP || entry->invflags & EBT_IPROTO)
- print_error("For IP filtering the protocol must be "
+ ebt_print_error("For IP filtering the protocol must be "
"specified as IPv4");
if (ipinfo->bitmask & (EBT_IP_SPORT|EBT_IP_DPORT) &&
@@ -245,8 +245,8 @@ static void final_check(const struct ebt_u_entry *entry,
ipinfo->invflags & EBT_IP_PROTO ||
(ipinfo->protocol!=IPPROTO_TCP &&
ipinfo->protocol!=IPPROTO_UDP)))
- print_error("For port filtering the IP protocol must be "
- "either 6 (tcp) or 17 (udp)");
+ ebt_print_error("For port filtering the IP protocol must be "
+ "either 6 (tcp) or 17 (udp)");
}
static void print(const struct ebt_u_entry *entry,
@@ -364,8 +364,7 @@ static struct ebt_u_match ip_match =
.extra_ops = opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&ip_match);
}
diff --git a/extensions/ebt_limit.c b/extensions/ebt_limit.c
index 490686d..1c5c32b 100644
--- a/extensions/ebt_limit.c
+++ b/extensions/ebt_limit.c
@@ -122,18 +122,18 @@ static int parse(int c, char **argv, int argc,
case ARG_LIMIT:
ebt_check_option(flags, FLAG_LIMIT);
if (ebt_check_inverse(optarg))
- print_error("Unexpected `!' after --limit");
+ ebt_print_error("Unexpected `!' after --limit");
if (!parse_rate(optarg, &r->avg))
- print_error("bad rate `%s'", optarg);
+ ebt_print_error("bad rate `%s'", optarg);
break;
case ARG_LIMIT_BURST:
ebt_check_option(flags, FLAG_LIMIT_BURST);
if (ebt_check_inverse(optarg))
- print_error("Unexpected `!' after --limit-burst");
+ ebt_print_error("Unexpected `!' after --limit-burst");
if (string_to_number(optarg, 0, 10000, &num) == -1)
- print_error("bad --limit-burst `%s'", optarg);
+ ebt_print_error("bad --limit-burst `%s'", optarg);
r->burst = num;
break;
@@ -214,8 +214,7 @@ static struct ebt_u_match limit_match =
.extra_ops opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&limit_match);
}
diff --git a/extensions/ebt_log.c b/extensions/ebt_log.c
index 953211e..f455f9f 100644
--- a/extensions/ebt_log.c
+++ b/extensions/ebt_log.c
@@ -105,7 +105,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
case LOG_PREFIX:
ebt_check_option(flags, OPT_PREFIX);
if (strlen(optarg) > sizeof(loginfo->prefix) - 1)
- print_error("Prefix too long");
+ ebt_print_error("Prefix too long");
strcpy(loginfo->prefix, optarg);
break;
@@ -117,7 +117,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
else
loginfo->loglevel = i;
if (loginfo->loglevel == 9)
- print_error("Problem with the log-level");
+ ebt_print_error("Problem with the log-level");
break;
case LOG_IP:
@@ -187,8 +187,7 @@ static struct ebt_u_watcher log_watcher =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_watcher(&log_watcher);
}
diff --git a/extensions/ebt_mark.c b/extensions/ebt_mark.c
index c40b9fd..bf23a03 100644
--- a/extensions/ebt_mark.c
+++ b/extensions/ebt_mark.c
@@ -48,13 +48,13 @@ static int parse(int c, char **argv, int argc,
case MARK_TARGET:
ebt_check_option(flags, OPT_MARK_TARGET);
if (FILL_TARGET(optarg, markinfo->target))
- print_error("Illegal --mark-target target");
+ ebt_print_error("Illegal --mark-target target");
break;
case MARK_SETMARK:
ebt_check_option(flags, OPT_MARK_SETMARK);
markinfo->mark = strtoul(optarg, &end, 0);
if (*end != '\0' || end == optarg)
- print_error("Bad MARK value '%s'", optarg);
+ ebt_print_error("Bad MARK value '%s'", optarg);
mark_supplied = 1;
break;
default:
@@ -71,9 +71,10 @@ static void final_check(const struct ebt_u_entry *entry,
(struct ebt_mark_t_info *)target->data;
if (time == 0 && mark_supplied == 0)
- print_error("No mark value supplied");
+ ebt_print_error("No mark value supplied");
if (BASE_CHAIN && markinfo->target == EBT_RETURN)
- print_error("--mark-target RETURN not allowed on base chain");
+ ebt_print_error("--mark-target RETURN not allowed on base "
+ "chain");
}
static void print(const struct ebt_u_entry *entry,
@@ -113,8 +114,7 @@ static struct ebt_u_target mark_target =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&mark_target);
}
diff --git a/extensions/ebt_mark_m.c b/extensions/ebt_mark_m.c
index 1c18d9e..2cc371a 100644
--- a/extensions/ebt_mark_m.c
+++ b/extensions/ebt_mark_m.c
@@ -44,7 +44,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
if (ebt_check_inverse(optarg))
markinfo->invert = 1;
if (optind > argc)
- print_error("No mark specified");
+ ebt_print_error("No mark specified");
markinfo->mark = strtoul(argv[optind - 1], &end, 0);
markinfo->bitmask = EBT_MARK_AND;
if (*end == '/') {
@@ -54,7 +54,8 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
} else
markinfo->mask = 0xffffffff;
if ( *end != '\0' || end == argv[optind - 1])
- print_error("Bad mark value '%s'", argv[optind - 1]);
+ ebt_print_error("Bad mark value '%s'",
+ argv[optind - 1]);
break;
default:
return 0;
@@ -115,8 +116,7 @@ static struct ebt_u_match mark_match =
.extra_ops = opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&mark_match);
}
diff --git a/extensions/ebt_nat.c b/extensions/ebt_nat.c
index 16e1842..f2e79ca 100644
--- a/extensions/ebt_nat.c
+++ b/extensions/ebt_nat.c
@@ -76,13 +76,14 @@ static int parse_s(int c, char **argv, int argc,
ebt_check_option(flags, OPT_SNAT);
to_source_supplied = 1;
if (!(addr = ether_aton(optarg)))
- print_error("Problem with specified --to-source mac");
+ ebt_print_error("Problem with specified --to-source "
+ "mac");
memcpy(natinfo->mac, addr, ETH_ALEN);
break;
case NAT_S_TARGET:
ebt_check_option(flags, OPT_SNAT_TARGET);
if (FILL_TARGET(optarg, natinfo->target))
- print_error("Illegal --snat-target target");
+ ebt_print_error("Illegal --snat-target target");
break;
default:
return 0;
@@ -104,14 +105,14 @@ static int parse_d(int c, char **argv, int argc,
ebt_check_option(flags, OPT_DNAT);
to_dest_supplied = 1;
if (!(addr = ether_aton(optarg)))
- print_error("Problem with specified "
- "--to-destination mac");
+ ebt_print_error("Problem with specified "
+ "--to-destination mac");
memcpy(natinfo->mac, addr, ETH_ALEN);
break;
case NAT_D_TARGET:
ebt_check_option(flags, OPT_DNAT_TARGET);
if (FILL_TARGET(optarg, natinfo->target))
- print_error("Illegal --dnat-target target");
+ ebt_print_error("Illegal --dnat-target target");
break;
default:
return 0;
@@ -126,12 +127,13 @@ static void final_check_s(const struct ebt_u_entry *entry,
struct ebt_nat_info *natinfo = (struct ebt_nat_info *)target->data;
if (BASE_CHAIN && natinfo->target == EBT_RETURN)
- print_error("--snat-target RETURN not allowed on base chain");
+ ebt_print_error("--snat-target RETURN not allowed on base "
+ "chain");
CLEAR_BASE_CHAIN_BIT;
if ((hookmask & ~(1 << NF_BR_POST_ROUTING)) || strcmp(name, "nat"))
- print_error("Wrong chain for snat");
+ ebt_print_error("Wrong chain for snat");
if (time == 0 && to_source_supplied == 0)
- print_error("No snat address supplied");
+ ebt_print_error("No snat address supplied");
}
static void final_check_d(const struct ebt_u_entry *entry,
@@ -141,14 +143,15 @@ static void final_check_d(const struct ebt_u_entry *entry,
struct ebt_nat_info *natinfo = (struct ebt_nat_info *)target->data;
if (BASE_CHAIN && natinfo->target == EBT_RETURN)
- print_error("--dnat-target RETURN not allowed on base chain");
+ ebt_print_error("--dnat-target RETURN not allowed on base "
+ "chain");
CLEAR_BASE_CHAIN_BIT;
if (((hookmask & ~((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT)))
|| strcmp(name, "nat")) &&
((hookmask & ~(1 << NF_BR_BROUTING)) || strcmp(name, "broute")))
- print_error("Wrong chain for dnat");
+ ebt_print_error("Wrong chain for dnat");
if (time == 0 && to_dest_supplied == 0)
- print_error("No dnat address supplied");
+ ebt_print_error("No dnat address supplied");
}
static void print_s(const struct ebt_u_entry *entry,
@@ -207,8 +210,7 @@ static struct ebt_u_target dnat_target =
.extra_ops = opts_d,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&snat_target);
ebt_register_target(&dnat_target);
diff --git a/extensions/ebt_pkttype.c b/extensions/ebt_pkttype.c
index 35bac29..f7893bb 100644
--- a/extensions/ebt_pkttype.c
+++ b/extensions/ebt_pkttype.c
@@ -61,7 +61,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
if (ebt_check_inverse(optarg))
ptinfo->invert = 1;
if (optind > argc)
- print_error("Missing pkttype class specification");
+ ebt_print_error("Missing pkttype class specification");
i = strtol(argv[optind - 1], &end, 16);
if (*end != '\0') {
@@ -74,7 +74,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
}
}
if (i < 0 || i > 255)
- print_error("Problem with specified pkttype class");
+ ebt_print_error("Problem with specified pkttype class");
ptinfo->pkt_type = (uint8_t)i;
break;
@@ -129,8 +129,7 @@ static struct ebt_u_match pkttype_match =
.extra_ops = opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&pkttype_match);
}
diff --git a/extensions/ebt_redirect.c b/extensions/ebt_redirect.c
index 82feaa9..ba7f6b1 100644
--- a/extensions/ebt_redirect.c
+++ b/extensions/ebt_redirect.c
@@ -40,7 +40,7 @@ static int parse(int c, char **argv, int argc,
case REDIRECT_TARGET:
ebt_check_option(flags, OPT_REDIRECT_TARGET);
if (FILL_TARGET(optarg, redirectinfo->target))
- print_error("Illegal --redirect-target target");
+ ebt_print_error("Illegal --redirect-target target");
break;
default:
return 0;
@@ -56,12 +56,12 @@ static void final_check(const struct ebt_u_entry *entry,
(struct ebt_redirect_info *)target->data;
if (BASE_CHAIN && redirectinfo->target == EBT_RETURN)
- print_error("--redirect-target RETURN not allowed on "
- "base chain");
+ ebt_print_error("--redirect-target RETURN not allowed on "
+ "base chain");
CLEAR_BASE_CHAIN_BIT;
if ( ((hookmask & ~(1 << NF_BR_PRE_ROUTING)) || strcmp(name, "nat")) &&
((hookmask & ~(1 << NF_BR_BROUTING)) || strcmp(name, "broute")) )
- print_error("Wrong chain for redirect");
+ ebt_print_error("Wrong chain for redirect");
}
static void print(const struct ebt_u_entry *entry,
@@ -99,8 +99,7 @@ static struct ebt_u_target redirect_target =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&redirect_target);
}
diff --git a/extensions/ebt_standard.c b/extensions/ebt_standard.c
index 7ee454b..4ac3dc0 100644
--- a/extensions/ebt_standard.c
+++ b/extensions/ebt_standard.c
@@ -53,7 +53,7 @@ static void print(const struct ebt_u_entry *entry,
else if (verdict == EBT_RETURN)
printf("RETURN ");
else
- print_bug("Bad standard target");
+ ebt_print_bug("Bad standard target");
}
static int compare(const struct ebt_entry_target *t1,
@@ -77,8 +77,7 @@ static struct ebt_u_target standard =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&standard);
}
diff --git a/extensions/ebt_stp.c b/extensions/ebt_stp.c
index 60f2cc8..b458c40 100644
--- a/extensions/ebt_stp.c
+++ b/extensions/ebt_stp.c
@@ -135,7 +135,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
if (ebt_check_inverse(optarg))
stpinfo->invflags |= flag;
if (optind > argc)
- print_error("Missing argument for --%s", opts[c-'a'].name);
+ ebt_print_error("Missing argument for --%s", opts[c-'a'].name);
stpinfo->bitmask |= flag;
switch (flag) {
case EBT_STP_TYPE:
@@ -148,7 +148,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
BPDU_TYPE_TCN_STRING))
stpinfo->type = BPDU_TYPE_TCN;
else
- print_error("Bad STP type argument");
+ ebt_print_error("Bad STP type argument");
} else
stpinfo->type = i;
break;
@@ -162,62 +162,63 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
FLAG_TC_ACK_STRING))
stpinfo->config.flags = FLAG_TC_ACK;
else
- print_error("Bad STP config flags argument");
+ ebt_print_error("Bad STP config flags "
+ "argument");
} else
stpinfo->config.flags = i;
break;
case EBT_STP_ROOTPRIO:
if (parse_range(argv[optind-1], &(stpinfo->config.root_priol),
&(stpinfo->config.root_priou), 2))
- print_error("Bad STP config root priority range");
+ ebt_print_error("Bad STP config root priority range");
break;
case EBT_STP_ROOTCOST:
if (parse_range(argv[optind-1], &(stpinfo->config.root_costl),
&(stpinfo->config.root_costu), 4))
- print_error("Bad STP config root cost range");
+ ebt_print_error("Bad STP config root cost range");
break;
case EBT_STP_SENDERPRIO:
if (parse_range(argv[optind-1], &(stpinfo->config.sender_priol),
&(stpinfo->config.sender_priou), 2))
- print_error("Bad STP config sender priority range");
+ ebt_print_error("Bad STP config sender priority range");
break;
case EBT_STP_PORT:
if (parse_range(argv[optind-1], &(stpinfo->config.portl),
&(stpinfo->config.portu), 2))
- print_error("Bad STP config port range");
+ ebt_print_error("Bad STP config port range");
break;
case EBT_STP_MSGAGE:
if (parse_range(argv[optind-1], &(stpinfo->config.msg_agel),
&(stpinfo->config.msg_ageu), 2))
- print_error("Bad STP config message age range");
+ ebt_print_error("Bad STP config message age range");
break;
case EBT_STP_MAXAGE:
if (parse_range(argv[optind-1], &(stpinfo->config.max_agel),
&(stpinfo->config.max_ageu), 2))
- print_error("Bad STP config maximum age range");
+ ebt_print_error("Bad STP config maximum age range");
break;
case EBT_STP_HELLOTIME:
if (parse_range(argv[optind-1], &(stpinfo->config.hello_timel),
&(stpinfo->config.hello_timeu), 2))
- print_error("Bad STP config hello time range");
+ ebt_print_error("Bad STP config hello time range");
break;
case EBT_STP_FWDD:
if (parse_range(argv[optind-1], &(stpinfo->config.forward_delayl),
&(stpinfo->config.forward_delayu), 2))
- print_error("Bad STP config forward delay range");
+ ebt_print_error("Bad STP config forward delay range");
break;
case EBT_STP_ROOTADDR:
if (ebt_get_mac_and_mask(argv[optind-1],
stpinfo->config.root_addr, stpinfo->config.root_addrmsk))
- print_error("Bad STP config root address");
+ ebt_print_error("Bad STP config root address");
break;
case EBT_STP_SENDERADDR:
if (ebt_get_mac_and_mask(argv[optind-1], stpinfo->config.sender_addr,
stpinfo->config.sender_addrmsk))
- print_error("Bad STP config sender address");
+ ebt_print_error("Bad STP config sender address");
break;
default:
- print_error("stp match: this shouldn't happen");
+ ebt_print_error("stp match: this shouldn't happen");
}
return 1;
}
@@ -231,9 +232,9 @@ static void final_check(const struct ebt_u_entry *entry,
if (memcmp(entry->destmac, bridge_ula, 6) ||
memcmp(entry->destmsk, msk, 6))
- print_error("STP matching is only valid when the destination"
- " MAC address is the bridge group address (BGA)"
- " 01:80:c2:00:00:00");
+ ebt_print_error("STP matching is only valid when the "
+ "destination MAC address is the bridge group "
+ "address (BGA) 01:80:c2:00:00:00");
}
static void print(const struct ebt_u_entry *entry,
@@ -305,8 +306,7 @@ static struct ebt_u_match stp_match =
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&stp_match);
}
diff --git a/extensions/ebt_vlan.c b/extensions/ebt_vlan.c
index 5a8a912..b4e1d38 100644
--- a/extensions/ebt_vlan.c
+++ b/extensions/ebt_vlan.c
@@ -44,9 +44,9 @@
#define GET_BITMASK(_MASK_) vlaninfo->bitmask & _MASK_
#define SET_BITMASK(_MASK_) vlaninfo->bitmask |= _MASK_
#define INV_FLAG(_inv_flag_) (vlaninfo->invflags & _inv_flag_) ? "! " : ""
-#define CHECK_IF_MISSING_VALUE if (optind > argc) print_error ("Missing %s value", opts[c].name);
+#define CHECK_IF_MISSING_VALUE if (optind > argc) ebt_print_error ("Missing %s value", opts[c].name);
#define CHECK_INV_FLAG(_INDEX_) if (ebt_check_inverse (optarg)) vlaninfo->invflags |= _INDEX_;
-#define CHECK_RANGE(_RANGE_) if (_RANGE_) print_error ("Invalid %s range", opts[c].name);
+#define CHECK_RANGE(_RANGE_) if (_RANGE_) ebt_print_error ("Invalid %s range", opts[c].name);
#define NAME_VLAN_ID "id"
#define NAME_VLAN_PRIO "prio"
@@ -168,8 +168,8 @@ parse(int c,
if (*end != '\0') {
ethent = getethertypebyname(argv[optind - 1]);
if (ethent == NULL)
- print_error("Unknown %s encap",
- opts[c].name);
+ ebt_print_error("Unknown %s encap",
+ opts[c].name);
local.encap = ethent->e_ethertype;
}
CHECK_RANGE(local.encap < ETH_ZLEN);
@@ -199,16 +199,16 @@ final_check(const struct ebt_u_entry *entry,
* Specified proto isn't 802.1Q?
*/
if (entry->ethproto != ETH_P_8021Q || entry->invflags & EBT_IPROTO)
- print_error
- ("For use 802.1Q extension the protocol must be specified as 802_1Q");
+ ebt_print_error("For use 802.1Q extension the protocol "
+ "must be specified as 802_1Q");
/*
* Check if specified vlan-encap=0x8100 (802.1Q Frame)
* when vlan-encap specified.
*/
if (GET_BITMASK(EBT_VLAN_ENCAP)) {
if (vlaninfo->encap == htons(0x8100))
- print_error
- ("Encapsulated frame type can not be 802.1Q (0x8100)");
+ ebt_print_error("Encapsulated frame type can not be "
+ "802.1Q (0x8100)");
}
/*
@@ -217,8 +217,8 @@ final_check(const struct ebt_u_entry *entry,
*/
if (GET_BITMASK(EBT_VLAN_PRIO)) {
if (vlaninfo->id && GET_BITMASK(EBT_VLAN_ID))
- print_error
- ("For use user_priority the specified vlan-id must be 0");
+ ebt_print_error("For use user_priority the specified "
+ "vlan-id must be 0");
}
}
@@ -318,8 +318,7 @@ static struct ebt_u_match vlan_match = {
.extra_ops = opts,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_match(&vlan_match);
}
diff --git a/extensions/ebtable_broute.c b/extensions/ebtable_broute.c
index 362183a..3c00962 100644
--- a/extensions/ebtable_broute.c
+++ b/extensions/ebtable_broute.c
@@ -15,8 +15,7 @@ ebt_u_table table =
.help = print_help,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_table(&table);
}
diff --git a/extensions/ebtable_filter.c b/extensions/ebtable_filter.c
index 904a857..08f5033 100644
--- a/extensions/ebtable_filter.c
+++ b/extensions/ebtable_filter.c
@@ -21,8 +21,7 @@ static struct ebt_u_table table =
.help = print_help,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_table(&table);
}
diff --git a/extensions/ebtable_nat.c b/extensions/ebtable_nat.c
index b151dc5..d64e21d 100644
--- a/extensions/ebtable_nat.c
+++ b/extensions/ebtable_nat.c
@@ -22,8 +22,7 @@ ebt_u_table table =
.help = print_help,
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_table(&table);
}