Diff between 4c9d3308b5f30db660f355cc5a369ba3dd08c43f and f0619047c2db9026f0b6d772e86af618f6ee258f

Changed Files

File Additions Deletions Status
mesh/btmesh.c +1 -0 modified
mesh/main.c +1 -0 modified
mesh/net.c +9 -6 modified

Full Patch

diff --git a/mesh/btmesh.c b/mesh/btmesh.c
index 6a005a9..083947b 100644
--- a/mesh/btmesh.c
+++ b/mesh/btmesh.c
@@ -24,6 +24,7 @@
 
 #include <ctype.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include <ell/ell.h>
diff --git a/mesh/main.c b/mesh/main.c
index 97f506a..db6bee5 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -24,6 +24,7 @@
 
 #include <getopt.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <signal.h>
diff --git a/mesh/net.c b/mesh/net.c
index 444d383..c9f057f 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -2041,8 +2041,9 @@ static bool seg_rxed(struct mesh_net *net, bool frnd,
 		l_timeout_remove(sar_in->seg_timeout);
 		sar_in->seg_timeout = NULL;
 		return true;
+	}
 
-	} else if (reset_seg_to) {
+	if (reset_seg_to) {
 		/* Restart Inter-Seg Timeout */
 		l_timeout_remove(sar_in->seg_timeout);
 
@@ -2054,8 +2055,10 @@ static bool seg_rxed(struct mesh_net *net, bool frnd,
 
 			sar_in->seg_timeout = l_timeout_create(SEG_TO,
 				inseg_to, net, NULL);
-		}
-	}
+		} else
+			largest = 0;
+	} else
+		largest = 0;
 
 	l_debug("NAK: %d expected:%08x largest:%08x flags:%08x",
 			reset_seg_to, expected, largest, sar_in->flags);
@@ -2819,9 +2822,6 @@ static void lpn_process_beacon(void *user_data, const void *data,
 	rxed_key_refresh = (buf[0] & 0x01) == 0x01;
 	iv_index = l_get_be32(buf + 1);
 
-	l_debug("KR: %d -- IVU: %d -- IV: %8.8x",
-				rxed_key_refresh, iv_index);
-
 	/* Inhibit recognizing iv_update true-->false if we have outbound
 	 * SAR messages in flight
 	 */
@@ -2830,6 +2830,9 @@ static void lpn_process_beacon(void *user_data, const void *data,
 			iv_update = true;
 	}
 
+	l_debug("KR: %d -- IVU: %d -- IV: %8.8x",
+				rxed_key_refresh, iv_update, iv_index);
+
 	/* TODO: figure out actual network index (i.e., friendship subnet) */
 	subnet = get_primary_subnet(net);
 	if (!subnet)