[Olsr-dev] [PATCH v1 2/3] cfg: add SmartGatewayWeightExitLink and SmartGatewayWeightEtx
Ferry Huberts
(spam-protected)
Thu Jul 26 16:23:18 CEST 2012
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
README-Olsr-Extensions | 18 ++++++++++++++++++
files/olsrd.conf.default.full | 12 ++++++++++++
files/olsrd.conf.default.lq | 12 ++++++++++++
files/olsrd.conf.default.lq-fisheye | 12 ++++++++++++
src/cfgparser/cfgfile_gen.c | 18 ++++++++++++++++++
src/cfgparser/oparse.y | 20 ++++++++++++++++++++
src/cfgparser/oscan.lex | 10 ++++++++++
7 files changed, 102 insertions(+)
diff --git a/README-Olsr-Extensions b/README-Olsr-Extensions
index a6e9d13..0fc462b 100644
--- a/README-Olsr-Extensions
+++ b/README-Olsr-Extensions
@@ -264,6 +264,24 @@ All other parameters will be ignored if SmartGateway is set to "no"
of a new outgoing gateway if its routing cost is lower or equal to the
configured percentage of the routing cost of the current gateway.
The default setting is 0, which disables it.
+5- SmartGatewayWeightExitLink and SmartGatewayWeightEtx control the weighing
+ of gateway bandwidth and ETX costs. If both are zero then the weighing of
+ the costs is not performed (classical behaviour).
+ Classical behaviour only takes ETX costs into account when choosing a
+ gateway (select the 'nearest' gateway). The weighing also takes the
+ gateway bandwidth into account (select the 'nearest fat pipe' gateway).
+ The formulas used for weighing are:
+
+ SmartGatewaySpeed(upstream) + SmartGatewaySpeed(downstream)
+ bwM = -----------------------------------------------------------
+ 1000
+
+ SmartGatewayWeightExitLink ETX
+ path_cost = -------------------------- + ---------------------
+ bwM SmartGatewayWeightEtx
+
+ Ofcourse, when the bandwidth of a gateway is zero, then it is ignored.
+ Good values are SmartGatewayWeightExitLink=1 and SmartGatewayWeightEtx=4
5.3) Uplink Side
diff --git a/files/olsrd.conf.default.full b/files/olsrd.conf.default.full
index 077d718..3813ab7 100644
--- a/files/olsrd.conf.default.full
+++ b/files/olsrd.conf.default.full
@@ -168,6 +168,18 @@
# SmartGatewayThreshold 0
+# The weighing factor for the gateway bandwidth (exit link).
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightExitLink 0
+
+# The weighing factor for the ETX costs.
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightEtx 0
+
# Defines what kind of Uplink this node will publish as a
# smartgateway. The existence of the uplink is detected by
# a route to 0.0.0.0/0, ::ffff:0:0/96 and/or 2000::/3.
diff --git a/files/olsrd.conf.default.lq b/files/olsrd.conf.default.lq
index 8859eb1..bed032d 100644
--- a/files/olsrd.conf.default.lq
+++ b/files/olsrd.conf.default.lq
@@ -105,6 +105,18 @@
# SmartGatewayThreshold 0
+# The weighing factor for the gateway bandwidth (exit link).
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightExitLink 0
+
+# The weighing factor for the ETX costs.
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightEtx 0
+
# Defines what kind of Uplink this node will publish as a
# smartgateway. The existence of the uplink is detected by
# a route to 0.0.0.0/0, ::ffff:0:0/96 and/or 2000::/3.
diff --git a/files/olsrd.conf.default.lq-fisheye b/files/olsrd.conf.default.lq-fisheye
index bfbd4f5..f2f512a 100644
--- a/files/olsrd.conf.default.lq-fisheye
+++ b/files/olsrd.conf.default.lq-fisheye
@@ -105,6 +105,18 @@
# SmartGatewayThreshold 0
+# The weighing factor for the gateway bandwidth (exit link).
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightExitLink 0
+
+# The weighing factor for the ETX costs.
+# See README-Olsr-Extensions for a description of smartgateways.
+# (default is 0)
+
+# SmartGatewayWeightEtx 0
+
# Defines what kind of Uplink this node will publish as a
# smartgateway. The existence of the uplink is detected by
# a route to 0.0.0.0/0, ::ffff:0:0/96 and/or 2000::/3.
diff --git a/src/cfgparser/cfgfile_gen.c b/src/cfgparser/cfgfile_gen.c
index c5a6ef2..1baf805 100644
--- a/src/cfgparser/cfgfile_gen.c
+++ b/src/cfgparser/cfgfile_gen.c
@@ -474,6 +474,24 @@ void olsrd_write_cnf_autobuf(struct autobuf *out, struct olsrd_config *cnf) {
cnf->smart_gw_thresh);
abuf_puts(out,
"\n"
+ "# The weighing factor for the gateway bandwidth (exit link).\n"
+ "# See README-Olsr-Extensions for a description of smartgateways.\n"
+ "# (default is 0)\n"
+ "\n");
+ abuf_appendf(out, "%sSmartGatewayWeightExitLink %d\n",
+ cnf->smart_gw_weight_exitlink == DEF_GW_WEIGHT_EXITLINK ? "# " : "",
+ cnf->smart_gw_weight_exitlink);
+ abuf_puts(out,
+ "\n"
+ "# The weighing factor for the ETX costs.\n"
+ "# See README-Olsr-Extensions for a description of smartgateways.\n"
+ "# (default is 0)\n"
+ "\n");
+ abuf_appendf(out, "%sSmartGatewayWeightEtx %d\n",
+ cnf->smart_gw_weight_etx == DEF_GW_WEIGHT_ETX ? "# " : "",
+ cnf->smart_gw_weight_etx);
+ abuf_puts(out,
+ "\n"
"# Defines what kind of Uplink this node will publish as a\n"
"# smartgateway. The existence of the uplink is detected by\n"
"# a route to 0.0.0.0/0, ::ffff:0:0/96 and/or 2000::/3.\n"
diff --git a/src/cfgparser/oparse.y b/src/cfgparser/oparse.y
index a6da2b3..dff09cf 100644
--- a/src/cfgparser/oparse.y
+++ b/src/cfgparser/oparse.y
@@ -219,6 +219,8 @@ static int add_ipv6_addr(YYSTYPE ipaddr_arg, YYSTYPE prefixlen_arg)
%token TOK_SMART_GW_PERIOD
%token TOK_SMART_GW_STABLECOUNT
%token TOK_SMART_GW_THRESH
+%token TOK_SMART_GW_WEIGHT_EXITLINK
+%token TOK_SMART_GW_WEIGHT_ETX
%token TOK_SMART_GW_UPLINK
%token TOK_SMART_GW_UPLINK_NAT
%token TOK_SMART_GW_SPEED
@@ -302,6 +304,8 @@ stmt: idebug
| ismart_gw_period
| asmart_gw_stablecount
| asmart_gw_thresh
+ | asmart_gw_weight_exitlink
+ | asmart_gw_weight_etx
| ssmart_gw_uplink
| bsmart_gw_uplink_nat
| ismart_gw_speed
@@ -1318,6 +1322,22 @@ asmart_gw_thresh: TOK_SMART_GW_THRESH TOK_INTEGER
}
;
+asmart_gw_weight_exitlink: TOK_SMART_GW_WEIGHT_EXITLINK TOK_INTEGER
+{
+ PARSER_DEBUG_PRINTF("Smart gateway exitlink weight: %d\n", $2->integer);
+ olsr_cnf->smart_gw_weight_exitlink = $2->integer;
+ free($2);
+}
+;
+
+asmart_gw_weight_etx: TOK_SMART_GW_WEIGHT_ETX TOK_INTEGER
+{
+ PARSER_DEBUG_PRINTF("Smart gateway ETX weight: %d\n", $2->integer);
+ olsr_cnf->smart_gw_weight_etx = $2->integer;
+ free($2);
+}
+;
+
ssmart_gw_uplink: TOK_SMART_GW_UPLINK TOK_STRING
{
PARSER_DEBUG_PRINTF("Smart gateway uplink: %s\n", $2->string);
diff --git a/src/cfgparser/oscan.lex b/src/cfgparser/oscan.lex
index 7c8200c..3e61535 100644
--- a/src/cfgparser/oscan.lex
+++ b/src/cfgparser/oscan.lex
@@ -486,6 +486,16 @@ IPV6ADDR {IPV6PAT1}|{IPV6PAT2}|{IPV6PAT3}|{IPV6PAT4}|{IPV6PAT5}|{IPV6PAT6}|{IPV6
return TOK_SMART_GW_THRESH;
}
+"SmartGatewayWeightExitLink" {
+ yylval = NULL;
+ return TOK_SMART_GW_WEIGHT_EXITLINK;
+}
+
+"SmartGatewayWeightEtx" {
+ yylval = NULL;
+ return TOK_SMART_GW_WEIGHT_ETX;
+}
+
"SmartGatewayUplink" {
yylval = NULL;
return TOK_SMART_GW_UPLINK;
--
1.7.11.2
More information about the Olsr-dev
mailing list