aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_bridge.h
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-10-03 02:32:55 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-10-03 02:32:55 +0000
commit631cabba47716ccecae352bb2b4521a489b64bb2 (patch)
tree81463e122dd64666359b94491d982e4fae0c6743 /sys/netgraph/ng_bridge.h
parentb6fa976de268fd8768df428e63858db729a14ae9 (diff)
downloadsrc-631cabba47716ccecae352bb2b4521a489b64bb2.tar.gz
src-631cabba47716ccecae352bb2b4521a489b64bb2.zip
- Remove the compile time limit for number of links a ng_bridge node
can handle. Instead using an array on node private data, use per-hook private data. - Use NG_NODE_FOREACH_HOOK() to traverse through hooks instead of array. PR: 240787 Submitted by: Lutz Donnerhacke <lutz donnerhacke.de> Differential Revision: https://reviews.freebsd.org/D21803
Notes
Notes: svn path=/head/; revision=353026
Diffstat (limited to 'sys/netgraph/ng_bridge.h')
-rw-r--r--sys/netgraph/ng_bridge.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/sys/netgraph/ng_bridge.h b/sys/netgraph/ng_bridge.h
index c34d27d9966b..fa11bec9a26b 100644
--- a/sys/netgraph/ng_bridge.h
+++ b/sys/netgraph/ng_bridge.h
@@ -45,18 +45,14 @@
/* Node type name and magic cookie */
#define NG_BRIDGE_NODE_TYPE "bridge"
-#define NGM_BRIDGE_COOKIE 967239368
+#define NGM_BRIDGE_COOKIE 1569321993
/* Hook names */
#define NG_BRIDGE_HOOK_LINK_PREFIX "link" /* append decimal integer */
#define NG_BRIDGE_HOOK_LINK_FMT "link%d" /* for use with printf(3) */
-/* Maximum number of supported links */
-#define NG_BRIDGE_MAX_LINKS 32
-
/* Node configuration structure */
struct ng_bridge_config {
- u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */
u_char debugLevel; /* debug level */
u_int32_t loopTimeout; /* link loopback mute time */
u_int32_t maxStaleness; /* max host age before nuking */
@@ -64,8 +60,7 @@ struct ng_bridge_config {
};
/* Keep this in sync with the above structure definition */
-#define NG_BRIDGE_CONFIG_TYPE_INFO(ainfo) { \
- { "ipfw", (ainfo) }, \
+#define NG_BRIDGE_CONFIG_TYPE_INFO { \
{ "debugLevel", &ng_parse_uint8_type }, \
{ "loopTimeout", &ng_parse_uint32_type }, \
{ "maxStaleness", &ng_parse_uint32_type }, \
@@ -110,18 +105,28 @@ struct ng_bridge_link_stats {
{ NULL } \
}
+struct ng_bridge_link;
+typedef struct ng_bridge_link *link_p;
/* Structure describing a single host */
struct ng_bridge_host {
u_char addr[6]; /* ethernet address */
- u_int16_t linkNum; /* link where addr can be found */
+ link_p link; /* link where addr can be found */
u_int16_t age; /* seconds ago entry was created */
u_int16_t staleness; /* seconds ago host last heard from */
};
+/* external representation of the host */
+struct ng_bridge_hostent {
+ u_char addr[6]; /* ethernet address */
+ char hook[NG_HOOKSIZ]; /* link where addr can be found */
+ u_int16_t age; /* seconds ago entry was created */
+ u_int16_t staleness; /* seconds ago host last heard from */
+};
+
/* Keep this in sync with the above structure definition */
#define NG_BRIDGE_HOST_TYPE_INFO(entype) { \
{ "addr", (entype) }, \
- { "linkNum", &ng_parse_uint16_type }, \
+ { "hook", &ng_parse_hookbuf_type }, \
{ "age", &ng_parse_uint16_type }, \
{ "staleness", &ng_parse_uint16_type }, \
{ NULL } \
@@ -129,8 +134,8 @@ struct ng_bridge_host {
/* Structure returned by NGM_BRIDGE_GET_TABLE */
struct ng_bridge_host_ary {
- u_int32_t numHosts;
- struct ng_bridge_host hosts[];
+ u_int32_t numHosts;
+ struct ng_bridge_hostent hosts[];
};
/* Keep this in sync with the above structure definition */