[Olsr-dev] [PATCH v1 5/5] sgw: do not send zero bandwidth sgw HNAs by default
Ferry Huberts
(spam-protected)
Fri May 8 10:12:41 CEST 2015
From: Ferry Huberts <(spam-protected)>
Previously, setting the uplink and/or downlink speed to zero would
cause zero bandwidth HNAs to be sent.
This patch ensures that these HNAs will not be sent, only after the
bandwidth was non-zero and it has become zero will these HNAs be sent
(so only in the 'unannounce' window of the previous patch).
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/build_msg.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/build_msg.c b/src/build_msg.c
index 43d1ea6..281148b 100644
--- a/src/build_msg.c
+++ b/src/build_msg.c
@@ -986,6 +986,13 @@ __attribute__((unused))
bool is_def_route = is_prefix_inetgw(&h->net);
#endif
+#ifdef __linux__
+ if (!zero && olsr_cnf->smart_gw_active && is_def_route && smartgw_is_zero_bandwidth(olsr_cnf)) {
+ /* this is the default route, with zero bandwidth, do not append it */
+ return;
+ }
+#endif /* __linux__ */
+
if ((*curr_size + (2 * olsr_cnf->ipsize)) > *remainsize) {
/* Only add HNA message if it contains data */
if (*curr_size > OLSR_HNA_IPV4_HDRSIZE) {
@@ -1141,6 +1148,13 @@ __attribute__((unused))
bool is_def_route = is_prefix_inetgw(&h->net);
#endif
+#ifdef __linux__
+ if (!zero && olsr_cnf->smart_gw_active && is_def_route && smartgw_is_zero_bandwidth(olsr_cnf)) {
+ /* this is the default route, with zero bandwidth, do not append it */
+ return;
+ }
+#endif /* __linux__ */
+
if ((*curr_size + (2 * olsr_cnf->ipsize)) > *remainsize) {
/* Only add HNA message if it contains data */
if (*curr_size > OLSR_HNA_IPV6_HDRSIZE) {
--
2.1.0
More information about the Olsr-dev
mailing list