gateway: only advertise linkspeed when the link is bi-directional
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 18 Jul 2012 16:28:48 +0000 (18:28 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 19 Jul 2012 07:53:56 +0000 (09:53 +0200)
Uni-directional links produce all kinds of funky network behaviour.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index ee122b7..74b7d19 100644 (file)
@@ -131,7 +131,8 @@ void refresh_smartgw_netmask(void) {
 
     ip = (uint8_t *) &smart_gateway_netmask;
 
-    if (olsr_cnf->smart_gw_uplink > 0 || olsr_cnf->smart_gw_downlink > 0) {
+    if (olsr_cnf->smart_gw_uplink > 0 && olsr_cnf->smart_gw_downlink > 0) {
+      /* the link is bi-directional with a non-zero bandwidth */
       ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_LINKSPEED;
       ip[GW_HNA_DOWNLINK] = serialize_gw_speed(olsr_cnf->smart_gw_downlink);
       ip[GW_HNA_UPLINK] = serialize_gw_speed(olsr_cnf->smart_gw_uplink);