tbf: Insert LLC dummy command if no frame is available

If a BSN is going to be created but there is no frame stored in
m_llc, an empty LLC message would be created. This shouldn't happen
currently, but this will be a common case, when delayed TBF release
is implemented.

This commit changes create_new_bsn() to create an LLC dummy
command in that case and to put it into the frame buffer.

Sponsored-by: On-Waves ehf
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index c894f5e..9baa1cd 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -349,7 +349,23 @@
 	delimiter = data; /* where next length header would be stored */
 	space = block_data_len - sizeof(*rh);
 	while (1) {
+		if (m_llc.frame_length() == 0) {
+			/* A header will need to by added, so we just need
+			 * space-1 octets */
+			m_llc.put_dummy_frame(space - 1);
+
+			/* It is not clear, when the next real data will
+			 * arrive, so request a DL ack/nack now */
+			request_dl_ack();
+
+			LOGP(DRLCMACDL, LOGL_DEBUG,
+				"-- Empty chunk, "
+				"added LLC dummy command of size %d\n",
+				m_llc.frame_length());
+		}
+
 		chunk = m_llc.chunk_size();
+
 		/* if chunk will exceed block limit */
 		if (chunk > space) {
 			LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d "