Fix deserializing empty attribute
netlink/route/attrs.scm
150 | 150 | (lambda (decoder bv pos) | |
151 | 151 | (let* ((len (bytevector-u16-ref bv pos (native-endianness))) | |
152 | 152 | (type (bytevector-u16-ref bv (+ pos 2) (native-endianness))) | |
153 | - | (deserialize (get-next-deserialize decoder message-type type)) | |
154 | - | (data-bv (make-bytevector (- len 4)))) | |
155 | - | (bytevector-copy! bv (+ pos 4) data-bv 0 (- len 4)) | |
156 | - | (make-route-attr | |
157 | - | type | |
158 | - | (deserialize decoder data-bv 0))))) | |
153 | + | (deserialize (get-next-deserialize decoder message-type type))) | |
154 | + | (if (= len 0) | |
155 | + | (let ((data-bv (make-bytevector 0))) | |
156 | + | (make-route-attr type (deserialize decoder data-bv 0))) | |
157 | + | (let ((data-bv (make-bytevector (- len 4)))) | |
158 | + | (bytevector-copy! bv (+ pos 4) data-bv 0 (- len 4)) | |
159 | + | (make-route-attr | |
160 | + | type | |
161 | + | (deserialize decoder data-bv 0))))))) | |
159 | 162 | ||
160 | 163 | (define (deserialize-route-attr-data-string decoder bv pos) | |
161 | 164 | (make-string-route-attr |