Use separate decoders for link and addr route attribtes
netlink/deserialize.scm
45 | 45 | (link-attr ,(route:deserialize-route-attr 'link-attr) | |
46 | 46 | ,@route:%default-route-link-attr-decoder) | |
47 | 47 | (ipv4-attr ,(route:deserialize-route-attr 'ipv4-attr) | |
48 | - | ,@route:%default-route-ipv4-attr-decoder) | |
48 | + | ,@route:%default-route-addr-ipv4-attr-decoder) | |
49 | 49 | (ipv6-attr ,(route:deserialize-route-attr 'ipv6-attr) | |
50 | - | ,@route:%default-route-ipv6-attr-decoder))) | |
50 | + | ,@route:%default-route-addr-ipv6-attr-decoder))) |
netlink/route/attrs.scm
44 | 44 | deserialize-route-attr-data-ipv4 | |
45 | 45 | deserialize-route-attr-data-ipv6 | |
46 | 46 | deserialize-route-attr-data-bv | |
47 | - | default-route-attr-decoder | |
48 | 47 | %default-route-link-attr-decoder | |
49 | - | %default-route-ipv4-attr-decoder | |
50 | - | %default-route-ipv6-attr-decoder)) | |
48 | + | %default-route-addr-ipv4-attr-decoder | |
49 | + | %default-route-addr-ipv6-attr-decoder)) | |
51 | 50 | ||
52 | 51 | (define-data-type route-attr | |
53 | 52 | attr-type-size | |
… | |||
194 | 193 | (make-ipv6-route-attr | |
195 | 194 | (inet-ntop AF_INET6 (ipv6->number bv)))) | |
196 | 195 | ||
197 | - | (define (default-route-attr-decoder deserialize-addr) | |
198 | - | `((,IFLA_IFNAME . ,deserialize-route-attr-data-string) | |
199 | - | (,IFLA_QDISC . ,deserialize-route-attr-data-string) | |
200 | - | (,IFLA_IFALIAS . ,deserialize-route-attr-data-string) | |
201 | - | (,IFLA_PHYS_PORT_NAME . ,deserialize-route-attr-data-string) | |
196 | + | (define %default-route-link-attr-decoder | |
197 | + | `((,IFLA_ADDRESS . ,deserialize-route-attr-data-ethernet) | |
198 | + | (,IFLA_BROADCAST . ,deserialize-route-attr-data-ethernet) | |
199 | + | (,IFLA_IFNAME . ,deserialize-route-attr-data-string) | |
202 | 200 | (,IFLA_MTU . ,deserialize-route-attr-data-u32) | |
203 | - | (,IFLA_TXQLEN . ,deserialize-route-attr-data-u32) | |
204 | 201 | (,IFLA_LINK . ,deserialize-route-attr-data-u32) | |
205 | - | (,IFLA_WEIGHT . ,deserialize-route-attr-data-u32) | |
206 | - | (,IFLA_MASTER . ,deserialize-route-attr-data-u32) | |
207 | - | (,IFLA_NUM_VF . ,deserialize-route-attr-data-u32) | |
208 | - | (,IFLA_PROMISCUITY . ,deserialize-route-attr-data-u32) | |
209 | - | (,IFLA_NUM_TX_QUEUES . ,deserialize-route-attr-data-u32) | |
210 | - | (,IFLA_NUM_RX_QUEUES . ,deserialize-route-attr-data-u32) | |
211 | - | (,IFLA_GSO_MAX_SEGS . ,deserialize-route-attr-data-u32) | |
212 | - | (,IFLA_GSO_MAX_SIZE . ,deserialize-route-attr-data-u32) | |
213 | - | (,IFLA_GROUP . ,deserialize-route-attr-data-u32) | |
214 | - | (,IFLA_CARRIER_CHANGES . ,deserialize-route-attr-data-u32) | |
215 | - | (,IFLA_NET_NS_PID . ,deserialize-route-attr-data-u32) | |
216 | - | (,IFLA_NET_NS_FD . ,deserialize-route-attr-data-u32) | |
217 | - | (,IFLA_NEW_IFINDEX . ,deserialize-route-attr-data-u32) | |
218 | - | (,IFLA_MIN_MTU . ,deserialize-route-attr-data-u32) | |
219 | - | (,IFLA_MAX_MTU . ,deserialize-route-attr-data-u32) | |
220 | - | (,IFLA_CARRIER_UP_COUNT . ,deserialize-route-attr-data-u32) | |
221 | - | (,IFLA_CARRIER_DOWN_COUNT . ,deserialize-route-attr-data-u32) | |
222 | - | (,IFLA_OPERSTATE . ,deserialize-route-attr-data-u8) | |
223 | - | (,IFLA_LINKMODE . ,deserialize-route-attr-data-u8) | |
224 | - | (,IFLA_CARRIER . ,deserialize-route-attr-data-u8) | |
225 | - | (,IFLA_PROTO_DOWN . ,deserialize-route-attr-data-u8) | |
226 | - | (,IFLA_ADDRESS . ,deserialize-addr) | |
227 | - | (,IFLA_BROADCAST . ,deserialize-addr) | |
228 | - | (,IFLA_PERM_ADDRESS . ,deserialize-addr) | |
202 | + | (,IFLA_QDISC . ,deserialize-route-attr-data-string) | |
203 | + | ;; TODO: struct rtnl_link_stats | |
204 | + | ;(,IFLA_STATS . ,deserialize-route-attr-data-stats) | |
229 | 205 | (default . ,deserialize-route-attr-data-bv))) | |
230 | 206 | ||
231 | - | (define %default-route-link-attr-decoder | |
232 | - | (default-route-attr-decoder deserialize-route-attr-data-ethernet)) | |
207 | + | (define (default-route-addr-attr-decoder address-decoder) | |
208 | + | `((,IFA_ADDRESS . ,address-decoder) | |
209 | + | (,IFA_LOCAL . ,address-decoder) | |
210 | + | (,IFA_LABEL . ,deserialize-route-attr-data-string) | |
211 | + | (,IFA_BROADCAST . ,address-decoder) | |
212 | + | (,IFA_ANYCAST . ,address-decoder) | |
213 | + | ;; TODO: struct ifa_cacheinfo | |
214 | + | ;(,IFA_CACHEINFO . ,deserialize-route-attr-data-cache-info) | |
215 | + | (default . ,deserialize-route-attr-data-bv))) | |
233 | 216 | ||
234 | - | (define %default-route-ipv4-attr-decoder | |
235 | - | (default-route-attr-decoder deserialize-route-attr-data-ipv4)) | |
217 | + | (define %default-route-addr-ipv4-attr-decoder | |
218 | + | (default-route-addr-attr-decoder deserialize-route-attr-data-ipv4)) | |
236 | 219 | ||
237 | - | (define %default-route-ipv6-attr-decoder | |
238 | - | (default-route-attr-decoder deserialize-route-attr-data-ipv6)) | |
220 | + | (define %default-route-addr-ipv6-attr-decoder | |
221 | + | (default-route-addr-attr-decoder deserialize-route-attr-data-ipv6)) |