Subject: [lp-wan] Ticket #12 Padding Place

From: ana minaburo <[email-masked]>
Date: Tue, 19 Jun 2018 17:17:21 +0200

Interim 13/06/2018

   - 6 positive responses, no negative response from the ML
   - Merge it with the main branch and publish a new version of the draft,

Section 8. Padding management {#Padding}
SCHC C/D and SCHC F/R operate on bits, not bytes. SCHC itself does not have
any alignment prerequisite. If the Layer 2 below SCHC constrains the L2
Data Unit to align to some boundary, called L2 Words (for example, bytes),
SCHC will meet that constraint and produce messages with the correct
alignment. This may entail adding extra bits (called padding bits).

When padding occurs, the number of appended bits is strictly less than the
L2 Word size.

Padding happens at most once for each Packet going through the full SCHC
chain, i.e. Compression and (optionally) SCHC Fragmentation (see {{Fig-
IntroLayers? <https://trac.ietf.org/trac/lpwan/wiki/IntroLayers>}}). If a
SCHC Packet is sent unfragmented (see {{Fig-Operations-Pad}}), it is padded
as needed. If a SCHC Packet is fragmented, only the last fragment is padded
as needed.

A packet (e.g. an IPv6 packet)
         |                                          ^ (padding bits
         v                                          |       dropped)
+------------------+                      +--------------------+
| SCHC Compression |                      | SCHC Decompression |
+------------------+                      +--------------------+
         |                                           ^
         |   If no fragmentation                     |
         +---- SCHC Packet + padding as needed ----->|
         |                                           | (MIC checked
         v                                           |  and removed)
+--------------------+                       +-----------------+
| SCHC Fragmentation |                       | SCHC Reassembly |
+--------------------+                       +-----------------+
     |       ^                                   |       ^
     |       |                                   |       |
     |       +------------- SCHC ACK ------------+       |
     |                                                   |
     +--------------- SCHC Fragments --------------------+
     +--- last SCHC Frag with MIC + padding as needed ---+

        SENDER                                    RECEIVER

{: #Fig-Operations-Pad title='SCHC operations, including padding as needed'}

Each technology-specific document MUST specify the size of the L2 Word. The
L2 Word might actually be a single bit, in which case at most zero bits of
padding will be appended to any message, i.e. no padding will take place at
all.