1
1

Initial dump from Zyxel

This commit is contained in:
2026-04-17 17:00:52 +02:00
commit 81fec250f4
23116 changed files with 5231237 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
Index: ebtables-v2.0.10-4/Makefile
===================================================================
--- ebtables-v2.0.10-4.orig/Makefile 2011-12-16 04:02:47.000000000 +0800
+++ ebtables-v2.0.10-4/Makefile 2014-01-21 22:28:33.948678303 +0800
@@ -21,6 +21,8 @@
CFLAGS_SH_LIB:=-fPIC -O3
CC:=gcc
+export EXT_FUNC=$(EBT_EXT_FUNC)
+
ifeq ($(shell uname -m),sparc64)
CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
endif
Index: ebtables-v2.0.10-4/extensions/Makefile
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/Makefile 2014-01-21 22:26:19.136679135 +0800
+++ ebtables-v2.0.10-4/extensions/Makefile 2014-01-21 22:29:07.956678093 +0800
@@ -4,7 +4,7 @@
#EXT_FUNC+=802_3 nat arp arpreply ip ip6 standard log redirect vlan mark_m mark \
# pkttype stp among limit ulog nflog
# ZyXEL QoS, John (porting from MSTC)
-EXT_FUNC+=ip ip6 standard vlan mark_m mark time ftos skiplog AUTOMAP policer
+#EXT_FUNC+=ip ip6 standard vlan mark_m mark time ftos skiplog AUTOMAP policer
ifeq ($(strip $(WIRELESS)),1)
EXT_FUNC+=wmm_mark
endif
@@ -0,0 +1,15 @@
Index: ebtables-v2.0.10-4/extensions/ebt_policer.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_policer.c 2015-02-12 10:45:53.312971735 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_policer.c 2015-02-12 10:48:38.167870346 +0800
@@ -500,8 +500,8 @@
.extra_ops = opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+//static void _init(void) __attribute((constructor));
+void _init(void)
{
ebt_register_match(&policer_match);
}
@@ -0,0 +1,14 @@
Index: ebtables-v2.0.10-4/extensions/ebt_AUTOMAP.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_AUTOMAP.c 2015-02-13 15:15:43.740214867 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_AUTOMAP.c 2015-02-13 15:17:06.143378837 +0800
@@ -130,8 +130,7 @@
opts
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&automap_target);
}
@@ -0,0 +1,16 @@
Index: ebtables-v2.0.10-4/extensions/ebt_ftos.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_ftos.c 2016-09-14 14:32:13.425998274 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_ftos.c 2016-09-14 17:19:31.081983603 +0800
@@ -71,7 +71,11 @@
switch (c) {
case FTOS_TRGT:
+#if 1 /* porting from MSTC */
+ ebt_check_option2(flags, OPT_FTOS_TARGET);
+#else
ebt_check_option2(flags, FTOS_TRGT);
+#endif
if (FILL_TARGET(optarg, ftosinfo->target))
ebt_print_error("Illegal --ftos-target target");
break;
@@ -0,0 +1,23 @@
Index: ebtables-v2.0.10-4/extensions/ebt_ip.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_ip.c 2018-11-07 20:50:33.098545956 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_ip.c 2018-11-07 21:04:04.905423654 +0800
@@ -342,7 +342,8 @@
static void
parse_dhcp_opt125(struct cfgopt *cfg125, char *EnterpriseNum, char *VendorClassData, char *NextArg)
{
- int i=0, data_len=0;
+ int i=0;
+ size_t data_len=0;
char cfg[255],data[8];
if(NextArg!=NULL && *NextArg != '-')
@@ -361,7 +362,7 @@
memset(cfg, 0, sizeof(cfg));
memset(data, 0, sizeof(data));
- sprintf(cfg, "%s%02x%s", EnterpriseNum, strlen(VendorClassData)/2,VendorClassData);
+ sprintf(cfg, "%s%02zx%s", EnterpriseNum, strlen(VendorClassData)/2,VendorClassData);
data_len = strlen(cfg)/2; /* Length is enterprise number + data length + vendor class data */
@@ -0,0 +1,348 @@
Index: ebtables-v2.0.10-4/extensions/ebt_zextmark_m.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ebtables-v2.0.10-4/extensions/ebt_zextmark_m.c 2017-01-18 17:07:54.954449059 +0800
@@ -0,0 +1,127 @@
+/* ebt_zextmark_m
+ *
+ * Authors:
+ * Bart De Schuymer <bdschuym@pandora.be>
+ *
+ * July, 2002
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include "../include/ebtables_u.h"
+#include <linux/netfilter_bridge/ebt_mark_m.h>
+
+#define MARK '1'
+
+static struct option opts[] =
+{
+ { "zextmark", required_argument, 0, MARK },
+ { 0 }
+};
+
+static void print_help()
+{
+ printf(
+"zextmark option:\n"
+"--zextmark [!] [value][/mask]: Match nfmask value (see man page)\n");
+}
+
+static void init(struct ebt_entry_match *match)
+{
+ struct ebt_mark_m_info *markinfo = (struct ebt_mark_m_info *)match->data;
+
+ markinfo->mark = 0;
+ markinfo->mask = 0;
+ markinfo->invert = 0;
+ markinfo->bitmask = 0;
+}
+
+#define OPT_MARK 0x01
+static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
+ unsigned int *flags, struct ebt_entry_match **match)
+{
+ struct ebt_mark_m_info *markinfo = (struct ebt_mark_m_info *)
+ (*match)->data;
+ char *end;
+
+ switch (c) {
+ case MARK:
+ ebt_check_option2(flags, MARK);
+ if (ebt_check_inverse2(optarg))
+ markinfo->invert = 1;
+ markinfo->mark = strtoul(optarg, &end, 0);
+ markinfo->bitmask = EBT_MARK_AND;
+ if (*end == '/') {
+ if (end == optarg)
+ markinfo->bitmask = EBT_MARK_OR;
+ markinfo->mask = strtoul(end+1, &end, 0);
+ } else
+ markinfo->mask = 0xffffffff;
+ if ( *end != '\0' || end == optarg)
+ ebt_print_error2("Bad zextmark value '%s'", optarg);
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static void final_check(const struct ebt_u_entry *entry,
+ const struct ebt_entry_match *match, const char *name,
+ unsigned int hookmask, unsigned int time)
+{
+}
+
+static void print(const struct ebt_u_entry *entry,
+ const struct ebt_entry_match *match)
+{
+ struct ebt_mark_m_info *markinfo =
+ (struct ebt_mark_m_info *)match->data;
+
+ printf("--zextmark ");
+ if (markinfo->invert)
+ printf("! ");
+ if (markinfo->bitmask == EBT_MARK_OR)
+ printf("/0x%lx ", markinfo->mask);
+ else if(markinfo->mask != 0xffffffff)
+ printf("0x%lx/0x%lx ", markinfo->mark, markinfo->mask);
+ else
+ printf("0x%lx ", markinfo->mark);
+}
+
+static int compare(const struct ebt_entry_match *m1,
+ const struct ebt_entry_match *m2)
+{
+ struct ebt_mark_m_info *markinfo1 = (struct ebt_mark_m_info *)m1->data;
+ struct ebt_mark_m_info *markinfo2 = (struct ebt_mark_m_info *)m2->data;
+
+ if (markinfo1->invert != markinfo2->invert)
+ return 0;
+ if (markinfo1->mark != markinfo2->mark)
+ return 0;
+ if (markinfo1->mask != markinfo2->mask)
+ return 0;
+ if (markinfo1->bitmask != markinfo2->bitmask)
+ return 0;
+ return 1;
+}
+
+static struct ebt_u_match mark_match =
+{
+ .name = "zextmark_m",
+ .size = sizeof(struct ebt_mark_m_info),
+ .help = print_help,
+ .init = init,
+ .parse = parse,
+ .final_check = final_check,
+ .print = print,
+ .compare = compare,
+ .extra_ops = opts,
+};
+
+void _init(void)
+{
+ ebt_register_match(&mark_match);
+}
Index: ebtables-v2.0.10-4/extensions/ebt_zextmark.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ebtables-v2.0.10-4/extensions/ebt_zextmark.c 2017-01-18 16:43:13.573299819 +0800
@@ -0,0 +1,189 @@
+/* ebt_mark
+ *
+ * Authors:
+ * Bart De Schuymer <bdschuym@pandora.be>
+ *
+ * July, 2002, September 2006
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include "../include/ebtables_u.h"
+#include "../include/linux/netfilter_bridge/ebt_mark_t.h"
+
+static int mark_supplied;
+
+#define MARK_TARGET '1'
+#define MARK_SETMARK '2'
+#define MARK_ORMARK '3'
+#define MARK_ANDMARK '4'
+#define MARK_XORMARK '5'
+#define MARK_SETVTAG '6'
+
+static struct option opts[] =
+{
+ { "zextmark-target" , required_argument, 0, MARK_TARGET },
+ /* an oldtime messup, we should have always used the scheme
+ * <extension-name>-<option> */
+ { "set-zextmark" , required_argument, 0, MARK_SETMARK },
+ { "zextmark-set" , required_argument, 0, MARK_SETMARK },
+ { "zextmark-or" , required_argument, 0, MARK_ORMARK },
+ { "zextmark-and" , required_argument, 0, MARK_ANDMARK },
+ { "zextmark-xor" , required_argument, 0, MARK_XORMARK },
+ { "vtag-zextset" , required_argument, 0, MARK_SETVTAG },
+ { 0 }
+};
+
+static void print_help()
+{
+ printf(
+ "zextmark target options:\n"
+ " --zextmark-set value : Set nfmark value\n"
+ " --zextmark-or value : Or nfmark with value (nfmark |= value)\n"
+ " --zextmark-and value : And nfmark with value (nfmark &= value)\n"
+ " --zextmark-xor value : Xor nfmark with value (nfmark ^= value)\n"
+ " --vtag-zextset value : Set vlan tag value\n"
+ " --zextmark-target target : ACCEPT, DROP, RETURN or CONTINUE\n");
+}
+
+static void init(struct ebt_entry_target *target)
+{
+ struct ebt_mark_t_info *markinfo =
+ (struct ebt_mark_t_info *)target->data;
+
+ markinfo->target = EBT_ACCEPT;
+ markinfo->mark = 0;
+ mark_supplied = 0;
+}
+
+#define OPT_MARK_TARGET 0x01
+#define OPT_MARK_SETMARK 0x02
+#define OPT_MARK_ORMARK 0x04
+#define OPT_MARK_ANDMARK 0x08
+#define OPT_MARK_XORMARK 0x10
+#define OPT_MARK_SETVTAG 0x20
+static int parse(int c, char **argv, int argc,
+ const struct ebt_u_entry *entry, unsigned int *flags,
+ struct ebt_entry_target **target)
+{
+ struct ebt_mark_t_info *markinfo =
+ (struct ebt_mark_t_info *)(*target)->data;
+ char *end;
+
+ switch (c) {
+ case MARK_TARGET:
+ { int tmp;
+ ebt_check_option2(flags, OPT_MARK_TARGET);
+ if (FILL_TARGET(optarg, tmp))
+ ebt_print_error2("Illegal --zextmark-target target");
+ /* the 4 lsb are left to designate the target */
+ markinfo->target = (markinfo->target & ~EBT_VERDICT_BITS) | (tmp & EBT_VERDICT_BITS);
+ }
+ return 1;
+ case MARK_SETMARK:
+ ebt_check_option2(flags, OPT_MARK_SETMARK);
+ if (*flags & (OPT_MARK_ORMARK|OPT_MARK_ANDMARK|OPT_MARK_XORMARK))
+ ebt_print_error2("--zextmark-set cannot be used together with specific --zextmark option");
+ break;
+ case MARK_ORMARK:
+ ebt_check_option2(flags, OPT_MARK_ORMARK);
+ if (*flags & (OPT_MARK_SETMARK|OPT_MARK_ANDMARK|OPT_MARK_XORMARK))
+ ebt_print_error2("--zextmark-or cannot be used together with specific --zextmark option");
+ markinfo->target = (markinfo->target & EBT_VERDICT_BITS) | MARK_OR_VALUE;
+ break;
+ case MARK_ANDMARK:
+ ebt_check_option2(flags, OPT_MARK_ANDMARK);
+ if (*flags & (OPT_MARK_SETMARK|OPT_MARK_ORMARK|OPT_MARK_XORMARK))
+ ebt_print_error2("--zextmark-and cannot be used together with specific --zextmark option");
+ markinfo->target = (markinfo->target & EBT_VERDICT_BITS) | MARK_AND_VALUE;
+ break;
+ case MARK_XORMARK:
+ ebt_check_option2(flags, OPT_MARK_XORMARK);
+ if (*flags & (OPT_MARK_SETMARK|OPT_MARK_ANDMARK|OPT_MARK_ORMARK))
+ ebt_print_error2("--zextmark-xor cannot be used together with specific --zextmark option");
+ markinfo->target = (markinfo->target & EBT_VERDICT_BITS) | MARK_XOR_VALUE;
+ break;
+ case MARK_SETVTAG:
+ ebt_check_option2(flags, OPT_MARK_SETVTAG);
+ markinfo->target = (markinfo->target & EBT_VERDICT_BITS) | VTAG_SET_VALUE;
+ break;
+ default:
+ return 0;
+ }
+ /* mutual code */
+ markinfo->mark = strtoul(optarg, &end, 0);
+ if (*end != '\0' || end == optarg)
+ ebt_print_error2("Bad MARK value '%s'", optarg);
+ mark_supplied = 1;
+ return 1;
+}
+
+static void final_check(const struct ebt_u_entry *entry,
+ const struct ebt_entry_target *target, const char *name,
+ unsigned int hookmask, unsigned int time)
+{
+ struct ebt_mark_t_info *markinfo =
+ (struct ebt_mark_t_info *)target->data;
+
+ if (time == 0 && mark_supplied == 0) {
+ ebt_print_error("No mark value supplied");
+ } else if (BASE_CHAIN && (markinfo->target|~EBT_VERDICT_BITS) == EBT_RETURN)
+ ebt_print_error("--zextmark-target RETURN not allowed on base chain");
+}
+
+static void print(const struct ebt_u_entry *entry,
+ const struct ebt_entry_target *target)
+{
+ struct ebt_mark_t_info *markinfo =
+ (struct ebt_mark_t_info *)target->data;
+ int tmp;
+
+ tmp = markinfo->target & ~EBT_VERDICT_BITS;
+ if (tmp == MARK_SET_VALUE)
+ printf("--zextmark-set");
+ else if (tmp == MARK_OR_VALUE)
+ printf("--zextmark-or");
+ else if (tmp == MARK_XOR_VALUE)
+ printf("--zextmark-xor");
+ else if (tmp == MARK_AND_VALUE)
+ printf("--zextmark-and");
+ else if (tmp == VTAG_SET_VALUE)
+ printf("--vtag-zextset");
+ else
+ ebt_print_error("oops, unknown zextmark action, try a later version of ebtables");
+ printf(" 0x%lx", markinfo->mark);
+ tmp = markinfo->target | ~EBT_VERDICT_BITS;
+ printf(" --zextmark-target %s", TARGET_NAME(tmp));
+}
+
+static int compare(const struct ebt_entry_target *t1,
+ const struct ebt_entry_target *t2)
+{
+ struct ebt_mark_t_info *markinfo1 =
+ (struct ebt_mark_t_info *)t1->data;
+ struct ebt_mark_t_info *markinfo2 =
+ (struct ebt_mark_t_info *)t2->data;
+
+ return markinfo1->target == markinfo2->target &&
+ markinfo1->mark == markinfo2->mark;
+}
+
+static struct ebt_u_target mark_target =
+{
+ .name = "zextmark",
+ .size = sizeof(struct ebt_mark_t_info),
+ .help = print_help,
+ .init = init,
+ .parse = parse,
+ .final_check = final_check,
+ .print = print,
+ .compare = compare,
+ .extra_ops = opts,
+};
+
+void _init(void)
+{
+ ebt_register_target(&mark_target);
+}
Index: ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_mark_m.h
===================================================================
--- ebtables-v2.0.10-4.orig/include/linux/netfilter_bridge/ebt_mark_m.h 2011-12-16 04:02:48.000000000 +0800
+++ ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_mark_m.h 2017-02-02 16:18:51.172516254 +0800
@@ -12,5 +12,6 @@
__u8 bitmask;
};
#define EBT_MARK_MATCH "mark_m"
+#define EBT_ZEXTMARK_MATCH "zextmark_m"
#endif
Index: ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_mark_t.h
===================================================================
--- ebtables-v2.0.10-4.orig/include/linux/netfilter_bridge/ebt_mark_t.h 2017-02-01 16:51:51.344638430 +0800
+++ ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_mark_t.h 2017-02-02 16:19:11.272222497 +0800
@@ -20,5 +20,6 @@
int target;
};
#define EBT_MARK_TARGET "mark"
+#define EBT_ZEXTMARK_TARGET "zextmark"
#endif
@@ -0,0 +1,149 @@
Index: ebtables-v2.0.10-4/extensions/ebt_nfqueue.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ebtables-v2.0.10-4/extensions/ebt_nfqueue.c 2019-05-29 14:02:33.516505696 +0800
@@ -0,0 +1,130 @@
+/*
+ * Shared library add-on to ebtables for NFQ
+ *
+ * (C) 2012 by Ma Jie Yue <jieyue.majy@xxxxxxxxxxxxxx>
+ *
+ * This program is distributed under the terms of GNU GPLv2, 1991
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <errno.h>
+
+#include "../include/ebtables_u.h"
+#include <linux/netfilter/x_tables.h>
+
+#define NFQUEUE_QUEUENUM 0x1
+#define NFQUEUE_QUEUEBALANCE 0x2
+
+struct xt_NFQ_info {
+ __u16 queuenum;
+ int target;
+};
+
+static int string_to_number(const char *s, unsigned int min, unsigned int max, unsigned int *ret)
+{
+ long number;
+ char *end;
+ errno = 0;
+ number = strtol(s, &end, 0);
+
+ if (*end == '\0' && end != s) {
+ if (errno != ERANGE && min <= number && number <= max) {
+ *ret = number;
+ return 0;
+ }
+ }
+ return -1;
+}
+
+static void nfqueue_help(void)
+{
+ printf("NFQUEUE target options\n"
+ " --queue-num value Send packet to QUEUE number <value>.\n"
+ " Valid queue numbers are 0-65535\n");
+}
+
+static void nfqueue_init(struct ebt_entry_target* target) {
+ struct xt_NFQ_info* info = (struct xt_NFQ_info *)target->data;
+
+ info->queuenum = 0;
+}
+
+static const struct option nfqueue_opts[] = {
+ { "queue-num", 1, NULL, 'F' },
+ { "queue-balance", 1, NULL, 'B' },
+ { .name = NULL }
+};
+
+static void parse_num(const char *s, struct xt_NFQ_info *tinfo)
+{
+ unsigned int num = 0;
+ if (string_to_number(s, 0, 65535, &num) < 0) {
+ ebt_print_error("Invalid queue number %s\n", s);
+ }
+
+ tinfo->queuenum = num;
+}
+
+static int nfqueue_parse(int c, char **argv, int argc,
+ const struct ebt_u_entry *entry, unsigned int *flags,
+ struct ebt_entry_target **target)
+{
+ struct xt_NFQ_info *tinfo = (struct xt_NFQ_info *)(*target)->data;
+ tinfo->queuenum = 0;
+
+ switch (c) {
+ case 'F':
+ if (*flags)
+ ebt_print_error2("NFQUEUE target: "
+ "Only use --queue-num ONCE!");
+ *flags |= NFQUEUE_QUEUENUM;
+ parse_num(optarg, tinfo);
+ break;
+
+ case 'B':
+ ebt_print_error2("NFQUEUE target: "
+ "--queue-balance not supported (kernel too old?)");
+
+ default:
+ break;
+ }
+ return 1;
+}
+
+static void nfqueue_print(const struct ebt_u_entry* entry, const struct ebt_entry_target *target) {
+ struct xt_NFQ_info *tinfo = (struct xt_NFQ_info *)target->data;
+
+ printf("--queue-num %u ", tinfo->queuenum);
+}
+
+static void nfqueue_check(const struct ebt_u_entry *entry,
+ const struct ebt_entry_target *target, const char *name,
+ unsigned int hookmask, unsigned int time) {
+
+}
+
+static int nfqueue_compare(const struct ebt_entry_target *t1, const struct ebt_entry_target *t2) {
+ struct xt_NFQ_info *info1 = (struct xt_NFQ_info *)t1->data;
+ struct xt_NFQ_info *info2 = (struct xt_NFQ_info *)t2->data;
+
+ return (info1->queuenum == info2->queuenum);
+}
+
+static struct ebt_u_target nfqueue_target = {
+ .name = "nfqueue",
+ .init = nfqueue_init,
+ .size = sizeof(struct xt_NFQ_info),
+ .help = nfqueue_help,
+ .parse = nfqueue_parse,
+ .print = nfqueue_print,
+ .final_check = nfqueue_check,
+ .compare = nfqueue_compare,
+ .extra_ops = nfqueue_opts,
+};
+
+void _init(void) {
+ ebt_register_target(&nfqueue_target);
+}
Index: ebtables-v2.0.10-4/extensions/Makefile
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/Makefile 2019-05-29 14:06:16.331716737 +0800
+++ ebtables-v2.0.10-4/extensions/Makefile 2019-05-29 14:06:35.693860227 +0800
@@ -8,6 +8,9 @@
ifeq ($(strip $(WIRELESS)),1)
EXT_FUNC+=wmm_mark
endif
+ifneq ($(CONFIG_KERNEL_BRIDGE_EBT_NFQUEUE),)
+EXT_FUNC+=nfqueue
+endif
#BRCM end
EXT_TABLES+=filter nat broute
EXT_OBJS+=$(foreach T,$(EXT_FUNC), extensions/ebt_$(T).o)
@@ -0,0 +1,72 @@
Index: ebtables-v2.0.10-4/extensions/ebt_policer.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_policer.c 2019-07-25 19:15:34.079084179 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_policer.c 2019-07-26 10:20:59.428494900 +0800
@@ -9,7 +9,8 @@
#define EBT_POLICER_RATE_KBPS 10 /* Policer default rate in kbps. */
#define EBT_POLICER_BURST_KBYTE 10 /* Policer default burst in kbyte. */
-#define EBT_POLICER_MAX_INPUT_VALUE 1000000 /* Max rate value user can input in kbps or mbps. */
+#define EBT_POLICER_MAX_INPUT_VALUE 10000000 /* Max rate value user can input in kbps or mbps. */
+#define EBT_POLICER_MAX_BURST_SIZE 20000 /* Max burst size value user can input in kbytes. */
#if 1//__MSTC__, Jones For compilation
#define FLAG_MODE 0x01
@@ -62,10 +63,10 @@
"tbf mode: \n"
"--policer rate max data rate match, default %ukbps\n"
" [Bits per second followed by kbps or mbps.\n"
- " Support 1kbps to 1000000kbps or 1mbps to 1000000mbps.] \n"
+ " Support 1kbps to 10000000kbps or 1mbps to 10000mbps.] \n"
"--policer-burst size size to match in a burst, default %ukb\n"
" [Kilo-bytes followed by kb.\n"
- " Support 1kb to 1000kb.]\n"
+ " Support 1kb to 20000kb.]\n"
"srtcm mode: \n"
"The nfmark field of red packet is marked as 0x10000, \n"
"yellow packet is 0x20000 and green packet is 0x30000.\n"
@@ -235,7 +236,7 @@
}
str1 = optarg;
r->burst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
ebt_print_error("bad --policer-burst `%s'", optarg);
}
break;
@@ -271,7 +272,7 @@
}
str1 = optarg;
r->burst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
ebt_print_error("bad --cbs-burst `%s'", optarg);
}
break;
@@ -310,7 +311,7 @@
}
str1 = optarg;
r->pbsBurst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->pbsBurst > 1000 || r->pbsBurst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->pbsBurst > EBT_POLICER_MAX_BURST_SIZE || r->pbsBurst <= 0) {
ebt_print_error("bad --pbs-burst `%s'", optarg);
}
break;
@@ -329,7 +330,7 @@
}
str1 = optarg;
r->pbsBurst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->pbsBurst > 1000 || r->pbsBurst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->pbsBurst > EBT_POLICER_MAX_BURST_SIZE || r->pbsBurst <= 0) {
ebt_print_error("bad --ebs-burst `%s'", optarg);
}
break;
@@ -375,7 +376,7 @@
str1 = optarg;
r->burst = strtol(str1, &remainder, 0);
- if (strcmp(remainder, "kb") != 0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") != 0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
print_error("bad --policer-burst `%s'", optarg);
}
break;
@@ -0,0 +1,125 @@
Index: ebtables-v2.0.10-4/extensions/ebt_blog.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ebtables-v2.0.10-4/extensions/ebt_blog.c 2020-03-06 18:22:19.418723800 +0800
@@ -0,0 +1,104 @@
+/* Shared library add-on to ebtables to add blog match support */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include "../include/ebtables_u.h"
+#include "../include/linux/netfilter_bridge/ebt_blog.h"
+
+#define TCP_PUREACK 0x01
+
+static struct option opts[] =
+{
+ { "tcp-pureack" , no_argument, 0, TCP_PUREACK },
+ { 0 }
+};
+
+static void print_help()
+{
+ printf(
+"blog match options:\n"
+" --tcp-pureack match when blog TCP Pure ACK is\n"
+" detected.\n");
+}
+
+static void init(struct ebt_entry_match *match)
+{
+ struct ebt_blog_info *bloginfo =
+ (struct ebt_blog_info *)match->data;
+
+ bloginfo->tcp_pure_ack = 0;
+ bloginfo->invert = 0;
+}
+
+static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
+ unsigned int *flags, struct ebt_entry_match **match)
+{
+ struct ebt_blog_info *bloginfo = (struct ebt_blog_info *)(*match)->data;
+
+ switch (c) {
+ case TCP_PUREACK:
+ ebt_check_option2(flags, TCP_PUREACK);
+ bloginfo->tcp_pure_ack = 1;
+ if (ebt_check_inverse(optarg))
+ {
+ bloginfo->invert = 1;
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static void final_check(const struct ebt_u_entry *entry,
+ const struct ebt_entry_match *match, const char *name,
+ unsigned int hookmask, unsigned int time)
+{
+}
+
+static void print(const struct ebt_u_entry *entry,
+ const struct ebt_entry_match *match)
+{
+ const struct ebt_blog_info *bloginfo = (struct ebt_blog_info *)match->data;
+
+ printf(" blog match");
+ if (bloginfo->tcp_pure_ack)
+ {
+ printf(" TCP Pure ACK");
+ if (bloginfo->invert)
+ printf(" not");
+ printf(" set");
+ }
+ printf(" ");
+}
+
+static int compare(const struct ebt_entry_match *m1,
+ const struct ebt_entry_match *m2)
+{
+ struct ebt_blog_info *b1 = (struct ebt_blog_info *)m1->data;
+ struct ebt_blog_info *b2 = (struct ebt_blog_info *)m2->data;
+
+ if (b1->invert != b2->invert || b1->tcp_pure_ack != b2->tcp_pure_ack)
+ return 0;
+ return 1;
+}
+
+static struct ebt_u_match blog_match =
+{
+ .name = "blog",
+ .size = sizeof(struct ebt_blog_info),
+ .help = print_help,
+ .init = init,
+ .parse = parse,
+ .final_check = final_check,
+ .print = print,
+ .compare = compare,
+ .extra_ops = opts,
+};
+
+void _init(void)
+{
+ ebt_register_match(&blog_match);
+}
Index: ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_blog.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_blog.h 2020-03-06 18:22:19.418723800 +0800
@@ -0,0 +1,11 @@
+#ifndef __LINUX_BRIDGE_EBT_BLOG_H
+#define __LINUX_BRIDGE_EBT_BLOG_H
+
+#include <linux/types.h>
+
+struct ebt_blog_info {
+ __u8 tcp_pure_ack;
+ __u8 invert;
+};
+
+#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
Index: ebtables-v2.0.10-4/Makefile
===================================================================
--- ebtables-v2.0.10-4.orig/Makefile 2011-12-16 04:02:47.000000000 +0800
+++ ebtables-v2.0.10-4/Makefile 2014-01-21 22:28:33.948678303 +0800
@@ -21,6 +21,8 @@
CFLAGS_SH_LIB:=-fPIC -O3
CC:=gcc
+export EXT_FUNC=$(EBT_EXT_FUNC)
+
ifeq ($(shell uname -m),sparc64)
CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
endif
Index: ebtables-v2.0.10-4/extensions/Makefile
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/Makefile 2014-01-21 22:26:19.136679135 +0800
+++ ebtables-v2.0.10-4/extensions/Makefile 2014-01-21 22:29:07.956678093 +0800
@@ -4,7 +4,7 @@
#EXT_FUNC+=802_3 nat arp arpreply ip ip6 standard log redirect vlan mark_m mark \
# pkttype stp among limit ulog nflog
# ZyXEL QoS, John (porting from MSTC)
-EXT_FUNC+=ip ip6 standard vlan mark_m mark time ftos skiplog AUTOMAP policer
+#EXT_FUNC+=ip ip6 standard vlan mark_m mark time ftos skiplog AUTOMAP policer
ifeq ($(strip $(WIRELESS)),1)
EXT_FUNC+=wmm_mark
endif
@@ -0,0 +1,15 @@
Index: ebtables-v2.0.10-4/extensions/ebt_policer.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_policer.c 2015-02-12 10:45:53.312971735 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_policer.c 2015-02-12 10:48:38.167870346 +0800
@@ -500,8 +500,8 @@
.extra_ops = opts,
};
-static void _init(void) __attribute((constructor));
-static void _init(void)
+//static void _init(void) __attribute((constructor));
+void _init(void)
{
ebt_register_match(&policer_match);
}
@@ -0,0 +1,14 @@
Index: ebtables-v2.0.10-4/extensions/ebt_AUTOMAP.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_AUTOMAP.c 2015-02-13 15:15:43.740214867 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_AUTOMAP.c 2015-02-13 15:17:06.143378837 +0800
@@ -130,8 +130,7 @@
opts
};
-static void _init(void) __attribute__ ((constructor));
-static void _init(void)
+void _init(void)
{
ebt_register_target(&automap_target);
}
@@ -0,0 +1,55 @@
Index: ebtables-v2.0.10-4/extensions/ebt_ftos.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_ftos.c
+++ ebtables-v2.0.10-4/extensions/ebt_ftos.c
@@ -71,7 +71,11 @@ parse(int c, char **argv, int argc,
switch (c) {
case FTOS_TRGT:
+#if 1 /* porting from MSTC */
+ ebt_check_option2(flags, OPT_FTOS_TARGET);
+#else
ebt_check_option2(flags, FTOS_TRGT);
+#endif
if (FILL_TARGET(optarg, ftosinfo->target))
ebt_print_error("Illegal --ftos-target target");
break;
Index: ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_ip.h
===================================================================
--- ebtables-v2.0.10-4.orig/include/linux/netfilter_bridge/ebt_ip.h
+++ ebtables-v2.0.10-4/include/linux/netfilter_bridge/ebt_ip.h
@@ -25,24 +25,16 @@
#define EBT_IP_DPORT 0x20
#if 1 /* ZyXEL QoS, John (porting from MSTC) */
-#if defined(CONFIG_BCM_KF_NETFILTER) || !defined(CONFIG_BCM_IN_KERNEL)
#define EBT_IP_DSCP 0x40
-#endif
#define EBT_IP_LENGTH 0x80
#define EBT_IP_TCP_FLAGS 0x100
#define EBT_IP_DHCP_OPT60 0x200
#define EBT_IP_DHCP_OPT61 0x400
#define EBT_IP_DHCP_OPT77 0x800
#define EBT_IP_DHCP_OPT125 0x1000
-#if defined(CONFIG_BCM_KF_NETFILTER) || !defined(CONFIG_BCM_IN_KERNEL)
#define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\
EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_DSCP | EBT_IP_LENGTH | EBT_IP_TCP_FLAGS |\
EBT_IP_DHCP_OPT60 | EBT_IP_DHCP_OPT61 | EBT_IP_DHCP_OPT77 | EBT_IP_DHCP_OPT125)
-#else
-#define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\
- EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_LENGTH | EBT_IP_TCP_FLAGS |\
- EBT_IP_DHCP_OPT60 | EBT_IP_DHCP_OPT61 | EBT_IP_DHCP_OPT77 | EBT_IP_DHCP_OPT125)
-#endif
#define DHCP_OPTION_MAX_LEN 556 /* IP header(20) + UDP header(8)+ DHCP header(528) */
#define DHCP_PADDING 0x00
@@ -116,9 +108,7 @@ struct ebt_ip_info
__be32 smsk;
__be32 dmsk;
__u8 tos;
-#if defined(CONFIG_BCM_KF_NETFILTER) || !defined(CONFIG_BCM_IN_KERNEL)
__u8 dscp; /* brcm */
-#endif
__u8 protocol;
__u16 bitmask;
__u16 invflags;
@@ -0,0 +1,72 @@
Index: ebtables-v2.0.10-4/extensions/ebt_policer.c
===================================================================
--- ebtables-v2.0.10-4.orig/extensions/ebt_policer.c 2019-07-25 19:15:34.079084179 +0800
+++ ebtables-v2.0.10-4/extensions/ebt_policer.c 2019-07-26 10:20:59.428494900 +0800
@@ -9,7 +9,8 @@
#define EBT_POLICER_RATE_KBPS 10 /* Policer default rate in kbps. */
#define EBT_POLICER_BURST_KBYTE 10 /* Policer default burst in kbyte. */
-#define EBT_POLICER_MAX_INPUT_VALUE 1000000 /* Max rate value user can input in kbps or mbps. */
+#define EBT_POLICER_MAX_INPUT_VALUE 10000000 /* Max rate value user can input in kbps or mbps. */
+#define EBT_POLICER_MAX_BURST_SIZE 20000 /* Max burst size value user can input in kbytes. */
#if 1//__MSTC__, Jones For compilation
#define FLAG_MODE 0x01
@@ -62,10 +63,10 @@
"tbf mode: \n"
"--policer rate max data rate match, default %ukbps\n"
" [Bits per second followed by kbps or mbps.\n"
- " Support 1kbps to 1000000kbps or 1mbps to 1000000mbps.] \n"
+ " Support 1kbps to 10000000kbps or 1mbps to 10000mbps.] \n"
"--policer-burst size size to match in a burst, default %ukb\n"
" [Kilo-bytes followed by kb.\n"
- " Support 1kb to 1000kb.]\n"
+ " Support 1kb to 20000kb.]\n"
"srtcm mode: \n"
"The nfmark field of red packet is marked as 0x10000, \n"
"yellow packet is 0x20000 and green packet is 0x30000.\n"
@@ -235,7 +236,7 @@
}
str1 = optarg;
r->burst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
ebt_print_error("bad --policer-burst `%s'", optarg);
}
break;
@@ -271,7 +272,7 @@
}
str1 = optarg;
r->burst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
ebt_print_error("bad --cbs-burst `%s'", optarg);
}
break;
@@ -310,7 +311,7 @@
}
str1 = optarg;
r->pbsBurst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->pbsBurst > 1000 || r->pbsBurst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->pbsBurst > EBT_POLICER_MAX_BURST_SIZE || r->pbsBurst <= 0) {
ebt_print_error("bad --pbs-burst `%s'", optarg);
}
break;
@@ -329,7 +330,7 @@
}
str1 = optarg;
r->pbsBurst = strtoul(str1, &remainder, 0);
- if (strcmp(remainder, "kb") !=0 || r->pbsBurst > 1000 || r->pbsBurst <= 0) {
+ if (strcmp(remainder, "kb") !=0 || r->pbsBurst > EBT_POLICER_MAX_BURST_SIZE || r->pbsBurst <= 0) {
ebt_print_error("bad --ebs-burst `%s'", optarg);
}
break;
@@ -375,7 +376,7 @@
str1 = optarg;
r->burst = strtol(str1, &remainder, 0);
- if (strcmp(remainder, "kb") != 0 || r->burst > 1000 || r->burst <= 0) {
+ if (strcmp(remainder, "kb") != 0 || r->burst > EBT_POLICER_MAX_BURST_SIZE || r->burst <= 0) {
print_error("bad --policer-burst `%s'", optarg);
}
break;