Commit 69ca589
net: lwm2m: Fix opaque data transfer in block mode
When FW update in PUSH mode is used, the firmware is encapsulated in the
TLV as an opaque data, according to the LMWM2M satandard, and then
sliced into blocks and transferred block by block in several
transactions. Therefore, the TLV header is only present in the initial
message.
Current implementation did not handle this case well, reporting errors
on consecutive blocks, therefore making the FW update in PUSH mode
broken.
This commit fixes this issue with following changes:
* The TLV is only assumed to be present in the initial block, while
consecutive blocks will be processed directly into the appropriate
handler,
* 32-bit variables shall be used whenever dealing with the opaque data
length, since the firmware size can easily exceed the 16-bit range,
* Additional information, required for the FW block transfer to work
properly were added to the block context structure,
* The application shall only be notified of the actual data length, and
not the total block size (the total TLV size including header).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>1 parent daf303e commit 69ca589
File tree
3 files changed
+72
-16
lines changed- subsys/net/lib/lwm2m
3 files changed
+72
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
275 | 281 | | |
276 | 282 | | |
277 | 283 | | |
| |||
2209 | 2215 | | |
2210 | 2216 | | |
2211 | 2217 | | |
2212 | | - | |
| 2218 | + | |
| 2219 | + | |
2213 | 2220 | | |
2214 | 2221 | | |
2215 | 2222 | | |
2216 | 2223 | | |
2217 | 2224 | | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
2218 | 2229 | | |
2219 | | - | |
| 2230 | + | |
| 2231 | + | |
2220 | 2232 | | |
2221 | 2233 | | |
2222 | 2234 | | |
| |||
2234 | 2246 | | |
2235 | 2247 | | |
2236 | 2248 | | |
2237 | | - | |
| 2249 | + | |
2238 | 2250 | | |
2239 | 2251 | | |
2240 | 2252 | | |
| 2253 | + | |
2241 | 2254 | | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2242 | 2263 | | |
2243 | 2264 | | |
2244 | | - | |
| 2265 | + | |
2245 | 2266 | | |
2246 | 2267 | | |
2247 | 2268 | | |
2248 | 2269 | | |
2249 | 2270 | | |
2250 | 2271 | | |
2251 | 2272 | | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
2252 | 2284 | | |
2253 | 2285 | | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
2254 | 2290 | | |
2255 | 2291 | | |
2256 | 2292 | | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
2257 | 2297 | | |
2258 | 2298 | | |
2259 | 2299 | | |
2260 | 2300 | | |
2261 | 2301 | | |
2262 | 2302 | | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
2263 | 2311 | | |
2264 | | - | |
2265 | | - | |
2266 | | - | |
2267 | | - | |
2268 | | - | |
2269 | | - | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
2270 | 2316 | | |
2271 | 2317 | | |
2272 | 2318 | | |
| |||
2318 | 2364 | | |
2319 | 2365 | | |
2320 | 2366 | | |
2321 | | - | |
2322 | | - | |
2323 | 2367 | | |
2324 | 2368 | | |
2325 | 2369 | | |
| |||
2328 | 2372 | | |
2329 | 2373 | | |
2330 | 2374 | | |
2331 | | - | |
| 2375 | + | |
2332 | 2376 | | |
2333 | 2377 | | |
2334 | 2378 | | |
| |||
2340 | 2384 | | |
2341 | 2385 | | |
2342 | 2386 | | |
2343 | | - | |
2344 | | - | |
| 2387 | + | |
2345 | 2388 | | |
2346 | 2389 | | |
2347 | 2390 | | |
| |||
3498 | 3541 | | |
3499 | 3542 | | |
3500 | 3543 | | |
| 3544 | + | |
| 3545 | + | |
3501 | 3546 | | |
3502 | 3547 | | |
3503 | 3548 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
922 | 933 | | |
923 | 934 | | |
924 | 935 | | |
| |||
0 commit comments